-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(@dpc-sdp/ripple-ui-core): adding component tests
- Loading branch information
David Featherston
committed
Jun 23, 2023
1 parent
a368de2
commit 030817a
Showing
16 changed files
with
580 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/ripple-ui-core/src/components/data-table/RplDataTable.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import RplDataTable from './RplDataTable.vue' | ||
import { RplDataTableColumns, RplDataTableItems } from './fixtures/sample' | ||
|
||
const props = { | ||
columns: RplDataTableColumns, | ||
items: RplDataTableItems | ||
} | ||
|
||
describe('RplDataTable', () => { | ||
it('mounts', () => { | ||
cy.mount(RplDataTable, { props }) | ||
}) | ||
|
||
it('toggles the display of more information', () => { | ||
cy.mount(RplDataTable, { props }) | ||
|
||
cy.get('.rpl-data-table__row').first().as('row') | ||
cy.get('@row').find('.rpl-data-table__toggle').as('toggle') | ||
cy.get('@row').find('.rpl-data-table__details').as('details') | ||
|
||
cy.get('@details').should('be.hidden') | ||
cy.get('@toggle').should('contain.text', 'More info') | ||
|
||
cy.get('@toggle').click() | ||
|
||
cy.get('@details').should('be.visible') | ||
cy.get('@toggle').should('contain.text', 'Less info') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/ripple-ui-core/src/components/data-table/fixtures/sample.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export const RplDataTableColumns = [ | ||
'Column 1', | ||
'Column 2', | ||
'Column 3', | ||
'Column 4' | ||
] | ||
|
||
export const RplDataTableItems = [ | ||
[ | ||
'R1 - C1', | ||
'R1 - C2', | ||
'R1 - C3', | ||
'R1 - C4', | ||
['<p><strong>R1 test heading</strong></p><p>R1 test content</p>'] | ||
], | ||
[ | ||
'R2 - C1', | ||
'R2 - C2', | ||
'R2 - C3', | ||
'R2 - C4', | ||
['<p><strong>R2 test heading</strong></p><p>R2 test content</p>'] | ||
], | ||
['R3 - C1', 'R3 - C2', 'R3 - C3', 'R3 - C4', ['R3 test content text only']] | ||
] |
27 changes: 27 additions & 0 deletions
27
packages/ripple-ui-core/src/components/footer/RplFooter.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import RplFooter from './RplFooter.vue' | ||
import { RplFooterLinks } from './fixtures/sample' | ||
import { bpMin } from '../../lib/breakpoints' | ||
|
||
const props = { | ||
nav: RplFooterLinks | ||
} | ||
|
||
describe('RplFooter', () => { | ||
it('mounts', () => { | ||
cy.mount(RplFooter, { props }) | ||
}) | ||
|
||
it('allows menus to be opened on small screens', () => { | ||
cy.viewport(bpMin.s, 1000).mount(RplFooter, { props }) | ||
|
||
cy.get('.rpl-footer-nav-section__header-inner-button').first().as('button') | ||
|
||
cy.get('@button').click() | ||
|
||
cy.get('@button') | ||
.invoke('attr', 'aria-controls') | ||
.then((id) => { | ||
cy.get(`#${id}`).should('be.visible') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.