0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00

Failing test for #1743

global.getComputedStyle and global.navigator are needed for
addResizeListener in shared/dom
This commit is contained in:
pk 2018-11-04 20:25:57 +01:00
parent 1f79099d2f
commit fd9dc30088
3 changed files with 27 additions and 0 deletions

View File

@ -48,6 +48,8 @@ export function tryToReadFile(file) {
export const virtualConsole = new jsdom.VirtualConsole();
const { window } = new jsdom.JSDOM('<main></main>', {virtualConsole});
global.document = window.document;
global.getComputedStyle = window.getComputedStyle;
global.navigator = {userAgent: 'fake'};
export function env() {
window._svelteTransitionManager = null;

View File

@ -0,0 +1,8 @@
export default {
'skip-ssr': true,
test(assert, component, target) {
assert.ok(component.onstateRanBeforeOncreate);
assert.ok(!component.onupdateRanBeforeOncreate);
}
};

View File

@ -0,0 +1,17 @@
<div bind:offsetWidth=width></div>
<script>
export default {
onstate() {
this.onstateRan = true;
},
onupdate() {
this.onupdateRan = true;
},
oncreate() {
this.onstateRanBeforeOncreate = this.onstateRan;
this.onupdateRanBeforeOncreate = this.onupdateRan;
}
};
</script>