test.spec.js 691 B

12345678910111213141516171819202122232425
  1. import fs from 'fs'
  2. import path from 'path'
  3. describe('SVGIcon', () => {
  4. let container
  5. beforeEach(() => {
  6. container = document.createElement('div')
  7. document.body.appendChild(container)
  8. })
  9. afterEach(() => {
  10. container.innerHTML = ''
  11. document.body.removeChild(container)
  12. })
  13. test('renders the correct class and XML namespace', () => {
  14. container.innerHTML = fs.readFileSync(path.join('./icons', '2fa.svg'), 'utf-8')
  15. const svg = container.querySelector('svg')
  16. expect(svg.getAttribute('xmlns')).toBe('http://www.w3.org/2000/svg')
  17. expect(svg.classList.contains('icon')).toBe(true)
  18. expect(svg.classList.contains('icon-tabler')).toBe(true)
  19. })
  20. })