material-icon.spec.tsx 962 B

123456789101112131415161718192021222324252627282930
  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('Contain all unfilled symbol', function () {
  16. for (const type of unfilledIconTypes) {
  17. cy.mount(
  18. <MaterialIcon type={type} unfilled style={{ fontSize: FONT_SIZE }} />
  19. )
  20. cy.get('.material-symbols').as('icon')
  21. cy.get('@icon')
  22. .invoke('width')
  23. .should('be.within', FONT_SIZE - 1, FONT_SIZE + 1)
  24. }
  25. })
  26. })
  27. })