update tests

pull/709/head
Rich Harris 8 years ago
parent 0a806585b3
commit 3f73f252ac

@ -115,9 +115,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {

@ -91,9 +91,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {

@ -124,9 +124,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {

@ -109,9 +109,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {

@ -115,9 +115,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {

@ -115,9 +115,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {

@ -103,9 +103,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {
@ -194,9 +197,13 @@ function SvelteComponent ( options ) {
this._fragment.mount( options.target, null ); this._fragment.mount( options.target, null );
} }
callAll(this._beforecreate); if ( !options._root ) {
callAll(this._oncreate); this._block = true;
callAll(this._aftercreate); callAll(this._beforecreate);
callAll(this._oncreate);
callAll(this._aftercreate);
this._block = false;
}
} }
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );

@ -76,9 +76,13 @@ function SvelteComponent ( options ) {
this._fragment.mount( options.target, null ); this._fragment.mount( options.target, null );
} }
callAll(this._beforecreate); if ( !options._root ) {
callAll(this._oncreate); this._block = true;
callAll(this._aftercreate); callAll(this._beforecreate);
callAll(this._oncreate);
callAll(this._aftercreate);
this._block = false;
}
} }
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );

@ -91,9 +91,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {
@ -159,7 +162,10 @@ function SvelteComponent ( options ) {
this._fragment.create(); this._fragment.create();
this._fragment.mount( options.target, null ); this._fragment.mount( options.target, null );
} }
callAll(this._oncreate);
if ( !options._root ) {
callAll(this._oncreate);
}
} }
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );

@ -51,7 +51,10 @@ function SvelteComponent ( options ) {
this._fragment.create(); this._fragment.create();
this._fragment.mount( options.target, null ); this._fragment.mount( options.target, null );
} }
callAll(this._oncreate);
if ( !options._root ) {
callAll(this._oncreate);
}
} }
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );

@ -115,9 +115,12 @@ function on(eventName, handler) {
function set(newState) { function set(newState) {
this._set(assign({}, newState)); this._set(assign({}, newState));
if (this._root._block) return;
this._root._block = true;
callAll(this._root._beforecreate); callAll(this._root._beforecreate);
callAll(this._root._oncreate); callAll(this._root._oncreate);
callAll(this._root._aftercreate); callAll(this._root._aftercreate);
this._root._block = false;
} }
function callAll(fns) { function callAll(fns) {

@ -137,10 +137,9 @@ describe("runtime", () => {
throw err; throw err;
} }
let usedObjectAssign = false;
Object.assign = () => { Object.assign = () => {
throw new Error( usedObjectAssign = true;
"cannot use Object.assign in generated code, as it is not supported everywhere"
);
}; };
global.window = window; global.window = window;
@ -182,14 +181,18 @@ describe("runtime", () => {
assert.htmlEqual(target.innerHTML, config.html); assert.htmlEqual(target.innerHTML, config.html);
} }
Object.assign = Object_assign;
if (config.test) { if (config.test) {
config.test(assert, component, target, window, raf); config.test(assert, component, target, window, raf);
} else { } else {
component.destroy(); component.destroy();
assert.equal(target.innerHTML, ""); assert.equal(target.innerHTML, "");
} }
if (usedObjectAssign) {
throw new Error(
"cannot use Object.assign in generated code, as it is not supported everywhere"
);
}
}) })
.catch(err => { .catch(err => {
Object.assign = Object_assign; Object.assign = Object_assign;

Loading…
Cancel
Save