@@ -51,16 +51,16 @@ describe('ScrollButtons', () => {
5151 } ) ;
5252
5353 it ( 'shows scroll-to-bottom button when at the top of scrollable page' , async ( ) => {
54- const { queryByTitle } = render ( < ScrollButtons /> ) ;
54+ const { queryByLabelText } = render ( < ScrollButtons /> ) ;
5555
5656 await waitFor ( ( ) => {
57- expect ( queryByTitle ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
57+ expect ( queryByLabelText ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
5858 } ) ;
59- expect ( queryByTitle ( 'Scroll to top' ) ) . toBeFalsy ( ) ;
59+ expect ( queryByLabelText ( 'Scroll to top' ) ) . toBeFalsy ( ) ;
6060 } ) ;
6161
6262 it ( 'shows scroll-to-top button when at the bottom of scrollable page' , async ( ) => {
63- const { queryByTitle } = render ( < ScrollButtons /> ) ;
63+ const { queryByLabelText } = render ( < ScrollButtons /> ) ;
6464
6565 // Simulate scrolling down
6666 Object . defineProperty ( window , 'scrollY' , {
@@ -71,12 +71,12 @@ describe('ScrollButtons', () => {
7171 fireEvent . scroll ( window ) ;
7272
7373 await waitFor ( ( ) => {
74- expect ( queryByTitle ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
74+ expect ( queryByLabelText ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
7575 } ) ;
7676 } ) ;
7777
7878 it ( 'shows both buttons when in middle of page' , async ( ) => {
79- const { queryByTitle } = render ( < ScrollButtons /> ) ;
79+ const { queryByLabelText } = render ( < ScrollButtons /> ) ;
8080
8181 // Simulate scrolling to middle
8282 Object . defineProperty ( window , 'scrollY' , {
@@ -87,13 +87,13 @@ describe('ScrollButtons', () => {
8787 fireEvent . scroll ( window ) ;
8888
8989 await waitFor ( ( ) => {
90- expect ( queryByTitle ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
91- expect ( queryByTitle ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
90+ expect ( queryByLabelText ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
91+ expect ( queryByLabelText ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
9292 } ) ;
9393 } ) ;
9494
9595 it ( 'hides scroll-to-bottom button when at bottom' , async ( ) => {
96- const { queryByTitle } = render ( < ScrollButtons /> ) ;
96+ const { queryByLabelText } = render ( < ScrollButtons /> ) ;
9797
9898 Object . defineProperty ( window , 'scrollY' , {
9999 writable : true ,
@@ -103,16 +103,16 @@ describe('ScrollButtons', () => {
103103 fireEvent . scroll ( window ) ;
104104
105105 await waitFor ( ( ) => {
106- expect ( queryByTitle ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
107- expect ( queryByTitle ( 'Scroll to bottom' ) ) . toBeFalsy ( ) ;
106+ expect ( queryByLabelText ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
107+ expect ( queryByLabelText ( 'Scroll to bottom' ) ) . toBeFalsy ( ) ;
108108 } ) ;
109109 } ) ;
110110
111111 it ( 'scrolls to top when scroll to top button is clicked' , async ( ) => {
112112 const scrollToSpy = vi . fn ( ) ;
113113 window . scrollTo = scrollToSpy ;
114114
115- const { queryByTitle } = render ( < ScrollButtons /> ) ;
115+ const { queryByLabelText } = render ( < ScrollButtons /> ) ;
116116
117117 // scroll down first
118118 Object . defineProperty ( window , 'scrollY' , {
@@ -123,10 +123,10 @@ describe('ScrollButtons', () => {
123123 fireEvent . scroll ( window ) ;
124124
125125 await waitFor ( ( ) => {
126- expect ( queryByTitle ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
126+ expect ( queryByLabelText ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
127127 } ) ;
128128
129- const scrollTopButton = queryByTitle ( 'Scroll to top' ) ;
129+ const scrollTopButton = queryByLabelText ( 'Scroll to top' ) ;
130130 fireEvent . click ( scrollTopButton ) ;
131131
132132 expect ( scrollToSpy ) . toHaveBeenCalledWith ( {
@@ -139,13 +139,13 @@ describe('ScrollButtons', () => {
139139 const scrollToSpy = vi . fn ( ) ;
140140 window . scrollTo = scrollToSpy ;
141141
142- const { queryByTitle } = render ( < ScrollButtons /> ) ;
142+ const { queryByLabelText } = render ( < ScrollButtons /> ) ;
143143
144144 await waitFor ( ( ) => {
145- expect ( queryByTitle ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
145+ expect ( queryByLabelText ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
146146 } ) ;
147147
148- const scrollBottomButton = queryByTitle ( 'Scroll to bottom' ) ;
148+ const scrollBottomButton = queryByLabelText ( 'Scroll to bottom' ) ;
149149 fireEvent . click ( scrollBottomButton ) ;
150150
151151 expect ( scrollToSpy ) . toHaveBeenCalledWith ( {
@@ -155,7 +155,7 @@ describe('ScrollButtons', () => {
155155 } ) ;
156156
157157 it ( 'handles maximized container scroll events' , async ( ) => {
158- const { queryByTitle , container } = render ( < ScrollButtons /> ) ;
158+ const { queryByLabelText , container } = render ( < ScrollButtons /> ) ;
159159
160160 // Create container first, then add the maximized class to trigger MutationObserver later
161161 const maximizedContainer = document . createElement ( 'div' ) ;
@@ -184,7 +184,7 @@ describe('ScrollButtons', () => {
184184
185185 // Wait for MutationObserver to detect the class change and apply maximized class
186186 await waitFor ( ( ) => {
187- expect ( queryByTitle ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
187+ expect ( queryByLabelText ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
188188 const scrollButtonsContainer = container . querySelector (
189189 '.tkn--scroll-buttons'
190190 ) ;
@@ -205,12 +205,12 @@ describe('ScrollButtons', () => {
205205
206206 // Both buttons should be visible
207207 await waitFor ( ( ) => {
208- expect ( queryByTitle ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
209- expect ( queryByTitle ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
208+ expect ( queryByLabelText ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
209+ expect ( queryByLabelText ( 'Scroll to bottom' ) ) . toBeTruthy ( ) ;
210210 } ) ;
211211
212212 // test scroll-to-top button in maximized mode
213- const scrollTopButton = queryByTitle ( 'Scroll to top' ) ;
213+ const scrollTopButton = queryByLabelText ( 'Scroll to top' ) ;
214214 fireEvent . click ( scrollTopButton ) ;
215215
216216 expect ( containerScrollToSpy ) . toHaveBeenCalledWith ( {
@@ -219,7 +219,7 @@ describe('ScrollButtons', () => {
219219 } ) ;
220220
221221 // test scroll-to-bottom button in maximized mode
222- const scrollBottomButton = queryByTitle ( 'Scroll to bottom' ) ;
222+ const scrollBottomButton = queryByLabelText ( 'Scroll to bottom' ) ;
223223 fireEvent . click ( scrollBottomButton ) ;
224224
225225 expect ( containerScrollToSpy ) . toHaveBeenCalledWith ( {
@@ -236,8 +236,8 @@ describe('ScrollButtons', () => {
236236 fireEvent . scroll ( maximizedContainer ) ;
237237
238238 await waitFor ( ( ) => {
239- expect ( queryByTitle ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
240- expect ( queryByTitle ( 'Scroll to bottom' ) ) . toBeFalsy ( ) ;
239+ expect ( queryByLabelText ( 'Scroll to top' ) ) . toBeTruthy ( ) ;
240+ expect ( queryByLabelText ( 'Scroll to bottom' ) ) . toBeFalsy ( ) ;
241241 } ) ;
242242 } ) ;
243243
0 commit comments