fix indentation and remove unused variables (#5479)

pull/5484/head
Andreas Ehrencrona 4 years ago committed by GitHub
parent a28d776c06
commit e508fb7b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,8 +12,8 @@ export function compare_node(a: Node | void, b: Node | void) {
compare_node(a.object, (b as MemberExpression).object) && compare_node(a.object, (b as MemberExpression).object) &&
compare_node(a.property, (b as MemberExpression).property) && compare_node(a.property, (b as MemberExpression).property) &&
a.computed === (b as MemberExpression).computed a.computed === (b as MemberExpression).computed
); );
case 'Literal': case 'Literal':
return a.value === (b as Literal).value; return a.value === (b as Literal).value;
} }
} }

@ -12,8 +12,8 @@ export function escape(data: string, { only_escape_at_symbol = false } = {}) {
} }
const escaped = { const escaped = {
'"': '"', '"': '"',
"'": ''', "'": ''',
'&': '&', '&': '&',
'<': '&lt;', '<': '&lt;',
'>': '&gt;' '>': '&gt;'

@ -1,6 +1,6 @@
import * as assert from 'assert'; import * as assert from 'assert';
import * as fs from 'fs'; import * as fs from 'fs';
import { svelte, tryToLoadJson, shouldUpdateExpected } from '../helpers'; import { svelte, tryToLoadJson } from '../helpers';
describe('parse', () => { describe('parse', () => {
fs.readdirSync(`${__dirname}/samples`).forEach(dir => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => {

@ -11,9 +11,8 @@ export default {
</div> </div>
`, `,
test({ assert, component, target, window, raf }) { test({ component, target }) {
const div = target.querySelector('div'); const div = target.querySelector('div');
const { appendChild, insertBefore } = div;
div.appendChild = div.insertBefore = () => { div.appendChild = div.insertBefore = () => {
throw new Error('DOM was mutated'); throw new Error('DOM was mutated');

@ -4,7 +4,6 @@ export default {
test({ assert, component, target }) { test({ assert, component, target }) {
container.div = null; container.div = null;
const top = component.top;
const div = target.querySelector('div'); const div = target.querySelector('div');
component.visible = false; component.visible = false;

@ -1,11 +1,11 @@
let subscribeCalled = false; let unsubscribeCalled = false;
const fakeStore = val => ({ const fakeStore = val => ({
subscribe: cb => { subscribe: cb => {
cb(val); cb(val);
return { return {
unsubscribe: () => { unsubscribe: () => {
subscribeCalled = true; unsubscribeCalled = true;
} }
}; };
} }
@ -22,6 +22,8 @@ export default {
async test({ assert, component, target }) { async test({ assert, component, target }) {
component.foo = fakeStore(5); component.foo = fakeStore(5);
return assert.htmlEqual(target.innerHTML, '<h1>5</h1>'); assert.htmlEqual(target.innerHTML, '<h1>5</h1>');
assert.ok(unsubscribeCalled);
} }
}; };

@ -1,5 +1,5 @@
export default { export default {
async test({ assert, component, target, window, raf }) { async test({ assert, target, window }) {
const [_, btn] = target.querySelectorAll('button'); const [_, btn] = target.querySelectorAll('button');
const clickEvent = new window.MouseEvent('click'); const clickEvent = new window.MouseEvent('click');

@ -1,9 +1,7 @@
let fulfil; let fulfil;
let reject;
const promise = new Promise((f, r) => { const promise = new Promise((f) => {
fulfil = f; fulfil = f;
reject = r;
}); });
export default { export default {

Loading…
Cancel
Save