File tree Expand file tree Collapse file tree 3 files changed +37
-7
lines changed
packages/module/src/DataView Expand file tree Collapse file tree 3 files changed +37
-7
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import DataView from '../../packages/module/dist/dynamic/DataView' ;
3+ import DataViewToolbar from '../../packages/module/dist/esm/DataViewToolbar' ;
24
35describe ( 'DataView' , ( ) => {
4- it ( 'renders data view' , ( ) => {
5- cy . mount ( < div id = "test" > Some text</ div > ) ;
6+ it ( 'renders the data view layout' , ( ) => {
7+ cy . mount ( < DataView > < > Data view content</ > </ DataView > )
8+ cy . get ( '[data-ouia-component-id="DataView-stack-item-0"]' ) . contains ( 'Data view content' ) ;
9+ } ) ;
610
7- cy . get ( '[id="test"]' ) . should ( 'contain' , 'Some text' ) ;
8- } )
9- } )
11+ it ( 'renders the data view with toolbar, data section and footer' , ( ) => {
12+ cy . mount (
13+ < DataView >
14+ < DataViewToolbar page = { 1 } perPage = { 10 } />
15+ < > Data section</ >
16+ < DataViewToolbar page = { 1 } perPage = { 10 } isBottom />
17+ </ DataView >
18+ ) ;
19+ cy . get ( '[data-ouia-component-id="DataViewToolbar-pagination"]' ) . should ( 'exist' ) ;
20+ cy . get ( '[data-ouia-component-id="DataView-stack-item-1"]' ) . contains ( 'Data section' ) ;
21+ cy . get ( '[data-ouia-component-id="DataViewToolbar-pagination-bottom"]' ) . should ( 'exist' ) ;
22+ } ) ;
23+ } ) ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import DataViewToolbar from '../../packages/module/dist/dynamic/DataViewToolbar' ;
3+
4+ describe ( 'DataViewToolbar' , ( ) => {
5+ it ( 'renders the data view toolbar' , ( ) => {
6+ cy . mount ( < DataViewToolbar page = { 1 } perPage = { 10 } /> )
7+ cy . get ( '[data-ouia-component-id="DataViewToolbar-pagination-bottom"]' ) . should ( 'not.exist' ) ;
8+ cy . get ( '[data-ouia-component-id="DataViewToolbar-pagination"]' ) . should ( 'exist' ) ;
9+ } ) ;
10+
11+ it ( 'renders the data view bottom toolbar' , ( ) => {
12+ cy . mount ( < DataViewToolbar page = { 1 } perPage = { 10 } isBottom /> )
13+ cy . get ( '[data-ouia-component-id="DataViewToolbar-pagination"]' ) . should ( 'not.exist' ) ;
14+ cy . get ( '[data-ouia-component-id="DataViewToolbar-pagination-bottom"]' ) . should ( 'exist' ) ;
15+ } ) ;
16+ } ) ;
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ import DataView from './DataView';
66describe ( 'DataView' , ( ) => {
77
88 it ( 'should render data view' , ( ) => {
9- render ( < DataView / >) ;
10- expect ( screen . getByText ( 'This is Data view' ) ) . toBeInTheDocument ( ) ;
9+ render ( < DataView > < > Data view content </ > </ DataView > ) ;
10+ expect ( screen . getByText ( 'Data view content ' ) ) . toBeInTheDocument ( ) ;
1111 } ) ;
1212
1313} ) ;
You can’t perform that action at this time.
0 commit comments