66 assertRenderedRows ,
77 withAriaRowIndex ,
88} from "./table-test-utils" ;
9+ import { LocalDataSourceProvider } from "@vuu-ui/vuu-data-test" ;
910
1011describe ( "Table scrolling and keyboard navigation" , ( ) => {
1112 const RENDER_BUFFER = 5 ;
@@ -21,7 +22,11 @@ describe("Table scrolling and keyboard navigation", () => {
2122 describe ( "Page Keys" , ( ) => {
2223 describe ( "WHEN first cell is focussed and page down pressed" , ( ) => {
2324 it ( "THEN table scrolls down and next page of rows are rendered, first cell of new page is focussed" , ( ) => {
24- cy . mount ( < TestTable { ...tableConfig } /> ) ;
25+ cy . mount (
26+ < LocalDataSourceProvider >
27+ < TestTable { ...tableConfig } />
28+ </ LocalDataSourceProvider > ,
29+ ) ;
2530
2631 // interestingly, realClick doesn't work here
2732 cy . findByRole ( "cell" , { name : "row 1" } ) . click ( ) ;
@@ -62,7 +67,11 @@ describe("Table scrolling and keyboard navigation", () => {
6267
6368 describe ( "AND WHEN page up is then pressed" , ( ) => {
6469 it ( "THEN table is back to original state, and first cell is once again focussed" , ( ) => {
65- cy . mount ( < TestTable { ...tableConfig } /> ) ;
70+ cy . mount (
71+ < LocalDataSourceProvider >
72+ < TestTable { ...tableConfig } />
73+ </ LocalDataSourceProvider > ,
74+ ) ;
6675
6776 // interestingly, realClick doesn't work here
6877 cy . findByRole ( "cell" , { name : "row 1" } ) . click ( ) ;
@@ -87,7 +96,11 @@ describe("Table scrolling and keyboard navigation", () => {
8796 describe ( "Home / End Keys" , ( ) => {
8897 describe ( "WHEN topmost rows are in viewport, first cell is focussed and Home key pressed " , ( ) => {
8998 it ( "THEN nothing changes" , ( ) => {
90- cy . mount ( < TestTable { ...tableConfig } /> ) ;
99+ cy . mount (
100+ < LocalDataSourceProvider >
101+ < TestTable { ...tableConfig } />
102+ </ LocalDataSourceProvider > ,
103+ ) ;
91104 // interestingly, realClick doesn't work here
92105 cy . findByRole ( "cell" , { name : "row 1" } ) . click ( ) ;
93106 cy . realPress ( "Home" ) ;
@@ -102,7 +115,11 @@ describe("Table scrolling and keyboard navigation", () => {
102115 } ) ;
103116 describe ( "WHEN topmost rows are in viewport, cell in middle of viewport is focussed and Home key pressed " , ( ) => {
104117 it ( "THEN no scrolling, but focus moves to first cell" , ( ) => {
105- cy . mount ( < TestTable { ...tableConfig } /> ) ;
118+ cy . mount (
119+ < LocalDataSourceProvider >
120+ < TestTable { ...tableConfig } />
121+ </ LocalDataSourceProvider > ,
122+ ) ;
106123 // interestingly, realClick doesn't work here
107124 cy . findByRole ( "cell" , { name : "row 5" } ) . click ( ) ;
108125 cy . realPress ( "Home" ) ;
@@ -118,7 +135,11 @@ describe("Table scrolling and keyboard navigation", () => {
118135
119136 describe ( "WHEN topmost rows are in viewport, first cell is focussed and End key pressed " , ( ) => {
120137 it ( "THEN scrolls to end of data, last cell is focussed (same column)" , ( ) => {
121- cy . mount ( < TestTable { ...tableConfig } /> ) ;
138+ cy . mount (
139+ < LocalDataSourceProvider >
140+ < TestTable { ...tableConfig } />
141+ </ LocalDataSourceProvider > ,
142+ ) ;
122143 // interestingly, realClick doesn't work here
123144 cy . findByRole ( "cell" , { name : "row 1" } ) . click ( ) ;
124145 cy . realPress ( "End" ) ;
@@ -134,7 +155,11 @@ describe("Table scrolling and keyboard navigation", () => {
134155
135156 describe ( "WHEN topmost rows are in viewport, cell mid viewport focussed and End key pressed " , ( ) => {
136157 it ( "THEN scrolls to end of data, last cell is focussed (same column)" , ( ) => {
137- cy . mount ( < TestTable { ...tableConfig } /> ) ;
158+ cy . mount (
159+ < LocalDataSourceProvider >
160+ < TestTable { ...tableConfig } />
161+ </ LocalDataSourceProvider > ,
162+ ) ;
138163 // interestingly, realClick doesn't work here
139164 cy . findByRole ( "cell" , { name : "row 10" } ) . click ( ) ;
140165 cy . realPress ( "End" ) ;
@@ -152,7 +177,11 @@ describe("Table scrolling and keyboard navigation", () => {
152177 describe ( "Arrow Up / Down Keys" , ( ) => {
153178 describe ( "WHEN topmost rows are in viewport, first cell is focussed and Down Arrow key pressed " , ( ) => {
154179 it ( "THEN no scrolling, focus moved down to next cell" , ( ) => {
155- cy . mount ( < TestTable { ...tableConfig } /> ) ;
180+ cy . mount (
181+ < LocalDataSourceProvider >
182+ < TestTable { ...tableConfig } />
183+ </ LocalDataSourceProvider > ,
184+ ) ;
156185 // interestingly, realClick doesn't work here
157186 cy . findByRole ( "cell" , { name : "row 1" } ) . click ( ) ;
158187 cy . realPress ( "ArrowDown" ) ;
@@ -167,7 +196,11 @@ describe("Table scrolling and keyboard navigation", () => {
167196 } ) ;
168197 describe ( "WHEN topmost rows are in viewport, first cell in last row is focussed and Down Arrow key pressed " , ( ) => {
169198 it ( "THEN scroll down by 1 row, cell in bottom row has focus" , ( ) => {
170- cy . mount ( < TestTable { ...tableConfig } /> ) ;
199+ cy . mount (
200+ < LocalDataSourceProvider >
201+ < TestTable { ...tableConfig } />
202+ </ LocalDataSourceProvider > ,
203+ ) ;
171204 // interestingly, realClick doesn't work here
172205 cy . findByRole ( "cell" , { name : "row 30" } ) . click ( ) ;
173206 cy . realPress ( "ArrowDown" ) ;
@@ -185,7 +218,11 @@ describe("Table scrolling and keyboard navigation", () => {
185218 describe ( "scrolling with Scrollbar" , ( ) => {
186219 describe ( "WHEN scrolled down by a distance equating to 500 rows" , ( ) => {
187220 it . skip ( "THEN correct rows are within viewport" , ( ) => {
188- cy . mount ( < TestTable { ...tableConfig } /> ) ;
221+ cy . mount (
222+ < LocalDataSourceProvider >
223+ < TestTable { ...tableConfig } />
224+ </ LocalDataSourceProvider > ,
225+ ) ;
189226 cy . get ( ".vuuTable-scrollbarContainer" ) . scrollTo ( 0 , 10000 ) ;
190227 assertRenderedRows ( { from : 500 , to : 530 } , RENDER_BUFFER , ROW_COUNT ) ;
191228 } ) ;
@@ -197,7 +234,11 @@ describe("Table scrolling and keyboard navigation", () => {
197234 it ( "THEN only those columns within the viewport are rendered" , ( ) => {
198235 // this width allows for exactly 6 visible columns, we allow a buffer of 200px
199236 // so 2 out-of-viewport colums are rendered
200- cy . mount ( < TwoHundredColumns width = { 914 } /> ) ;
237+ cy . mount (
238+ < LocalDataSourceProvider >
239+ < TwoHundredColumns width = { 914 } />
240+ </ LocalDataSourceProvider > ,
241+ ) ;
201242 assertRenderedColumns ( {
202243 rendered : { from : 1 , to : 8 } ,
203244 visible : { from : 1 , to : 6 } ,
@@ -207,7 +248,11 @@ describe("Table scrolling and keyboard navigation", () => {
207248
208249 describe ( "WHEN table is scrolled horizontally no more than 100px" , ( ) => {
209250 it ( "THEN rendering is unchanged" , ( ) => {
210- cy . mount ( < TwoHundredColumns width = { 914 } /> ) ;
251+ cy . mount (
252+ < LocalDataSourceProvider >
253+ < TwoHundredColumns width = { 914 } />
254+ </ LocalDataSourceProvider > ,
255+ ) ;
211256 cy . get ( ".vuuTable-scrollbarContainer" ) . scrollTo ( 100 , 0 ) ;
212257 assertRenderedColumns ( {
213258 rendered : { from : 1 , to : 8 } ,
@@ -218,7 +263,11 @@ describe("Table scrolling and keyboard navigation", () => {
218263
219264 describe ( "WHEN table is scrolled beyond the 100px buffer" , ( ) => {
220265 it ( "THEN additional column(s) are rendered" , ( ) => {
221- cy . mount ( < TwoHundredColumns width = { 915 } /> ) ;
266+ cy . mount (
267+ < LocalDataSourceProvider >
268+ < TwoHundredColumns width = { 915 } />
269+ </ LocalDataSourceProvider > ,
270+ ) ;
222271 cy . get ( ".vuuTable-scrollbarContainer" ) . scrollTo ( 110 , 0 ) ;
223272 assertRenderedColumns ( {
224273 rendered : { from : 1 , to : 9 } ,
@@ -230,7 +279,11 @@ describe("Table scrolling and keyboard navigation", () => {
230279
231280 describe ( "WHEN table is scrolled exactly one viewport width" , ( ) => {
232281 it ( "THEN next set of columns are rendered" , ( ) => {
233- cy . mount ( < TwoHundredColumns width = { 915 } /> ) ;
282+ cy . mount (
283+ < LocalDataSourceProvider >
284+ < TwoHundredColumns width = { 915 } />
285+ </ LocalDataSourceProvider > ,
286+ ) ;
234287 cy . get ( ".vuuTable-scrollbarContainer" ) . scrollTo ( 900 , 0 ) ;
235288 assertRenderedColumns ( {
236289 rendered : { from : 6 , to : 14 } ,
0 commit comments