From 516948b2f5ef3de37b7232fceeebfb2931cc75fa Mon Sep 17 00:00:00 2001 From: portikM Date: Thu, 12 Sep 2024 11:00:54 -0400 Subject: [PATCH] test(ktableview): update component tests [KHCP-13108] --- src/components/KTableView/KTableView.cy.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/KTableView/KTableView.cy.ts b/src/components/KTableView/KTableView.cy.ts index 93cc4f0e0a..a9d756e164 100644 --- a/src/components/KTableView/KTableView.cy.ts +++ b/src/components/KTableView/KTableView.cy.ts @@ -78,17 +78,20 @@ const options = { name: 'Basic Auth', id: '517526354743085', enabled: 'true', + expandable: true, }, { name: 'Website Desktop', id: '328027447731198', enabled: 'false', bulkActionsDisabled: true, + expandable: false, }, { name: 'Android App', id: '405383051040955', enabled: 'true', + expandable: false, }, ], } @@ -470,17 +473,17 @@ describe('KTableView', () => { }) describe('expandable rows and nested tables', () => { - it('displays expand trigger for each row when rowExpandable prop is true', () => { + it('displays expand trigger for each row when function passed via rowExpandable prop returns true', () => { mount(KTableView, { props: { headers: options.headers, data: options.data, - rowExpandable: () => true, + rowExpandable: (row: any) => row.expandable, }, }) - cy.getTestId('expandable-row-control').should('have.length', options.data.length).should('be.visible') - cy.getTestId('expandable-content-row').should('have.length', options.data.length) + cy.getTestId('expandable-row-control').should('have.length', options.data.filter(row => row.expandable).length).should('be.visible') + cy.getTestId('expandable-content-row').should('have.length', options.data.filter(row => row.expandable).length) }) it('displays content provided through row-expanded slot', () => { @@ -495,6 +498,9 @@ describe('KTableView', () => { }, }) + cy.getTestId('expandable-row-control').should('have.length', options.data.length).should('be.visible') + cy.getTestId('expandable-content-row').should('have.length', options.data.length) + cy.getTestId('expandable-content-row').findTestId('slotted-expandable-content').should('not.be.visible') cy.getTestId('expandable-row-control').eq(0).click().then(() => { cy.getTestId('expandable-content-row').eq(0).findTestId('slotted-expandable-content').should('be.visible')