test(e2e): enhance and fix test of svg example (#560)

This commit is contained in:
CodinCat
2020-06-12 23:32:27 +09:00
committed by GitHub
parent c463a71bb3
commit c7cd386194
3 changed files with 103 additions and 18 deletions

View File

@@ -76,6 +76,17 @@ export function setupPuppeteer() {
}
async function setValue(selector: string, value: string) {
await page.$eval(
selector,
(node, value) => {
(node as HTMLInputElement).value = value
node.dispatchEvent(new Event('input'))
},
value
)
}
async function typeValue(selector: string, value: string) {
const el = (await page.$(selector))!
await el.evaluate(node => ((node as HTMLInputElement).value = ''))
await el.type(value)
@@ -108,6 +119,7 @@ export function setupPuppeteer() {
isChecked,
isFocused,
setValue,
typeValue,
enterValue,
clearValue
}