Skip to content

Commit

Permalink
test: check that fontpicker can test font loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ae9is committed Nov 22, 2023
1 parent 364ff96 commit 184953d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/fontpicker/cypress/e2e/app.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,23 @@ describe('react fontpicker docs', () => {
cy.get('@picker').find('.font-preview-bickleyscript').click({ force: true })
cy.get('@value').should('have.text', 'Current value: BickleyScript')
})

it('can test whether fonts have been loaded by the client', () => {
cy.getBySel('checkloaded-fontpicker').as('picker')
cy.getBySel('checkloaded-button').as('loadButton')
cy.getBySel('checkloaded-value').as('value')
cy.getBySel('checkloaded-loaded').as('isLoaded')
// Currently selected fontpicker font should not be loaded
cy.get('@value').contains('Unlock')
cy.get('@isLoaded').contains('false')
// Load some fonts specified in loadFonts which don't include currently selected font,
// and check that load test still fails
cy.get('@loadButton').click()
cy.get('@value').contains('Unlock')
cy.get('@isLoaded').contains('false')
// Select one of the loaded fonts and check that load test succeeds
cy.get('@picker').find('.fontpicker__search').type('Unkempt{enter}');
cy.get('@value').contains('Unkempt')
cy.get('@isLoaded').contains('true')
})
})

0 comments on commit 184953d

Please sign in to comment.