feat: add fail test

pull/8534/head
xxkl1 3 years ago
parent 6ba2f72251
commit ff3404442c

@ -1,5 +1,5 @@
export default { export default {
html: '<div>1024x768</div>', html: '<div>1024x768</div><div>1</div>',
before_test() { before_test() {
Object.defineProperties(window, { Object.defineProperties(window, {
@ -10,6 +10,10 @@ export default {
innerHeight: { innerHeight: {
value: 768, value: 768,
configurable: true configurable: true
},
devicePixelRatio: {
value: 1,
configurable: true
} }
}); });
}, },
@ -27,13 +31,17 @@ export default {
innerHeight: { innerHeight: {
value: 456, value: 456,
configurable: true configurable: true
},
devicePixelRatio: {
value: 2,
configurable: true
} }
}); });
await window.dispatchEvent(event); await window.dispatchEvent(event);
assert.htmlEqual(target.innerHTML, ` assert.htmlEqual(target.innerHTML, `
<div>567x456</div> <div>567x456</div><div>2</div>
`); `);
} }
}; };

@ -1,8 +1,10 @@
<script> <script>
export let width; export let width;
export let height; export let height;
export let devicePixelRatio;
</script> </script>
<svelte:window bind:innerWidth={width} bind:innerHeight={height}/> <svelte:window bind:innerWidth={width} bind:innerHeight={height} bind:devicePixelRatio={devicePixelRatio}/>
<div>{width}x{height}</div> <div>{width}x{height}</div>
<div>{devicePixelRatio}</div>

Loading…
Cancel
Save