@@ -3,11 +3,13 @@ describe('Test the Data view docs page', () => {
33 it ( 'displays a layout with a table and paginates' , ( ) => {
44 const ouiaId = 'LayoutExample' ;
55
6- cy . visit ( 'http://localhost:8006/extensions/data-view/data-view- layout' ) ;
6+ cy . visit ( 'http://localhost:8006/extensions/data-view/layout' ) ;
77
88 cy . get ( `[data-ouia-component-id="${ ouiaId } Header-pagination"]` ) . should ( 'exist' ) ;
9+ cy . get ( `[data-ouia-component-id="${ ouiaId } Header-bulk-select"]` ) . should ( 'exist' ) ;
910
1011 cy . get ( `[data-ouia-component-id="${ ouiaId } Footer-pagination"]` ) . should ( 'exist' ) ;
12+ cy . get ( `[data-ouia-component-id="${ ouiaId } Footer-bulk-select"]` ) . should ( 'not.exist' ) ;
1113
1214 cy . get ( `[data-ouia-component-id="${ ouiaId } -th-0"]` ) . contains ( 'Repositories' ) ;
1315 cy . get ( `[data-ouia-component-id="${ ouiaId } -th-4"]` ) . contains ( 'Last commit' ) ;
@@ -23,5 +25,35 @@ describe('Test the Data view docs page', () => {
2325 // move to previous page
2426 cy . get ( `[data-action="previous"` ) . eq ( 1 ) . click ( { force : true } ) ;
2527 cy . get ( `[data-ouia-component-id="${ ouiaId } -td-0-4"]` ) . contains ( 'five' ) ;
28+
29+ // test bulk select
30+ cy . get ( `input[type="checkbox"` ) . each ( ( $checkbox ) => { cy . wrap ( $checkbox ) . should ( 'not.be.checked' ) } ) ;
31+
32+ // page checkbox select
33+ cy . get ( `[data-ouia-component-id="BulkSelect-checkbox"` ) . first ( ) . click ( ) ;
34+ cy . get ( `input[type="checkbox"` ) . each ( ( $checkbox ) => { cy . wrap ( $checkbox ) . should ( 'be.checked' ) } ) ;
35+ cy . contains ( '5 selected' ) . should ( 'exist' ) ;
36+
37+ // select none
38+ cy . get ( `[data-ouia-component-id="BulkSelect-toggle"` ) . first ( ) . click ( { force : true } ) ;
39+ cy . get ( `[data-ouia-component-id="BulkSelect-select-none"` ) . first ( ) . click ( ) ;
40+ cy . contains ( '5 selected' ) . should ( 'not.exist' ) ;
41+
42+ // select all
43+ cy . get ( `[data-ouia-component-id="BulkSelect-toggle"` ) . first ( ) . click ( { force : true } ) ;
44+ cy . get ( `[data-ouia-component-id="BulkSelect-select-all"` ) . first ( ) . click ( ) ;
45+ cy . get ( `input[type="checkbox"` ) . each ( ( $checkbox ) => { cy . wrap ( $checkbox ) . should ( 'be.checked' ) } ) ;
46+ cy . contains ( '6 selected' ) . should ( 'exist' ) ;
47+
48+ // page checkbox deselect
49+ cy . get ( `[data-ouia-component-id="BulkSelect-checkbox"` ) . first ( ) . click ( ) ;
50+ cy . get ( `input[type="checkbox"` ) . each ( ( $checkbox ) => { cy . wrap ( $checkbox ) . should ( 'not.be.checked' ) } ) ;
51+ cy . contains ( '1 selected' ) . should ( 'exist' ) ;
52+
53+ // select page
54+ cy . get ( `[data-ouia-component-id="BulkSelect-toggle"` ) . first ( ) . click ( { force : true } ) ;
55+ cy . get ( `[data-ouia-component-id="BulkSelect-select-page"` ) . first ( ) . click ( ) ;
56+ cy . get ( `input[type="checkbox"` ) . each ( ( $checkbox ) => { cy . wrap ( $checkbox ) . should ( 'be.checked' ) } ) ;
57+ cy . contains ( '6 selected' ) . should ( 'exist' ) ;
2658 } )
27- } )
59+ } ) ;
0 commit comments