material-icon.spec.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import MaterialIcon from '@/shared/components/material-icon'
  2. import unfilledIconTypes from '../../../../frontend/fonts/material-symbols/unfilled-symbols.mjs'
  3. const FONT_SIZE = 40
  4. describe('MaterialIcon', function () {
  5. describe('Filled', function () {
  6. it('contains symbols', function () {
  7. cy.mount(<MaterialIcon type="home" style={{ fontSize: FONT_SIZE }} />)
  8. cy.get('.material-symbols').as('icon')
  9. cy.get('@icon')
  10. .invoke('width')
  11. .should('be.within', FONT_SIZE - 1, FONT_SIZE + 1)
  12. })
  13. })
  14. describe('Unfilled', function () {
  15. it('uses a Firefox allowlisted icon font family name', function () {
  16. cy.mount(<MaterialIcon type="description" unfilled />)
  17. cy.get('.material-symbols.unfilled')
  18. .invoke('css', 'font-family')
  19. .should('contain', 'Material Symbols Outlined')
  20. })
  21. it('contains all unfilled symbols', function () {
  22. for (const type of unfilledIconTypes) {
  23. cy.mount(
  24. <MaterialIcon type={type} unfilled style={{ fontSize: FONT_SIZE }} />
  25. )
  26. cy.get('.material-symbols').as('icon')
  27. cy.get('@icon')
  28. .invoke('width')
  29. .should('be.within', FONT_SIZE - 1, FONT_SIZE + 1)
  30. }
  31. })
  32. })
  33. })