Merge pull request #1816 from sveltejs/errrrrr

reinstate tests
pull/1818/head
Rich Harris 6 years ago committed by GitHub
commit cd0a0a554f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,7 +94,6 @@ export default class ElementWrapper extends Wrapper {
var: string; var: string;
constructor( constructor(
renderer: Renderer, renderer: Renderer,
block: Block, block: Block,

@ -17,6 +17,8 @@ export default class HeadWrapper extends Wrapper {
) { ) {
super(renderer, block, parent, node); super(renderer, block, parent, node);
this.canUseInnerHTML = false;
this.fragment = new FragmentWrapper( this.fragment = new FragmentWrapper(
renderer, renderer,
block, block,

@ -1,7 +1,6 @@
import assert from "assert"; import assert from "assert";
import * as fs from "fs"; import * as fs from "fs";
import * as path from "path"; import * as path from "path";
import { rollup } from "rollup";
import { loadConfig, svelte } from "../helpers.js"; import { loadConfig, svelte } from "../helpers.js";
describe("js", () => { describe("js", () => {
@ -35,8 +34,14 @@ describe("js", () => {
} }
const output = `${dir}/_actual.js`; const output = `${dir}/_actual.js`;
fs.writeFileSync(output, actual); fs.writeFileSync(output, actual);
const expected = fs.readFileSync(`${dir}/expected.js`, "utf-8");
assert.equal(
actual.trim().replace(/^[ \t]+$/gm, ""),
expected.trim().replace(/^[ \t]+$/gm, "")
);
}); });
}); });
}); });

@ -39,7 +39,7 @@ function create_main_fragment(component, ctx) {
detachNode(a); detachNode(a);
} }
if (typeof link_action.destroy === 'function') link_action.destroy.call(component); if (link_action && typeof link_action.destroy === 'function') link_action.destroy.call(component);
} }
}; };
} }

@ -44,7 +44,10 @@ function create_main_fragment(component, ctx) {
function SvelteComponent(options) { function SvelteComponent(options) {
this._debugName = '<SvelteComponent>'; this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option"); if (!options || (!options.target && !options.root)) {
throw new Error("'target' is a required option");
}
init(this, options); init(this, options);
this._state = assign({}, options.data); this._state = assign({}, options.data);
if (!('name' in this._state)) console.warn("<SvelteComponent> was created without expected data property 'name'"); if (!('name' in this._state)) console.warn("<SvelteComponent> was created without expected data property 'name'");

@ -131,7 +131,10 @@ function create_each_block(component, ctx) {
function SvelteComponent(options) { function SvelteComponent(options) {
this._debugName = '<SvelteComponent>'; this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option"); if (!options || (!options.target && !options.root)) {
throw new Error("'target' is a required option");
}
init(this, options); init(this, options);
this._state = assign({}, options.data); this._state = assign({}, options.data);
if (!('things' in this._state)) console.warn("<SvelteComponent> was created without expected data property 'things'"); if (!('things' in this._state)) console.warn("<SvelteComponent> was created without expected data property 'things'");

@ -131,7 +131,10 @@ function create_each_block(component, ctx) {
function SvelteComponent(options) { function SvelteComponent(options) {
this._debugName = '<SvelteComponent>'; this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option"); if (!options || (!options.target && !options.root)) {
throw new Error("'target' is a required option");
}
init(this, options); init(this, options);
this._state = assign({}, options.data); this._state = assign({}, options.data);
if (!('things' in this._state)) console.warn("<SvelteComponent> was created without expected data property 'things'"); if (!('things' in this._state)) console.warn("<SvelteComponent> was created without expected data property 'things'");

@ -46,7 +46,10 @@ function create_main_fragment(component, ctx) {
function SvelteComponent(options) { function SvelteComponent(options) {
this._debugName = '<SvelteComponent>'; this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option"); if (!options || (!options.target && !options.root)) {
throw new Error("'target' is a required option");
}
init(this, options); init(this, options);
this._state = assign({ Math : Math }, options.data); this._state = assign({ Math : Math }, options.data);
this._recompute({ foo: 1 }, this._state); this._recompute({ foo: 1 }, this._state);

@ -58,7 +58,7 @@ function create_main_fragment(component, ctx) {
if (!if_block0) { if (!if_block0) {
if_block0 = create_if_block_4(component, ctx); if_block0 = create_if_block_4(component, ctx);
if_block0.c(); if_block0.c();
if_block0.m(div, null); if_block0.m(div, text0);
} }
} else if (if_block0) { } else if (if_block0) {
if_block0.d(1); if_block0.d(1);

@ -16,7 +16,7 @@ function create_main_fragment(component, ctx) {
window.addEventListener("scroll", onwindowscroll); window.addEventListener("scroll", onwindowscroll);
component.on("state", ({ changed, current }) => { component.on("state", ({ changed, current }) => {
if (changed["y"]) { if (changed["y"] && !window_updating) {
window_updating = true; window_updating = true;
clearTimeout(window_updating_timeout); clearTimeout(window_updating_timeout);
window.scrollTo(window.pageXOffset, current["y"]); window.scrollTo(window.pageXOffset, current["y"]);

Loading…
Cancel
Save