MCPcopy
hub / github.com/vuejs/core / testSvg

Function testSvg

packages/vue/__tests__/e2e/svg.spec.ts:73–140  ·  view source on GitHub ↗
(apiType: 'classic' | 'composition')

Source from the content-addressed store, hash-verified

71 }
72
73 async function testSvg(apiType: 'classic' | 'composition') {
74 const baseUrl = `file://${path.resolve(
75 __dirname,
76 `../../examples/${apiType}/svg.html`,
77 )}`
78
79 await page().goto(baseUrl)
80 await page().waitForSelector('svg')
81 expect(await count('g')).toBe(1)
82 expect(await count('polygon')).toBe(1)
83 expect(await count('circle')).toBe(1)
84 expect(await count('text')).toBe(6)
85 expect(await count('label')).toBe(6)
86 expect(await count('button')).toBe(7)
87 expect(await count('input[type="range"]')).toBe(6)
88 await assertPolygon(6)
89 await assertLabels(6)
90 await assertStats([100, 100, 100, 100, 100, 100])
91
92 await setValue(nthRange(1), '10')
93 await assertPolygon(6)
94 await assertLabels(6)
95 await assertStats([10, 100, 100, 100, 100, 100])
96
97 await click('button.remove')
98 expect(await count('text')).toBe(5)
99 expect(await count('label')).toBe(5)
100 expect(await count('button')).toBe(6)
101 expect(await count('input[type="range"]')).toBe(5)
102 await assertPolygon(5)
103 await assertLabels(5)
104 await assertStats([100, 100, 100, 100, 100])
105
106 await typeValue('input[name="newlabel"]', 'foo')
107 await click('#add > button')
108 expect(await count('text')).toBe(6)
109 expect(await count('label')).toBe(6)
110 expect(await count('button')).toBe(7)
111 expect(await count('input[type="range"]')).toBe(6)
112 await assertPolygon(6)
113 await assertLabels(6)
114 await assertStats([100, 100, 100, 100, 100, 100])
115
116 await setValue(nthRange(1), '10')
117 await assertPolygon(6)
118 await assertLabels(6)
119 await assertStats([10, 100, 100, 100, 100, 100])
120
121 await setValue(nthRange(2), '20')
122 await assertPolygon(6)
123 await assertLabels(6)
124 await assertStats([10, 20, 100, 100, 100, 100])
125
126 await setValue(nthRange(6), '60')
127 await assertPolygon(6)
128 await assertLabels(6)
129 await assertStats([10, 20, 100, 100, 100, 60])
130

Callers 1

svg.spec.tsFile · 0.85

Calls 11

assertPolygonFunction · 0.85
assertLabelsFunction · 0.85
assertStatsFunction · 0.85
nthRangeFunction · 0.85
gotoMethod · 0.80
waitForSelectorMethod · 0.80
countFunction · 0.70
setValueFunction · 0.70
clickFunction · 0.70
typeValueFunction · 0.70
resolveMethod · 0.65

Tested by

no test coverage detected