-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(addon-table):
TablePagination
show checkmark for selected `[siz…
…e]` (#1780)
- Loading branch information
1 parent
0950f8e
commit 4a26fac
Showing
4 changed files
with
77 additions
and
3 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
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
59 changes: 59 additions & 0 deletions
59
...cts/demo-integrations/cypress/tests/addon-table/table-pagination/table-pagination.spec.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,59 @@ | ||
describe('TablePagination', () => { | ||
beforeEach(() => { | ||
cy.viewport('macbook-13'); | ||
}); | ||
|
||
describe('Dropdown with `[size]`-options (amount items per page)', () => { | ||
it('Basic case', () => { | ||
cy.tuiVisit('/components/table-pagination/API'); | ||
initializeAliases('#demoContent'); | ||
|
||
cy.get('@linesPerPageSelect').click(); | ||
waitForCheckmarkIcon(); | ||
cy.get('@tablePagination').matchImageSnapshot('0-[size]-dropdown-base', { | ||
padding: [0, 0, 150, 0], | ||
}); | ||
}); | ||
|
||
it('With very long option name', () => { | ||
const LONG_NUMBER = 10000000000000000000; | ||
|
||
cy.tuiVisit( | ||
encodeURI( | ||
`/components/table-pagination/API?items=[0, ${LONG_NUMBER}]&size=${LONG_NUMBER}&total=${LONG_NUMBER}&page=0`, | ||
), | ||
); | ||
initializeAliases('#demoContent'); | ||
|
||
cy.get('@linesPerPageSelect').click(); | ||
waitForCheckmarkIcon(); | ||
cy.get('@tablePagination').matchImageSnapshot( | ||
'1-[size]-dropdown-long-option-name', | ||
{ | ||
padding: [0, 0, 100, 0], | ||
}, | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
function initializeAliases(selectorToTablePagination: string): void { | ||
cy.get(`${selectorToTablePagination} tui-table-pagination`) | ||
.should('be.visible') | ||
.as('tablePagination'); | ||
|
||
cy.get('@tablePagination') | ||
.find( | ||
'[automation-id=tui-table-pagination__lines-per-page-wrapper] tui-hosted-dropdown', | ||
) | ||
.should('be.visible') | ||
.as('linesPerPageSelect'); | ||
} | ||
|
||
function waitForCheckmarkIcon(): void { | ||
cy.get('tui-dropdown-box') | ||
.find('tui-svg[src=tuiIconCheckLarge] use') | ||
.should('be.visible') | ||
.invoke('height') | ||
.should('be.greaterThan', 0); | ||
} |