reinstate tests

pull/1816/head
Rich Harris 6 years ago
parent 3cf60cb4b8
commit 4afa133214

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

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

@ -1,7 +1,6 @@
import assert from "assert";
import * as fs from "fs";
import * as path from "path";
import { rollup } from "rollup";
import { loadConfig, svelte } from "../helpers.js";
describe("js", () => {
@ -35,8 +34,14 @@ describe("js", () => {
}
const output = `${dir}/_actual.js`;
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, "")
);
});
});
});

@ -2,7 +2,7 @@
import { assign, createElement, detachNode, init, insert, noop, proto } from "svelte/shared.js";
function link(node) {
function onClick(event) {
event.preventDefault();
history.pushState(null, null, event.target.href);
@ -39,7 +39,7 @@ function create_main_fragment(component, ctx) {
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) {
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);
this._state = assign({}, options.data);
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) {
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);
this._state = assign({}, options.data);
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) {
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);
this._state = assign({}, options.data);
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) {
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);
this._state = assign({ Math : Math }, options.data);
this._recompute({ foo: 1 }, this._state);

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

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

Loading…
Cancel
Save