refactor(types): use stricter settings

fix #847
This commit is contained in:
Evan You
2020-03-23 11:08:22 -04:00
parent b3890a93e3
commit b8c1be18f3
27 changed files with 385 additions and 381 deletions

View File

@@ -42,7 +42,7 @@ export function setupPuppeteer() {
}
async function value(selector: string) {
return await page.$eval(selector, (node: HTMLInputElement) => node.value)
return await page.$eval(selector, node => (node as HTMLInputElement).value)
}
async function html(selector: string) {
@@ -58,14 +58,17 @@ export function setupPuppeteer() {
}
async function isVisible(selector: string) {
const display = await page.$eval(selector, (node: HTMLElement) => {
const display = await page.$eval(selector, node => {
return window.getComputedStyle(node).display
})
return display !== 'none'
}
async function isChecked(selector: string) {
return await page.$eval(selector, (node: HTMLInputElement) => node.checked)
return await page.$eval(
selector,
node => (node as HTMLInputElement).checked
)
}
async function isFocused(selector: string) {
@@ -74,13 +77,13 @@ export function setupPuppeteer() {
async function setValue(selector: string, value: string) {
const el = (await page.$(selector))!
await el.evaluate((node: HTMLInputElement) => (node.value = ''))
await el.evaluate(node => ((node as HTMLInputElement).value = ''))
await el.type(value)
}
async function enterValue(selector: string, value: string) {
const el = (await page.$(selector))!
await el.evaluate((node: HTMLInputElement) => (node.value = ''))
await el.evaluate(node => ((node as HTMLInputElement).value = ''))
await el.type(value)
await el.press('Enter')
}
@@ -88,7 +91,7 @@ export function setupPuppeteer() {
async function clearValue(selector: string) {
return await page.$eval(
selector,
(node: HTMLInputElement) => (node.value = '')
node => ((node as HTMLInputElement).value = '')
)
}

View File

@@ -18,7 +18,7 @@ describe('e2e: markdown', () => {
await page().type('textarea', '\n## foo\n\n- bar\n- baz')
// assert the output is not updated yet because of debounce
expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
await page().waitFor(30)
await page().waitFor(100)
expect(await html('#editor div')).toBe(
'<h1 id="hello">hello</h1>\n' +
'<h2 id="foo">foo</h2>\n' +