You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/window-binding-resize/_config.js

51 lines
916 B

export default {
html: '<div>1024x768</div><div>1</div>',
before_test() {
Object.defineProperties(window, {
innerWidth: {
value: 1024,
configurable: true
},
innerHeight: {
value: 768,
configurable: true
},
devicePixelRatio: {
value: 1,
configurable: true
}
});
},
skip_if_ssr: true, // there's some kind of weird bug with this test... it compiles with the wrong require.extensions hook for some bizarre reason
async test({ assert, target, window }) {
const event = new window.Event('resize');
Object.defineProperties(window, {
innerWidth: {
value: 567,
configurable: true
},
innerHeight: {
value: 456,
configurable: true
},
devicePixelRatio: {
value: 2,
configurable: true
}
});
await window.dispatchEvent(event);
assert.htmlEqual(
target.innerHTML,
`
<div>567x456</div><div>2</div>
`
);
}
};