search-visuals.cy.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. // To update snapshots, run `yarn cypress:snapshots`
  3. // DO NOT update snapshots, when running with --open flag (Cypress GUI)
  4. import { mountFormField, checkFormMatchesSnapshot } from '#cy/utils.ts'
  5. describe('testing visuals for "FieldSearch"', () => {
  6. const input = 'search test'
  7. it(`renders usual search`, () => {
  8. mountFormField('search', { label: 'search' })
  9. checkFormMatchesSnapshot()
  10. cy.get('input')
  11. .focus()
  12. .then(() => {
  13. checkFormMatchesSnapshot({ subTitle: 'focused' })
  14. })
  15. cy.get('input')
  16. .type(input)
  17. .then(() => {
  18. checkFormMatchesSnapshot({ subTitle: 'filled' })
  19. })
  20. })
  21. it(`renders disabled search`, () => {
  22. mountFormField('search', { label: 'search', disabled: true })
  23. checkFormMatchesSnapshot()
  24. })
  25. it(`renders hidden search`, () => {
  26. mountFormField('search', { label: 'search', labelSrOnly: true })
  27. checkFormMatchesSnapshot()
  28. cy.get('input')
  29. .type(input)
  30. .then(() => {
  31. checkFormMatchesSnapshot({ subTitle: 'filled' })
  32. })
  33. })
  34. })