diff --git a/web_src/js/svg.test.js b/web_src/js/svg.test.js index 8366ab5ac7d96..f110f31f878d4 100644 --- a/web_src/js/svg.test.js +++ b/web_src/js/svg.test.js @@ -1,5 +1,6 @@ import {expect, test} from 'vitest'; -import {svg, svgParseOuterInner} from './svg.js'; +import {svg, SvgIcon, svgParseOuterInner} from './svg.js'; +import {createApp, h} from 'vue'; test('svg', () => { expect(svg('octicon-repo')).toMatch(/^ { expect(svgOuter.nodeName).toMatch('svg'); expect(svgOuter.classList.contains('octicon-repo')).toBeTruthy(); expect(svgInnerHtml).toContain(' { + const root = document.createElement('div'); + createApp({render: () => h(SvgIcon, {name: 'octicon-link', size: 24, class: 'base', className: 'extra'})}).mount(root); + expect(root.firstChild.nodeName).toEqual('svg'); + expect(root.firstChild.getAttribute('width')).toEqual('24'); + expect(root.firstChild.getAttribute('height')).toEqual('24'); + expect(root.firstChild.classList.contains('octicon-link')).toBeTruthy(); + expect(root.firstChild.classList.contains('base')).toBeTruthy(); + expect(root.firstChild.classList.contains('extra')).toBeTruthy(); +});