pull/13225/head
Rich Harris 2 years ago
parent d5a3e18894
commit e49017dd59

@ -4,12 +4,17 @@ import { test } from '../../assert';
export default test({ export default test({
async test({ target, assert }) { async test({ target, assert }) {
const button = target.querySelector('button'); const button = target.querySelector('button');
const h1 = () => target.querySelector('iframe').contentWindow.document.querySelector('h1'); const h1 = () =>
/** @type {HTMLHeadingElement} */ (
/** @type {Window} */ (
target.querySelector('iframe')?.contentWindow
).document.querySelector('h1')
);
assert.equal(h1().textContent, 'count: 0'); assert.equal(h1().textContent, 'count: 0');
assert.equal(getComputedStyle(h1()).color, 'rgb(255, 0, 0)'); assert.equal(getComputedStyle(h1()).color, 'rgb(255, 0, 0)');
flushSync(() => button.click()); flushSync(() => button?.click());
assert.equal(h1().textContent, 'count: 1'); assert.equal(h1().textContent, 'count: 1');
assert.equal(getComputedStyle(h1()).color, 'rgb(255, 0, 0)'); assert.equal(getComputedStyle(h1()).color, 'rgb(255, 0, 0)');

Loading…
Cancel
Save