diff --git a/src/compile/render-dom/wrappers/Element/index.ts b/src/compile/render-dom/wrappers/Element/index.ts index 47c1bc57f3..290c1b0d6e 100644 --- a/src/compile/render-dom/wrappers/Element/index.ts +++ b/src/compile/render-dom/wrappers/Element/index.ts @@ -529,7 +529,7 @@ export default class ElementWrapper extends Wrapper { renderer.hasComplexBindings = true; block.builders.hydrate.addLine( - `#component.root._beforecreate.push(${handler});` + `#component.root._aftercreate.push(${handler});` ); } }); diff --git a/test/helpers.js b/test/helpers.js index 7a04ff0262..7b1f08bb45 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -48,6 +48,8 @@ export function tryToReadFile(file) { export const virtualConsole = new jsdom.VirtualConsole(); const { window } = new jsdom.JSDOM('
', {virtualConsole}); global.document = window.document; +global.getComputedStyle = window.getComputedStyle; +global.navigator = {userAgent: 'fake'}; export function env() { window._svelteTransitionManager = null; diff --git a/test/js/samples/bind-width-height/expected.js b/test/js/samples/bind-width-height/expected.js index bb2bf2554a..a401dbce11 100644 --- a/test/js/samples/bind-width-height/expected.js +++ b/test/js/samples/bind-width-height/expected.js @@ -12,7 +12,7 @@ function create_main_fragment(component, ctx) { c() { div = createElement("div"); div.textContent = "some content"; - component.root._beforecreate.push(div_resize_handler); + component.root._aftercreate.push(div_resize_handler); }, m(target, anchor) { diff --git a/test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/_config.js b/test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/_config.js new file mode 100644 index 0000000000..ff2b87b712 --- /dev/null +++ b/test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/_config.js @@ -0,0 +1,8 @@ +export default { + 'skip-ssr': true, + + test(assert, component, target) { + assert.ok(component.onstateRanBeforeOncreate); + assert.ok(!component.onupdateRanBeforeOncreate); + } +}; diff --git a/test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/main.html b/test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/main.html new file mode 100644 index 0000000000..d930bbcbbb --- /dev/null +++ b/test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/main.html @@ -0,0 +1,17 @@ +
+