-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: correct Sbanken typography docs (#2432)
Updated typography docs for Sbanken theme and fixed a couple of bugs in the process. Added e2e tests.
- Loading branch information
Showing
6 changed files
with
145 additions
and
36 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
packages/dnb-design-system-portal/cypress/e2e/typography.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,60 @@ | ||
/** | ||
* Cypress e2e Test | ||
* | ||
* TODO: Add one for ui theme? | ||
*/ | ||
|
||
describe('Typography', () => { | ||
beforeEach(() => { | ||
// skip animation, use sbanken theme | ||
cy.visit('/quickguide-designer/fonts?data-visual-test&eufemia-theme=sbanken') | ||
|
||
// Check if app is mounted | ||
cy.get('#dnb-drawer-list__portal', { timeout: 10000 }).should('exist') | ||
}) | ||
|
||
afterEach(() => { | ||
cy.clearLocalStorage('eufemia-theme') | ||
}) | ||
|
||
it('docs should include heading xx-large example with correct font-size', () => { | ||
cy.get('h2').should('contain', 'Heading xx-large') | ||
cy.get('.typography-box > .dnb-h--xx-large').should('have.css', 'font-size', '48px') | ||
}) | ||
|
||
it('docs should include heading x-large example with correct font-size', () => { | ||
cy.get('h2').should('contain', 'Heading x-large') | ||
cy.get('.typography-box > .dnb-h--x-large').should('have.css', 'font-size', '34px') | ||
}) | ||
|
||
it('docs should include heading large example with correct font-size', () => { | ||
cy.get('h2').should('contain', 'Heading large') | ||
cy.get('.typography-box > .dnb-h--large').should('have.css', 'font-size', '26px') | ||
}) | ||
|
||
it('examples should have correct color', () => { | ||
cy.get('.typography-box > .dnb-h--xx-large').should('have.css', 'color', 'rgb(24, 23, 42)') | ||
cy.get('.typography-box > .dnb-h--x-large').should('have.css', 'color', 'rgb(24, 23, 42)') | ||
cy.get('.typography-box > .dnb-h--large').should('have.css', 'color', 'rgb(24, 23, 42)') | ||
cy.get('.typography-box > .dnb-p').should('have.css', 'color', 'rgb(24, 23, 42)') | ||
cy.get('.typography-box > .dnb-lead').should('have.css', 'color', 'rgb(24, 23, 42)') | ||
}) | ||
|
||
it('line-height examples should have correct line-height', () => { | ||
cy.get('.typography-box > .lh-12').should('have.css', 'line-height', '12px') | ||
cy.get('.typography-box > .lh-16').should('have.css', 'line-height', '16px') | ||
cy.get('.typography-box > .lh-20').should('have.css', 'line-height', '20px') | ||
cy.get('.typography-box > .lh-24').should('have.css', 'line-height', '24px') | ||
cy.get('.typography-box > .lh-28').should('have.css', 'line-height', '28px') | ||
cy.get('.typography-box > .lh-32').should('have.css', 'line-height', '32px') | ||
}) | ||
|
||
it('bold text should have correct font-weight', () => { | ||
cy.get('.typography-box > .dnb-typo-bold').should('have.css', 'font-weight', '700') | ||
}) | ||
|
||
it('examples should not have paragraphs inside headings', () => { | ||
cy.get('.typography-box *[class^="dnb-h--"] .dnb-p').should('not.exist') | ||
}) | ||
}) | ||
|
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
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
c3f9661
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
eufemia – ./
eufemia-git-main-eufemia.vercel.app
eufemia-eufemia.vercel.app
eufemia-dnb-design-system-portal.vercel.app