lint for the lint gods

* fix trailing comma and indentation warnings
* turn off typescript-eslint indent rule (to workaround myriad issues)
* add manual single line ignore (i _think_ that is the right move 🤷🏼‍♂️ anyway)
pull/5031/head
john gravois 5 years ago
parent 1644f207b1
commit 354ab15945
No known key found for this signature in database
GPG Key ID: C062A77053A255FC

@ -10,5 +10,9 @@ module.exports = {
'estree' 'estree'
], ],
'svelte3/compiler': require('./compiler') 'svelte3/compiler': require('./compiler')
},
// workaround for https://github.com/typescript-eslint/typescript-eslint/issues/1824 and rely solely on 'indent' rule
rules: {
"@typescript-eslint/indent": "off"
} }
}; };

@ -8,7 +8,7 @@ import {
create_scopes, create_scopes,
extract_names, extract_names,
Scope, Scope,
extract_identifiers, extract_identifiers
} from './utils/scope'; } from './utils/scope';
import Stylesheet from './css/Stylesheet'; import Stylesheet from './css/Stylesheet';
import { test } from '../config'; import { test } from '../config';
@ -155,7 +155,7 @@ export default class Component {
) || { start: 0, end: 0 }; ) || { start: 0, end: 0 };
this.warn(svelteOptions, { this.warn(svelteOptions, {
code: 'custom-element-no-tag', code: 'custom-element-no-tag',
message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag="my-thing"/>. To hide this warning, use <svelte:options tag={null}/>`, message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag="my-thing"/>. To hide this warning, use <svelte:options tag={null}/>`
}); });
} }
this.tag = this.component_options.tag || compile_options.tag; this.tag = this.component_options.tag || compile_options.tag;
@ -190,7 +190,7 @@ export default class Component {
this.add_var({ this.add_var({
name, name,
injected: true, injected: true,
referenced: true, referenced: true
}); });
} else if (name[0] === '$') { } else if (name[0] === '$') {
this.add_var({ this.add_var({
@ -198,7 +198,7 @@ export default class Component {
injected: true, injected: true,
referenced: true, referenced: true,
mutated: true, mutated: true,
writable: true, writable: true
}); });
const subscribable_name = name.slice(1); const subscribable_name = name.slice(1);
@ -289,7 +289,7 @@ export default class Component {
} }
const imported_helpers = Array.from(this.helpers, ([name, alias]) => ({ const imported_helpers = Array.from(this.helpers, ([name, alias]) => ({
name, name,
alias, alias
})); }));
create_module( create_module(
@ -305,7 +305,7 @@ export default class Component {
.filter(variable => variable.module && variable.export_name) .filter(variable => variable.module && variable.export_name)
.map(variable => ({ .map(variable => ({
name: variable.name, name: variable.name,
as: variable.export_name, as: variable.export_name
})) }))
); );
@ -342,9 +342,9 @@ export default class Component {
reassigned: v.reassigned || false, reassigned: v.reassigned || false,
referenced: v.referenced || false, referenced: v.referenced || false,
writable: v.writable || false, writable: v.writable || false,
referenced_from_script: v.referenced_from_script || false, referenced_from_script: v.referenced_from_script || false
})), })),
stats: this.stats.render(), stats: this.stats.render()
}; };
} }
@ -409,7 +409,7 @@ export default class Component {
source: this.source, source: this.source,
start: pos.start, start: pos.start,
end: pos.end, end: pos.end,
filename: this.compile_options.filename, filename: this.compile_options.filename
}); });
} }
@ -441,7 +441,7 @@ export default class Component {
pos: pos.start, pos: pos.start,
filename: this.compile_options.filename, filename: this.compile_options.filename,
toString: () => toString: () =>
`${warning.message} (${start.line}:${start.column})\n${frame}`, `${warning.message} (${start.line}:${start.column})\n${frame}`
}); });
} }
@ -453,7 +453,7 @@ export default class Component {
if (node.type === 'ExportDefaultDeclaration') { if (node.type === 'ExportDefaultDeclaration') {
this.error(node, { this.error(node, {
code: `default-export`, code: `default-export`,
message: `A component cannot have a default export`, message: `A component cannot have a default export`
}); });
} }
@ -461,7 +461,7 @@ export default class Component {
if (node.source) { if (node.source) {
this.error(node, { this.error(node, {
code: `not-implemented`, code: `not-implemented`,
message: `A component currently cannot have an export ... from`, message: `A component currently cannot have an export ... from`
}); });
} }
if (node.declaration) { if (node.declaration) {
@ -531,10 +531,10 @@ export default class Component {
if (node.type === 'LabeledStatement' && node.label.name === '$') { if (node.type === 'LabeledStatement' && node.label.name === '$') {
component.warn(node as any, { component.warn(node as any, {
code: 'module-script-reactive-declaration', code: 'module-script-reactive-declaration',
message: '$: has no effect in a module script', message: '$: has no effect in a module script'
}); });
} }
}, }
}); });
const { scope, globals } = create_scopes(script.content); const { scope, globals } = create_scopes(script.content);
@ -544,7 +544,7 @@ export default class Component {
if (name[0] === '$') { if (name[0] === '$') {
this.error(node as any, { this.error(node as any, {
code: 'illegal-declaration', code: 'illegal-declaration',
message: `The $ prefix is reserved, and cannot be used for variable and import names`, message: `The $ prefix is reserved, and cannot be used for variable and import names`
}); });
} }
@ -562,7 +562,7 @@ export default class Component {
if (name[0] === '$') { if (name[0] === '$') {
this.error(node as any, { this.error(node as any, {
code: 'illegal-subscription', code: 'illegal-subscription',
message: `Cannot reference store value inside <script context="module">`, message: `Cannot reference store value inside <script context="module">`
}); });
} else { } else {
this.add_var({ this.add_var({
@ -623,7 +623,7 @@ export default class Component {
if (name[0] === '$') { if (name[0] === '$') {
this.error(node as any, { this.error(node as any, {
code: 'illegal-declaration', code: 'illegal-declaration',
message: `The $ prefix is reserved, and cannot be used for variable and import names`, message: `The $ prefix is reserved, and cannot be used for variable and import names`
}); });
} }
@ -647,12 +647,12 @@ export default class Component {
injected: true, injected: true,
writable: true, writable: true,
reassigned: true, reassigned: true,
initialised: true, initialised: true
}); });
} else if (is_reserved_keyword(name)) { } else if (is_reserved_keyword(name)) {
this.add_var({ this.add_var({
name, name,
injected: true, injected: true
}); });
} else if (name[0] === '$') { } else if (name[0] === '$') {
if (name === '$' || name[1] === '$') { if (name === '$' || name[1] === '$') {
@ -666,7 +666,7 @@ export default class Component {
name, name,
injected: true, injected: true,
mutated: true, mutated: true,
writable: true, writable: true
}); });
this.add_reference(name.slice(1)); this.add_reference(name.slice(1));
@ -764,7 +764,7 @@ export default class Component {
if (map.has(node)) { if (map.has(node)) {
scope = scope.parent; scope = scope.parent;
} }
}, }
}); });
for (const [parent, prop, index] of to_remove) { for (const [parent, prop, index] of to_remove) {
@ -832,7 +832,7 @@ export default class Component {
if (map.has(node)) { if (map.has(node)) {
scope = scope.parent; scope = scope.parent;
} }
}, }
}); });
} }
@ -844,7 +844,7 @@ export default class Component {
) { ) {
this.warn(node as any, { this.warn(node as any, {
code: 'non-top-level-reactive-declaration', code: 'non-top-level-reactive-declaration',
message: '$: has no effect outside of the top-level', message: '$: has no effect outside of the top-level'
}); });
} }
@ -872,7 +872,7 @@ export default class Component {
if (node.body.type !== 'BlockStatement') { if (node.body.type !== 'BlockStatement') {
node.body = { node.body = {
type: 'BlockStatement', type: 'BlockStatement',
body: [node.body], body: [node.body]
}; };
} }
node.body.body.push(inside[0]); node.body.body.push(inside[0]);
@ -881,8 +881,8 @@ export default class Component {
type: 'BlockStatement', type: 'BlockStatement',
body: [ body: [
before[0], before[0],
node, node
], ]
}; };
} }
return null; return null;
@ -918,7 +918,7 @@ export default class Component {
// TODO is this still true post-#3539? // TODO is this still true post-#3539?
component.error(declarator as any, { component.error(declarator as any, {
code: 'destructured-prop', code: 'destructured-prop',
message: `Cannot declare props in destructured declaration`, message: `Cannot declare props in destructured declaration`
}); });
} }
@ -981,7 +981,7 @@ export default class Component {
if (node.type === 'ExportNamedDeclaration' && node.declaration) { if (node.type === 'ExportNamedDeclaration' && node.declaration) {
(parent as Program).body[index] = node.declaration; (parent as Program).body[index] = node.declaration;
} }
}, }
}); });
} }
@ -995,7 +995,7 @@ export default class Component {
hoistable_nodes, hoistable_nodes,
var_lookup, var_lookup,
injected_reactive_declaration_vars, injected_reactive_declaration_vars,
imports, imports
} = this; } = this;
const top_level_function_declarations = new Map(); const top_level_function_declarations = new Map();
@ -1127,7 +1127,7 @@ export default class Component {
if (map.has(node)) { if (map.has(node)) {
scope = scope.parent; scope = scope.parent;
} }
}, }
}); });
checked.add(fn_declaration); checked.add(fn_declaration);
@ -1218,7 +1218,7 @@ export default class Component {
if (map.has(node)) { if (map.has(node)) {
scope = scope.parent; scope = scope.parent;
} }
}, }
}); });
const { expression } = node.body as ExpressionStatement; const { expression } = node.body as ExpressionStatement;
@ -1228,7 +1228,7 @@ export default class Component {
assignees, assignees,
dependencies, dependencies,
node, node,
declaration, declaration
}); });
} }
}); });
@ -1309,7 +1309,7 @@ export default class Component {
this.warn(node, { this.warn(node, {
code: 'missing-declaration', code: 'missing-declaration',
message, message
}); });
} }
@ -1332,7 +1332,7 @@ function process_component_options(component: Component, nodes) {
'accessors' in component.compile_options 'accessors' in component.compile_options
? component.compile_options.accessors ? component.compile_options.accessors
: !!component.compile_options.customElement, : !!component.compile_options.customElement,
preserveWhitespace: !!component.compile_options.preserveWhitespace, preserveWhitespace: !!component.compile_options.preserveWhitespace
}; };
const node = nodes.find(node => node.name === 'svelte:options'); const node = nodes.find(node => node.name === 'svelte:options');
@ -1362,83 +1362,83 @@ function process_component_options(component: Component, nodes) {
const { name } = attribute; const { name } = attribute;
switch (name) { switch (name) {
case 'tag': { case 'tag': {
const code = 'invalid-tag-attribute'; const code = 'invalid-tag-attribute';
const message = `'tag' must be a string literal`; const message = `'tag' must be a string literal`;
const tag = get_value(attribute, code, message); const tag = get_value(attribute, code, message);
if (typeof tag !== 'string' && tag !== null) if (typeof tag !== 'string' && tag !== null)
component.error(attribute, { code, message }); component.error(attribute, { code, message });
if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) { if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) {
component.error(attribute, { component.error(attribute, {
code: `invalid-tag-property`, code: `invalid-tag-property`,
message: `tag name must be two or more words joined by the '-' character`, message: `tag name must be two or more words joined by the '-' character`
}); });
} }
if (tag && !component.compile_options.customElement) {
component.warn(attribute, {
code: 'missing-custom-element-compile-options',
message: `The 'tag' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?`
});
}
component_options.tag = tag; if (tag && !component.compile_options.customElement) {
break; component.warn(attribute, {
code: 'missing-custom-element-compile-options',
message: `The 'tag' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?`
});
} }
case 'namespace': { component_options.tag = tag;
const code = 'invalid-namespace-attribute'; break;
const message = `The 'namespace' attribute must be a string literal representing a valid namespace`; }
const ns = get_value(attribute, code, message);
if (typeof ns !== 'string') case 'namespace': {
component.error(attribute, { code, message }); const code = 'invalid-namespace-attribute';
const message = `The 'namespace' attribute must be a string literal representing a valid namespace`;
const ns = get_value(attribute, code, message);
if (valid_namespaces.indexOf(ns) === -1) { if (typeof ns !== 'string')
const match = fuzzymatch(ns, valid_namespaces); component.error(attribute, { code, message });
if (match) {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}' (did you mean '${match}'?)`,
});
} else {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}'`,
});
}
}
component_options.namespace = ns; if (valid_namespaces.indexOf(ns) === -1) {
break; const match = fuzzymatch(ns, valid_namespaces);
if (match) {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}' (did you mean '${match}'?)`
});
} else {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}'`
});
}
} }
case 'accessors': component_options.namespace = ns;
case 'immutable': break;
case 'preserveWhitespace': { }
const code = `invalid-${name}-value`;
const message = `${name} attribute must be true or false`;
const value = get_value(attribute, code, message);
if (typeof value !== 'boolean') case 'accessors':
component.error(attribute, { code, message }); case 'immutable':
case 'preserveWhitespace': {
const code = `invalid-${name}-value`;
const message = `${name} attribute must be true or false`;
const value = get_value(attribute, code, message);
component_options[name] = value; if (typeof value !== 'boolean')
break; component.error(attribute, { code, message });
}
default: component_options[name] = value;
component.error(attribute, { break;
code: `invalid-options-attribute`, }
message: `<svelte:options> unknown attribute`,
}); default:
component.error(attribute, {
code: `invalid-options-attribute`,
message: `<svelte:options> unknown attribute`
});
} }
} else { } else {
component.error(attribute, { component.error(attribute, {
code: `invalid-options-attribute`, code: `invalid-options-attribute`,
message: `<svelte:options> can only have static 'tag', 'namespace', 'accessors', 'immutable' and 'preserveWhitespace' attributes`, message: `<svelte:options> can only have static 'tag', 'namespace', 'accessors', 'immutable' and 'preserveWhitespace' attributes`
}); });
} }
}); });

@ -156,13 +156,13 @@ function apply_selector(blocks: Block[], node: Element, stack: Element[], to_enc
} }
switch (block_might_apply_to_node(block, node)) { switch (block_might_apply_to_node(block, node)) {
case BlockAppliesToNode.NotPossible: case BlockAppliesToNode.NotPossible:
return false; return false;
case BlockAppliesToNode.UnknownSelectorType: case BlockAppliesToNode.UnknownSelectorType:
// bail. TODO figure out what these could be // bail. TODO figure out what these could be
to_encapsulate.push({ node, block }); to_encapsulate.push({ node, block });
return true; return true;
} }
if (block.combinator) { if (block.combinator) {
@ -255,13 +255,13 @@ function test_attribute(operator, expected_value, case_insensitive, value) {
value = value.toLowerCase(); value = value.toLowerCase();
} }
switch (operator) { switch (operator) {
case '=': return value === expected_value; case '=': return value === expected_value;
case '~=': return value.split(/\s/).includes(expected_value); case '~=': return value.split(/\s/).includes(expected_value);
case '|=': return `${value}-`.startsWith(`${expected_value}-`); case '|=': return `${value}-`.startsWith(`${expected_value}-`);
case '^=': return value.startsWith(expected_value); case '^=': return value.startsWith(expected_value);
case '$=': return value.endsWith(expected_value); case '$=': return value.endsWith(expected_value);
case '*=': return value.includes(expected_value); case '*=': return value.includes(expected_value);
default: throw new Error(`this shouldn't happen`); default: throw new Error(`this shouldn't happen`);
} }
} }

@ -52,7 +52,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
code: `options-lowercase-name`, code: `options-lowercase-name`,
message, message,
filename, filename,
toString: () => message, toString: () => message
}); });
} }
@ -62,7 +62,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
code: `options-loop-guard-timeout`, code: `options-loop-guard-timeout`,
message, message,
filename, filename,
toString: () => message, toString: () => message
}); });
} }
} }

@ -75,7 +75,7 @@ export default class Binding extends Node {
if (info.expression.type === 'Identifier' && !variable.writable) component.error(this.expression.node, { if (info.expression.type === 'Identifier' && !variable.writable) component.error(this.expression.node, {
code: 'invalid-binding', code: 'invalid-binding',
message: 'Cannot bind to a variable which is not writable', message: 'Cannot bind to a variable which is not writable'
}); });
} }

@ -167,55 +167,55 @@ export default class Element extends Node {
info.attributes.forEach(node => { info.attributes.forEach(node => {
switch (node.type) { switch (node.type) {
case 'Action': case 'Action':
this.actions.push(new Action(component, this, scope, node)); this.actions.push(new Action(component, this, scope, node));
break; break;
case 'Attribute': case 'Attribute':
case 'Spread': case 'Spread':
// special case // special case
if (node.name === 'xmlns') this.namespace = node.value[0].data; if (node.name === 'xmlns') this.namespace = node.value[0].data;
this.attributes.push(new Attribute(component, this, scope, node)); this.attributes.push(new Attribute(component, this, scope, node));
break; break;
case 'Binding': case 'Binding':
this.bindings.push(new Binding(component, this, scope, node)); this.bindings.push(new Binding(component, this, scope, node));
break; break;
case 'Class': case 'Class':
this.classes.push(new Class(component, this, scope, node)); this.classes.push(new Class(component, this, scope, node));
break; break;
case 'EventHandler': case 'EventHandler':
this.handlers.push(new EventHandler(component, this, scope, node)); this.handlers.push(new EventHandler(component, this, scope, node));
break; break;
case 'Let': { case 'Let': {
const l = new Let(component, this, scope, node); const l = new Let(component, this, scope, node);
this.lets.push(l); this.lets.push(l);
const dependencies = new Set([l.name.name]); const dependencies = new Set([l.name.name]);
l.names.forEach(name => { l.names.forEach(name => {
scope.add(name, dependencies, this); scope.add(name, dependencies, this);
}); });
break; break;
} }
case 'Transition': case 'Transition':
{ {
const transition = new Transition(component, this, scope, node); const transition = new Transition(component, this, scope, node);
if (node.intro) this.intro = transition; if (node.intro) this.intro = transition;
if (node.outro) this.outro = transition; if (node.outro) this.outro = transition;
break; break;
} }
case 'Animation': case 'Animation':
this.animation = new Animation(component, this, scope, node); this.animation = new Animation(component, this, scope, node);
break; break;
default: default:
throw new Error(`Not implemented: ${node.type}`); throw new Error(`Not implemented: ${node.type}`);
} }
}); });
@ -388,7 +388,7 @@ export default class Element extends Node {
if (/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/.test(name)) { if (/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/.test(name)) {
component.error(attribute, { component.error(attribute, {
code: `illegal-attribute`, code: `illegal-attribute`,
message: `'${name}' is not a valid attribute name`, message: `'${name}' is not a valid attribute name`
}); });
} }
@ -412,7 +412,7 @@ export default class Element extends Node {
if (!(parent.type === 'InlineComponent' || within_custom_element(parent))) { if (!(parent.type === 'InlineComponent' || within_custom_element(parent))) {
component.error(attribute, { component.error(attribute, {
code: `invalid-slotted-content`, code: `invalid-slotted-content`,
message: `Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`, message: `Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`
}); });
} }
} }

@ -38,50 +38,50 @@ export default class InlineComponent extends Node {
info.attributes.forEach(node => { info.attributes.forEach(node => {
/* eslint-disable no-fallthrough */ /* eslint-disable no-fallthrough */
switch (node.type) { switch (node.type) {
case 'Action': case 'Action':
component.error(node, { component.error(node, {
code: `invalid-action`, code: `invalid-action`,
message: `Actions can only be applied to DOM elements, not components` message: `Actions can only be applied to DOM elements, not components`
}); });
case 'Attribute': case 'Attribute':
if (node.name === 'slot') { if (node.name === 'slot') {
component.error(node, {
code: `invalid-prop`,
message: `'slot' is reserved for future use in named slots`
});
}
// fallthrough
case 'Spread':
this.attributes.push(new Attribute(component, this, scope, node));
break;
case 'Binding':
this.bindings.push(new Binding(component, this, scope, node));
break;
case 'Class':
component.error(node, { component.error(node, {
code: `invalid-class`, code: `invalid-prop`,
message: `Classes can only be applied to DOM elements, not components` message: `'slot' is reserved for future use in named slots`
}); });
}
// fallthrough
case 'Spread':
this.attributes.push(new Attribute(component, this, scope, node));
break;
case 'Binding':
this.bindings.push(new Binding(component, this, scope, node));
break;
case 'Class':
component.error(node, {
code: `invalid-class`,
message: `Classes can only be applied to DOM elements, not components`
});
case 'EventHandler': case 'EventHandler':
this.handlers.push(new EventHandler(component, this, scope, node)); this.handlers.push(new EventHandler(component, this, scope, node));
break; break;
case 'Let': case 'Let':
this.lets.push(new Let(component, this, scope, node)); this.lets.push(new Let(component, this, scope, node));
break; break;
case 'Transition': case 'Transition':
component.error(node, { component.error(node, {
code: `invalid-transition`, code: `invalid-transition`,
message: `Transitions can only be applied to DOM elements, not components` message: `Transitions can only be applied to DOM elements, not components`
}); });
default: default:
throw new Error(`Not implemented: ${node.type}`); throw new Error(`Not implemented: ${node.type}`);
} }
/* eslint-enable no-fallthrough */ /* eslint-enable no-fallthrough */
}); });

@ -12,7 +12,7 @@ const elements_without_text = new Set([
'dl', 'dl',
'optgroup', 'optgroup',
'select', 'select',
'video', 'video'
]); ]);
export default class Text extends Node { export default class Text extends Node {

@ -20,23 +20,23 @@ export type Children = ReturnType<typeof map_children>;
function get_constructor(type) { function get_constructor(type) {
switch (type) { switch (type) {
case 'AwaitBlock': return AwaitBlock; case 'AwaitBlock': return AwaitBlock;
case 'Body': return Body; case 'Body': return Body;
case 'Comment': return Comment; case 'Comment': return Comment;
case 'EachBlock': return EachBlock; case 'EachBlock': return EachBlock;
case 'Element': return Element; case 'Element': return Element;
case 'Head': return Head; case 'Head': return Head;
case 'IfBlock': return IfBlock; case 'IfBlock': return IfBlock;
case 'InlineComponent': return InlineComponent; case 'InlineComponent': return InlineComponent;
case 'MustacheTag': return MustacheTag; case 'MustacheTag': return MustacheTag;
case 'Options': return Options; case 'Options': return Options;
case 'RawMustacheTag': return RawMustacheTag; case 'RawMustacheTag': return RawMustacheTag;
case 'DebugTag': return DebugTag; case 'DebugTag': return DebugTag;
case 'Slot': return Slot; case 'Slot': return Slot;
case 'Text': return Text; case 'Text': return Text;
case 'Title': return Title; case 'Title': return Title;
case 'Window': return Window; case 'Window': return Window;
default: throw new Error(`Not implemented: ${type}`); default: throw new Error(`Not implemented: ${type}`);
} }
} }

@ -106,7 +106,7 @@ export default class Block {
intro: [], intro: [],
update: [], update: [],
outro: [], outro: [],
destroy: [], destroy: []
}; };
this.has_animation = false; this.has_animation = false;
@ -393,15 +393,15 @@ export default class Block {
${this.chunks.declarations} ${this.chunks.declarations}
${Array.from(this.variables.values()).map(({ id, init }) => { ${Array.from(this.variables.values()).map(({ id, init }) => {
return init return init
? b`let ${id} = ${init}` ? b`let ${id} = ${init}`
: b`let ${id}`; : b`let ${id}`;
})} })}
${this.chunks.init} ${this.chunks.init}
${dev ${dev
? b` ? b`
const ${block} = ${return_value}; const ${block} = ${return_value};
@dispatch_dev("SvelteRegisterBlock", { @dispatch_dev("SvelteRegisterBlock", {
block: ${block}, block: ${block},
@ -411,9 +411,9 @@ export default class Block {
ctx: #ctx ctx: #ctx
}); });
return ${block};` return ${block};`
: b` : b`
return ${return_value};` return ${return_value};`
} }
`; `;
return body; return body;

@ -76,7 +76,7 @@ export default class Renderer {
bindings: new Map(), bindings: new Map(),
dependencies: new Set(), dependencies: new Set()
}); });
this.block.has_update_method = true; this.block.has_update_method = true;

@ -90,8 +90,8 @@ export default function dom(
${uses_rest && !uses_props && x`$$props = @assign(@assign({}, $$props), @exclude_internal_props($$new_props))`} ${uses_rest && !uses_props && x`$$props = @assign(@assign({}, $$props), @exclude_internal_props($$new_props))`}
${uses_rest && renderer.invalidate('$$restProps', x`$$restProps = ${compute_rest}`)} ${uses_rest && renderer.invalidate('$$restProps', x`$$restProps = ${compute_rest}`)}
${writable_props.map(prop => ${writable_props.map(prop =>
b`if ('${prop.export_name}' in ${$$props}) ${renderer.invalidate(prop.name, x`${prop.name} = ${$$props}.${prop.export_name}`)};` b`if ('${prop.export_name}' in ${$$props}) ${renderer.invalidate(prop.name, x`${prop.name} = ${$$props}.${prop.export_name}`)};`
)} )}
${component.slots.size > 0 && ${component.slots.size > 0 &&
b`if ('$$scope' in ${$$props}) ${renderer.invalidate('$$scope', x`$$scope = ${$$props}.$$scope`)};`} b`if ('$$scope' in ${$$props}) ${renderer.invalidate('$$scope', x`$$scope = ${$$props}.$$scope`)};`}
} }
@ -190,8 +190,8 @@ export default function dom(
${$$props} => { ${$$props} => {
${uses_props && renderer.invalidate('$$props', x`$$props = @assign(@assign({}, $$props), $$new_props)`)} ${uses_props && renderer.invalidate('$$props', x`$$props = @assign(@assign({}, $$props), $$new_props)`)}
${injectable_vars.map( ${injectable_vars.map(
v => b`if ('${v.name}' in $$props) ${renderer.invalidate(v.name, x`${v.name} = ${$$props}.${v.name}`)};` v => b`if ('${v.name}' in $$props) ${renderer.invalidate(v.name, x`${v.name} = ${$$props}.${v.name}`)};`
)} )}
} }
`; `;

@ -265,8 +265,8 @@ const attribute_lookup = {
'optgroup', 'optgroup',
'option', 'option',
'select', 'select',
'textarea', 'textarea'
], ]
}, },
formnovalidate: { property_name: 'formNoValidate', applies_to: ['button', 'input'] }, formnovalidate: { property_name: 'formNoValidate', applies_to: ['button', 'input'] },
hidden: {}, hidden: {},
@ -293,9 +293,9 @@ const attribute_lookup = {
'progress', 'progress',
'param', 'param',
'select', 'select',
'textarea', 'textarea'
], ]
}, }
}; };
Object.keys(attribute_lookup).forEach(name => { Object.keys(attribute_lookup).forEach(name => {

@ -117,75 +117,75 @@ export default class BindingWrapper {
// special cases // special cases
switch (this.node.name) { switch (this.node.name) {
case 'group': case 'group':
{ {
const { binding_group, is_context, contexts, index } = get_binding_group(parent.renderer, this.node, block); const { binding_group, is_context, contexts, index } = get_binding_group(parent.renderer, this.node, block);
block.renderer.add_to_context(`$$binding_groups`); block.renderer.add_to_context(`$$binding_groups`);
if (is_context) { if (is_context) {
if (contexts.length > 1) { if (contexts.length > 1) {
let binding_group = x`${block.renderer.reference('$$binding_groups')}[${index}]`; let binding_group = x`${block.renderer.reference('$$binding_groups')}[${index}]`;
for (const name of contexts.slice(0, -1)) { for (const name of contexts.slice(0, -1)) {
binding_group = x`${binding_group}[${block.renderer.reference(name)}]`; binding_group = x`${binding_group}[${block.renderer.reference(name)}]`;
block.chunks.init.push( block.chunks.init.push(
b`${binding_group} = ${binding_group} || [];` b`${binding_group} = ${binding_group} || [];`
); );
}
} }
block.chunks.init.push(
b`${binding_group(true)} = [];`
);
} }
block.chunks.init.push(
block.chunks.hydrate.push( b`${binding_group(true)} = [];`
b`${binding_group(true)}.push(${parent.var});`
);
block.chunks.destroy.push(
b`${binding_group(true)}.splice(${binding_group(true)}.indexOf(${parent.var}), 1);`
); );
break;
} }
case 'textContent': block.chunks.hydrate.push(
update_conditions.push(x`${this.snippet} !== ${parent.var}.textContent`); b`${binding_group(true)}.push(${parent.var});`
mount_conditions.push(x`${this.snippet} !== void 0`); );
break;
case 'innerHTML': block.chunks.destroy.push(
update_conditions.push(x`${this.snippet} !== ${parent.var}.innerHTML`); b`${binding_group(true)}.splice(${binding_group(true)}.indexOf(${parent.var}), 1);`
mount_conditions.push(x`${this.snippet} !== void 0`); );
break; break;
}
case 'currentTime': case 'textContent':
update_conditions.push(x`!@_isNaN(${this.snippet})`); update_conditions.push(x`${this.snippet} !== ${parent.var}.textContent`);
mount_dom = null; mount_conditions.push(x`${this.snippet} !== void 0`);
break; break;
case 'playbackRate': case 'innerHTML':
case 'volume': update_conditions.push(x`${this.snippet} !== ${parent.var}.innerHTML`);
update_conditions.push(x`!@_isNaN(${this.snippet})`); mount_conditions.push(x`${this.snippet} !== void 0`);
mount_conditions.push(x`!@_isNaN(${this.snippet})`); break;
break;
case 'currentTime':
case 'paused': update_conditions.push(x`!@_isNaN(${this.snippet})`);
{ mount_dom = null;
// this is necessary to prevent audio restarting by itself break;
const last = block.get_unique_name(`${parent.var.name}_is_paused`);
block.add_variable(last, x`true`); case 'playbackRate':
case 'volume':
update_conditions.push(x`${last} !== (${last} = ${this.snippet})`); update_conditions.push(x`!@_isNaN(${this.snippet})`);
update_dom = b`${parent.var}[${last} ? "pause" : "play"]();`; mount_conditions.push(x`!@_isNaN(${this.snippet})`);
break;
case 'paused':
{
// this is necessary to prevent audio restarting by itself
const last = block.get_unique_name(`${parent.var.name}_is_paused`);
block.add_variable(last, x`true`);
update_conditions.push(x`${last} !== (${last} = ${this.snippet})`);
update_dom = b`${parent.var}[${last} ? "pause" : "play"]();`;
mount_dom = null;
break;
}
case 'value':
if (parent.node.get_static_attribute_value('type') === 'file') {
update_dom = null;
mount_dom = null; mount_dom = null;
break;
} }
case 'value':
if (parent.node.get_static_attribute_value('type') === 'file') {
update_dom = null;
mount_dom = null;
}
} }
if (update_dom) { if (update_dom) {
@ -305,7 +305,7 @@ function get_binding_group(renderer: Renderer, value: Binding, block: Block) {
}, },
is_context: contexts.length > 0, is_context: contexts.length > 0,
contexts, contexts,
index, index
}); });
} }
@ -319,11 +319,11 @@ function get_event_handler(
name: string, name: string,
lhs: Node lhs: Node
): { ): {
uses_context: boolean; uses_context: boolean;
mutation: (Node | Node[]); mutation: (Node | Node[]);
contextual_dependencies: Set<string>; contextual_dependencies: Set<string>;
lhs?: Node; lhs?: Node;
} { } {
const contextual_dependencies = new Set<string>(binding.node.expression.contextual_dependencies); const contextual_dependencies = new Set<string>(binding.node.expression.contextual_dependencies);
const context = block.bindings.get(name); const context = block.bindings.get(name);
@ -358,7 +358,7 @@ function get_event_handler(
uses_context: binding.node.is_contextual || binding.node.expression.uses_context, // TODO this is messy uses_context: binding.node.is_contextual || binding.node.expression.uses_context, // TODO this is messy
mutation, mutation,
contextual_dependencies, contextual_dependencies,
lhs, lhs
}; };
} }

@ -130,7 +130,7 @@ const events = [
event_names: ['toggle'], event_names: ['toggle'],
filter: (node: Element, _name: string) => filter: (node: Element, _name: string) =>
node.name === 'details' node.name === 'details'
}, }
]; ];
export default class ElementWrapper extends Wrapper { export default class ElementWrapper extends Wrapper {
@ -567,9 +567,9 @@ export default class ElementWrapper extends Wrapper {
function ${handler}(${params}) { function ${handler}(${params}) {
${binding_group.bindings.map(b => b.handler.mutation)} ${binding_group.bindings.map(b => b.handler.mutation)}
${Array.from(dependencies) ${Array.from(dependencies)
.filter(dep => dep[0] !== '$') .filter(dep => dep[0] !== '$')
.filter(dep => !contextual_dependencies.has(dep)) .filter(dep => !contextual_dependencies.has(dep))
.map(dep => b`${this.renderer.invalidate(dep)};`)} .map(dep => b`${this.renderer.invalidate(dep)};`)}
} }
`); `);

@ -267,22 +267,22 @@ export default class IfBlockWrapper extends Wrapper {
block.chunks.init.push(b` block.chunks.init.push(b`
function ${select_block_type}(#ctx, #dirty) { function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ dependencies, condition, snippet, block }) => condition ${this.branches.map(({ dependencies, condition, snippet, block }) => condition
? b` ? b`
${snippet && ( ${snippet && (
dependencies.length > 0 dependencies.length > 0
? b`if (${condition} == null || ${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}` ? b`if (${condition} == null || ${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
: b`if (${condition} == null) ${condition} = !!${snippet}` : b`if (${condition} == null) ${condition} = !!${snippet}`
)} )}
if (${condition}) return ${block.name};` if (${condition}) return ${block.name};`
: b`return ${block.name};`)} : b`return ${block.name};`)}
} }
`); `);
} else { } else {
block.chunks.init.push(b` block.chunks.init.push(b`
function ${select_block_type}(#ctx, #dirty) { function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ condition, snippet, block }) => condition ${this.branches.map(({ condition, snippet, block }) => condition
? b`if (${snippet || condition}) return ${block.name};` ? b`if (${snippet || condition}) return ${block.name};`
: b`return ${block.name};`)} : b`return ${block.name};`)}
} }
`); `);
} }
@ -385,25 +385,25 @@ export default class IfBlockWrapper extends Wrapper {
const ${if_blocks} = []; const ${if_blocks} = [];
${this.needs_update ${this.needs_update
? b` ? b`
function ${select_block_type}(#ctx, #dirty) { function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ dependencies, condition, snippet }, i) => condition ${this.branches.map(({ dependencies, condition, snippet }, i) => condition
? b` ? b`
${snippet && ( ${snippet && (
dependencies.length > 0 dependencies.length > 0
? b`if (${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}` ? b`if (${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
: b`if (${condition} == null) ${condition} = !!${snippet}` : b`if (${condition} == null) ${condition} = !!${snippet}`
)} )}
if (${condition}) return ${i};` if (${condition}) return ${i};`
: b`return ${i};`)} : b`return ${i};`)}
${!has_else && b`return -1;`} ${!has_else && b`return -1;`}
} }
` `
: b` : b`
function ${select_block_type}(#ctx, #dirty) { function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ condition, snippet }, i) => condition ${this.branches.map(({ condition, snippet }, i) => condition
? b`if (${snippet || condition}) return ${i};` ? b`if (${snippet || condition}) return ${i};`
: b`return ${i};`)} : b`return ${i};`)}
${!has_else && b`return -1;`} ${!has_else && b`return -1;`}
} }
`} `}
@ -532,11 +532,11 @@ export default class IfBlockWrapper extends Wrapper {
if (${name}) { if (${name}) {
${dynamic && b`${name}.p(#ctx, #dirty);`} ${dynamic && b`${name}.p(#ctx, #dirty);`}
${ ${
has_transitions && has_transitions &&
b`if (${block.renderer.dirty(branch.dependencies)}) { b`if (${block.renderer.dirty(branch.dependencies)}) {
@transition_in(${name}, 1); @transition_in(${name}, 1);
}` }`
} }
} else { } else {
${name} = ${branch.block.name}(#ctx); ${name} = ${branch.block.name}(#ctx);
${name}.c(); ${name}.c();
@ -603,7 +603,7 @@ export default class IfBlockWrapper extends Wrapper {
// as -1 // as -1
operator: val.operator, operator: val.operator,
prefix: val.prefix, prefix: val.prefix,
argument: val.argument, argument: val.argument
}; };
} }
} }

@ -111,7 +111,7 @@ export default class InlineComponentWrapper extends Wrapper {
if (variable.reassigned || variable.export_name || variable.is_reactive_dependency) { if (variable.reassigned || variable.export_name || variable.is_reactive_dependency) {
this.renderer.component.warn(this.node, { this.renderer.component.warn(this.node, {
code: 'reactive-component', code: 'reactive-component',
message: `<${name}/> will not be reactive if ${name} changes. Use <svelte:component this={${name}}/> if you want this reactivity.`, message: `<${name}/> will not be reactive if ${name} changes. Use <svelte:component this={${name}}/> if you want this reactivity.`
}); });
} }
} }
@ -160,8 +160,8 @@ export default class InlineComponentWrapper extends Wrapper {
? [ ? [
p`$$slots: { p`$$slots: {
${Array.from(this.slots).map(([name, slot]) => { ${Array.from(this.slots).map(([name, slot]) => {
return p`${name}: [${slot.block.name}, ${slot.get_context || null}, ${slot.get_changes || null}]`; return p`${name}: [${slot.block.name}, ${slot.get_context || null}, ${slot.get_changes || null}]`;
})} })}
}`, }`,
p`$$scope: { p`$$scope: {
ctx: #ctx ctx: #ctx
@ -250,8 +250,8 @@ export default class InlineComponentWrapper extends Wrapper {
unchanged unchanged
? x`${levels}[${i}]` ? x`${levels}[${i}]`
: condition : condition
? x`${condition} && ${change_object}` ? x`${condition} && ${change_object}`
: change_object : change_object
); );
}); });

@ -16,7 +16,7 @@ const associated_events = {
outerHeight: 'resize', outerHeight: 'resize',
scrollX: 'scroll', scrollX: 'scroll',
scrollY: 'scroll', scrollY: 'scroll'
}; };
const properties = { const properties = {
@ -29,7 +29,7 @@ const readonly = new Set([
'innerHeight', 'innerHeight',
'outerWidth', 'outerWidth',
'outerHeight', 'outerHeight',
'online', 'online'
]); ]);
export default class WindowWrapper extends Wrapper { export default class WindowWrapper extends Wrapper {

@ -17,9 +17,9 @@ export default function bind_this(component: Component, block: Block, binding: B
const body = b` const body = b`
${mutation} ${mutation}
${Array.from(dependencies) ${Array.from(dependencies)
.filter(dep => dep[0] !== '$') .filter(dep => dep[0] !== '$')
.filter(dep => !contextual_dependencies.has(dep)) .filter(dep => !contextual_dependencies.has(dep))
.map(dep => b`${block.renderer.invalidate(dep)};`)} .map(dep => b`${block.renderer.invalidate(dep)};`)}
`; `;
if (contextual_dependencies.size) { if (contextual_dependencies.size) {

@ -34,13 +34,13 @@ export function get_slot_definition(block: Block, scope: TemplateScope, lets: Le
type: 'Property', type: 'Property',
kind: 'init', kind: 'init',
key: l.name, key: l.name,
value, value
}); });
}); });
const changes_input = { const changes_input = {
type: 'ObjectPattern', type: 'ObjectPattern',
properties, properties
}; };
const names: Set<string> = new Set(); const names: Set<string> = new Set();

@ -5,15 +5,15 @@ export function compare_node(a: Node | void, b: Node | void) {
if (!a || !b) return false; if (!a || !b) return false;
if (a.type !== b.type) return false; if (a.type !== b.type) return false;
switch (a.type) { switch (a.type) {
case "Identifier": case "Identifier":
return a.name === (b as Identifier).name; return a.name === (b as Identifier).name;
case "MemberExpression": case "MemberExpression":
return ( return (
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;
} }
} }

@ -31,9 +31,9 @@ export default function flatten_reference(node: Node) {
function to_string(node: Node) { function to_string(node: Node) {
switch (node.type) { switch (node.type) {
case 'Literal': case 'Literal':
return String(node.value); return String(node.value);
case 'Identifier': case 'Identifier':
return node.name; return node.name;
} }
} }

@ -14,21 +14,21 @@ export default function is_used_as_reference(
/* eslint-disable no-fallthrough */ /* eslint-disable no-fallthrough */
switch (parent.type) { switch (parent.type) {
// disregard the `foo` in `const foo = bar` // disregard the `foo` in `const foo = bar`
case 'VariableDeclarator': case 'VariableDeclarator':
return node !== parent.id; return node !== parent.id;
// disregard the `foo`, `bar` in `function foo(bar){}` // disregard the `foo`, `bar` in `function foo(bar){}`
case 'FunctionDeclaration': case 'FunctionDeclaration':
// disregard the `foo` in `import { foo } from 'foo'` // disregard the `foo` in `import { foo } from 'foo'`
case 'ImportSpecifier': case 'ImportSpecifier':
// disregard the `foo` in `import foo from 'foo'` // disregard the `foo` in `import foo from 'foo'`
case 'ImportDefaultSpecifier': case 'ImportDefaultSpecifier':
// disregard the `foo` in `import * as foo from 'foo'` // disregard the `foo` in `import * as foo from 'foo'`
case 'ImportNamespaceSpecifier': case 'ImportNamespaceSpecifier':
// disregard the `foo` in `export { foo }` // disregard the `foo` in `export { foo }`
case 'ExportSpecifier': case 'ExportSpecifier':
return false; return false;
default: default:
return true; return true;
} }
} }

@ -12,11 +12,11 @@ export function escape(data: string, { only_escape_at_symbol = false } = {}) {
} }
const escaped = { const escaped = {
'"': '&quot;', '"': '&quot;',
"'": '&#39;', "'": '&#39;',
'&': '&amp;', '&': '&amp;',
'<': '&lt;', '<': '&lt;',
'>': '&gt;', '>': '&gt;'
}; };
export function escape_html(html) { export function escape_html(html) {

@ -34,7 +34,7 @@ export class Parser {
start: null, start: null,
end: null, end: null,
type: 'Fragment', type: 'Fragment',
children: [], children: []
}; };
this.stack.push(this.html); this.stack.push(this.html);

@ -57,6 +57,6 @@ export default function read_script(parser: Parser, start: number, attributes: N
start, start,
end: parser.index, end: parser.index,
context: get_context(parser, attributes, start), context: get_context(parser, attributes, start),
content: ast, content: ast
}; };
} }

@ -14,7 +14,7 @@ export default function read_style(parser: Parser, start: number, attributes: No
try { try {
ast = parse(styles, { ast = parse(styles, {
positions: true, positions: true,
offset: content_start, offset: content_start
}); });
} catch (err) { } catch (err) {
if (err.name === 'CssSyntaxError') { if (err.name === 'CssSyntaxError') {

@ -134,9 +134,9 @@ export default function mustache(parser: Parser) {
type: 'IfBlock', type: 'IfBlock',
elseif: true, elseif: true,
expression, expression,
children: [], children: []
}, }
], ]
}; };
parser.stack.push(block.else.children[0]); parser.stack.push(block.else.children[0]);
@ -161,7 +161,7 @@ export default function mustache(parser: Parser) {
start: parser.index, start: parser.index,
end: null, end: null,
type: 'ElseBlock', type: 'ElseBlock',
children: [], children: []
}; };
parser.stack.push(block.else); parser.stack.push(block.else);
@ -260,14 +260,14 @@ export default function mustache(parser: Parser) {
type: 'CatchBlock', type: 'CatchBlock',
children: [], children: [],
skip: true skip: true
}, }
} : } :
{ {
start, start,
end: null, end: null,
type, type,
expression, expression,
children: [], children: []
}; };
parser.allow_whitespace(); parser.allow_whitespace();
@ -350,7 +350,7 @@ export default function mustache(parser: Parser) {
start, start,
end: parser.index, end: parser.index,
type: 'RawMustacheTag', type: 'RawMustacheTag',
expression, expression
}); });
} else if (parser.eat('@debug')) { } else if (parser.eat('@debug')) {
let identifiers; let identifiers;
@ -394,7 +394,7 @@ export default function mustache(parser: Parser) {
start, start,
end: parser.index, end: parser.index,
type: 'MustacheTag', type: 'MustacheTag',
expression, expression
}); });
} }
} }

@ -25,16 +25,16 @@ const specials = new Map([
'script', 'script',
{ {
read: read_script, read: read_script,
property: 'js', property: 'js'
}, }
], ],
[ [
'style', 'style',
{ {
read: read_style, read: read_style,
property: 'css', property: 'css'
}, }
], ]
]); ]);
const SELF = /^svelte:self(?=[\s/>])/; const SELF = /^svelte:self(?=[\s/>])/;
@ -63,7 +63,7 @@ export default function tag(parser: Parser) {
start, start,
end: parser.index, end: parser.index,
type: 'Comment', type: 'Comment',
data, data
}); });
return; return;
@ -116,7 +116,7 @@ export default function tag(parser: Parser) {
type, type,
name, name,
attributes: [], attributes: [],
children: [], children: []
}; };
parser.allow_whitespace(); parser.allow_whitespace();
@ -424,7 +424,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
end, end,
type: 'Attribute', type: 'Attribute',
name, name,
value, value
}; };
} }
@ -491,7 +491,7 @@ function read_sequence(parser: Parser, done: () => boolean): TemplateNode[] {
start: index, start: index,
end: parser.index, end: parser.index,
type: 'MustacheTag', type: 'MustacheTag',
expression, expression
}); });
current_chunk = { current_chunk = {

@ -19,7 +19,7 @@ export default function text(parser: Parser) {
end: parser.index, end: parser.index,
type: 'Text', type: 'Text',
raw: data, raw: data,
data: decode_character_references(data), data: decode_character_references(data)
}; };
parser.current().children.push(node); parser.current().children.push(node);

@ -2030,5 +2030,5 @@ export default {
sc: 8827, sc: 8827,
wp: 8472, wp: 8472,
wr: 8768, wr: 8768,
xi: 958, xi: 958
}; };

@ -32,7 +32,7 @@ const windows_1252 = [
339, 339,
157, 157,
382, 382,
376, 376
]; ];
const entity_pattern = new RegExp( const entity_pattern = new RegExp(
@ -124,7 +124,7 @@ const disallowed_contents = new Map([
'address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul'.split( 'address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul'.split(
' ' ' '
) )
), )
], ],
['rt', new Set(['rt', 'rp'])], ['rt', new Set(['rt', 'rp'])],
['rp', new Set(['rt', 'rp'])], ['rp', new Set(['rt', 'rp'])],
@ -135,7 +135,7 @@ const disallowed_contents = new Map([
['tfoot', new Set(['tbody'])], ['tfoot', new Set(['tbody'])],
['tr', new Set(['tr', 'tbody'])], ['tr', new Set(['tr', 'tbody'])],
['td', new Set(['td', 'th', 'tr'])], ['td', new Set(['td', 'th', 'tr'])],
['th', new Set(['td', 'th', 'tr'])], ['th', new Set(['td', 'th', 'tr'])]
]); ]);
// can this be a child of the parent element, or does it implicitly // can this be a child of the parent element, or does it implicitly

@ -2,29 +2,29 @@ import { TemplateNode } from '../../interfaces';
export function to_string(node: TemplateNode) { export function to_string(node: TemplateNode) {
switch (node.type) { switch (node.type) {
case 'IfBlock': case 'IfBlock':
return '{#if} block'; return '{#if} block';
case 'ThenBlock': case 'ThenBlock':
return '{:then} block'; return '{:then} block';
case 'ElseBlock': case 'ElseBlock':
return '{:else} block'; return '{:else} block';
case 'PendingBlock': case 'PendingBlock':
case 'AwaitBlock': case 'AwaitBlock':
return '{#await} block'; return '{#await} block';
case 'CatchBlock': case 'CatchBlock':
return '{:catch} block'; return '{:catch} block';
case 'EachBlock': case 'EachBlock':
return '{#each} block'; return '{#each} block';
case 'RawMustacheTag': case 'RawMustacheTag':
return '{@html} block'; return '{@html} block';
case 'DebugTag': case 'DebugTag':
return '{@debug} block'; return '{@debug} block';
case 'Element': case 'Element':
case 'InlineComponent': case 'InlineComponent':
case 'Slot': case 'Slot':
case 'Title': case 'Title':
return `<${node.name}> tag`; return `<${node.name}> tag`;
default: default:
return node.type; return node.type;
} }
} }

@ -49,7 +49,7 @@ async function replace_async(str: string, re: RegExp, func: (...any) => Promise<
({ ({
offset: args[args.length - 2], offset: args[args.length - 2],
length: args[0].length, length: args[0].length,
replacement: res, replacement: res
}) as Replacement }) as Replacement
) )
); );

@ -206,7 +206,7 @@ class FuzzySet {
match_score = matches[match_index]; match_score = matches[match_index];
results.push([ results.push([
match_score / (vector_normal * items[match_index][0]), match_score / (vector_normal * items[match_index][0]),
items[match_index][1], items[match_index][1]
]); ]);
} }
@ -218,7 +218,7 @@ class FuzzySet {
for (let i = 0; i < end_index; ++i) { for (let i = 0; i < end_index; ++i) {
new_results.push([ new_results.push([
_distance(results[i][1], normalized_value), _distance(results[i][1], normalized_value),
results[i][1], results[i][1]
]); ]);
} }
results = new_results; results = new_results;

@ -105,7 +105,7 @@ export const reserved = new Set([
'void', 'void',
'while', 'while',
'with', 'with',
'yield', 'yield'
]); ]);
const void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/; const void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;

@ -17,7 +17,7 @@ export const valid_namespaces = [
svg, svg,
xlink, xlink,
xml, xml,
xmlns, xmlns
]; ];
export const namespaces: Record<string, string> = { html, mathml, svg, xlink, xml, xmlns }; export const namespaces: Record<string, string> = { html, mathml, svg, xlink, xml, xmlns };

@ -113,7 +113,7 @@ export class SvelteComponentDev extends SvelteComponent {
hydrate?: boolean; hydrate?: boolean;
intro?: boolean; intro?: boolean;
$$inline?: boolean; $$inline?: boolean;
}) { }) {
if (!options || (!options.target && !options.$$inline)) { if (!options || (!options.target && !options.$$inline)) {
throw new Error(`'target' is a required option`); throw new Error(`'target' is a required option`);
} }

@ -3,5 +3,5 @@ declare const global: any;
export const globals = (typeof window !== 'undefined' export const globals = (typeof window !== 'undefined'
? window ? window
: typeof globalThis !== 'undefined' : typeof globalThis !== 'undefined'
? globalThis ? globalThis
: global) as unknown as typeof globalThis; : global) as unknown as typeof globalThis;

@ -52,7 +52,7 @@ const subscriber_queue = [];
*/ */
export function readable<T>(value: T, start: StartStopNotifier<T>): Readable<T> { export function readable<T>(value: T, start: StartStopNotifier<T>): Readable<T> {
return { return {
subscribe: writable(value, start).subscribe, subscribe: writable(value, start).subscribe
}; };
} }
@ -184,7 +184,7 @@ export function derived<T>(stores: Stores, fn: Function, initial_value?: T): Rea
}, },
() => { () => {
pending |= (1 << i); pending |= (1 << i);
}), })
); );
inited = true; inited = true;

@ -12,7 +12,7 @@ export default {
13: .foocc {color: red;}`, 13: .foocc {color: red;}`,
start: { line: 11, column: 2, character: 206 }, start: { line: 11, column: 2, character: 206 },
end: { line: 11, column: 8, character: 212 }, end: { line: 11, column: 8, character: 212 },
pos: 206, pos: 206
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -26,7 +26,7 @@ export default {
14: .foodd {color: red;}`, 14: .foodd {color: red;}`,
start: { line: 12, column: 2, character: 229 }, start: { line: 12, column: 2, character: 229 },
end: { line: 12, column: 8, character: 235 }, end: { line: 12, column: 8, character: 235 },
pos: 229, pos: 229
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -40,7 +40,7 @@ export default {
16: .bb {color: red;}`, 16: .bb {color: red;}`,
start: { line: 14, column: 2, character: 275 }, start: { line: 14, column: 2, character: 275 },
end: { line: 14, column: 8, character: 281 }, end: { line: 14, column: 8, character: 281 },
pos: 275, pos: 275
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -54,7 +54,7 @@ export default {
22: .ddbar {color: red;}`, 22: .ddbar {color: red;}`,
start: { line: 20, column: 2, character: 401 }, start: { line: 20, column: 2, character: 401 },
end: { line: 20, column: 8, character: 407 }, end: { line: 20, column: 8, character: 407 },
pos: 401, pos: 401
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -68,7 +68,7 @@ export default {
23: .fooaabar {color: red;}`, 23: .fooaabar {color: red;}`,
start: { line: 21, column: 2, character: 424 }, start: { line: 21, column: 2, character: 424 },
end: { line: 21, column: 8, character: 430 }, end: { line: 21, column: 8, character: 430 },
pos: 424, pos: 424
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -82,7 +82,7 @@ export default {
24: .foobbbar {color: red;}`, 24: .foobbbar {color: red;}`,
start: { line: 22, column: 2, character: 447 }, start: { line: 22, column: 2, character: 447 },
end: { line: 22, column: 8, character: 453 }, end: { line: 22, column: 8, character: 453 },
pos: 447, pos: 447
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -96,7 +96,7 @@ export default {
25: .fooccbar {color: red;}`, 25: .fooccbar {color: red;}`,
start: { line: 23, column: 2, character: 470 }, start: { line: 23, column: 2, character: 470 },
end: { line: 23, column: 11, character: 479 }, end: { line: 23, column: 11, character: 479 },
pos: 470, pos: 470
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -110,7 +110,7 @@ export default {
26: .fooddbar {color: red;}`, 26: .fooddbar {color: red;}`,
start: { line: 24, column: 2, character: 496 }, start: { line: 24, column: 2, character: 496 },
end: { line: 24, column: 11, character: 505 }, end: { line: 24, column: 11, character: 505 },
pos: 496, pos: 496
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -124,7 +124,7 @@ export default {
27: .baz {color: red;}`, 27: .baz {color: red;}`,
start: { line: 25, column: 2, character: 522 }, start: { line: 25, column: 2, character: 522 },
end: { line: 25, column: 11, character: 531 }, end: { line: 25, column: 11, character: 531 },
pos: 522, pos: 522
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -137,7 +137,7 @@ export default {
29: </style>`, 29: </style>`,
start: { line: 28, column: 2, character: 595 }, start: { line: 28, column: 2, character: 595 },
end: { line: 28, column: 9, character: 602 }, end: { line: 28, column: 9, character: 602 },
pos: 595, pos: 595
}, }
], ]
}; };

@ -1,3 +1,3 @@
export default { export default {
warnings: [], warnings: []
}; };

@ -5,7 +5,7 @@ export default {
end: { end: {
character: 205, character: 205,
column: 9, column: 9,
line: 14, line: 14
}, },
frame: ` frame: `
12: .thing.active {color: blue;} 12: .thing.active {color: blue;}
@ -18,8 +18,8 @@ export default {
start: { start: {
character: 198, character: 198,
column: 2, column: 2,
line: 14, line: 14
}, }
}, }
], ]
}; };

@ -12,7 +12,7 @@ export default {
17: .unused {color: blue;}`, 17: .unused {color: blue;}`,
start: { line: 15, column: 2, character: 261 }, start: { line: 15, column: 2, character: 261 },
end: { line: 15, column: 15, character: 274 }, end: { line: 15, column: 15, character: 274 },
pos: 261, pos: 261
}, },
{ {
code: 'css-unused-selector', code: 'css-unused-selector',
@ -25,7 +25,7 @@ export default {
18: </style>`, 18: </style>`,
start: { line: 17, column: 2, character: 295 }, start: { line: 17, column: 2, character: 295 },
end: { line: 17, column: 9, character: 302 }, end: { line: 17, column: 9, character: 302 },
pos: 295, pos: 295
}, }
], ]
}; };

@ -153,7 +153,7 @@ export function normalizeHtml(window, html) {
export function setupHtmlEqual() { export function setupHtmlEqual() {
const window = env(); const window = env();
assert.htmlEqual = (actual, expected, message) => { assert.htmlEqual = (actual, expected, message) => { // eslint-disable-line no-import-assign
assert.deepEqual( assert.deepEqual(
normalizeHtml(window, actual), normalizeHtml(window, actual),
normalizeHtml(window, expected), normalizeHtml(window, expected),

@ -7,7 +7,7 @@ export default {
return { return {
nullText, nullText,
undefinedText, undefinedText
}; };
}, },
@ -17,5 +17,5 @@ export default {
assert.equal(nullText, snapshot.nullText); assert.equal(nullText, snapshot.nullText);
assert.equal(undefinedText, snapshot.undefinedText); assert.equal(undefinedText, snapshot.undefinedText);
}, }
}; };

@ -3,7 +3,7 @@ export default {
const h1 = target.querySelector('h1'); const h1 = target.querySelector('h1');
return { return {
h1, h1
}; };
}, },

@ -1,6 +1,6 @@
export default { export default {
options: { options: {
dev: true, dev: true,
loopGuardTimeout: 100, loopGuardTimeout: 100
}, }
}; };

@ -2,7 +2,7 @@ export default {
preprocess: [ preprocess: [
{ {
script: ({ content }) => ({ code: content.replace(/one/g, 'two') }), script: ({ content }) => ({ code: content.replace(/one/g, 'two') }),
style: ({ content }) => ({ code: content.replace(/one/g, 'three') }), style: ({ content }) => ({ code: content.replace(/one/g, 'three') })
}, }
], ]
}; };

@ -11,7 +11,7 @@ export default {
<div d="4" e="5" foo="1"></div> <div d="4" e="5" foo="1"></div>
<button></button><button></button><button></button><button></button> <button></button><button></button><button></button><button></button>
`, `,
async test({ assert, target, window, }) { async test({ assert, target, window }) {
const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button'); const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button');
const clickEvent = new window.MouseEvent('click'); const clickEvent = new window.MouseEvent('click');

@ -13,7 +13,7 @@ export default {
<button></button><button></button><button></button><button></button> <button></button><button></button><button></button><button></button>
`, `,
async test({ assert, target, window, }) { async test({ assert, target, window }) {
const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button'); const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button');
const clickEvent = new window.MouseEvent('click'); const clickEvent = new window.MouseEvent('click');

@ -18,5 +18,5 @@ export default {
input.dispatchEvent(event); input.dispatchEvent(event);
assert.ok(blurred); assert.ok(blurred);
}, }
}; };

@ -1,7 +1,7 @@
export default { export default {
props: { props: {
target: 'World!', target: 'World!',
display: true, display: true
}, },
html: ` html: `
@ -16,5 +16,5 @@ export default {
assert.htmlEqual(target.innerHTML, ` assert.htmlEqual(target.innerHTML, `
<h1>Hello World!</h1> <h1>Hello World!</h1>
`); `);
}, }
}; };

@ -7,5 +7,5 @@ export default {
await button.dispatchEvent(click); await button.dispatchEvent(click);
await Promise.resolve(); await Promise.resolve();
assert.htmlEqual(target.innerHTML, `<button>2</button>`); assert.htmlEqual(target.innerHTML, `<button>2</button>`);
}, }
}; };

@ -1,7 +1,7 @@
const value = []; const value = [];
export default { export default {
props: { props: {
value, value
}, },
async test({ assert, component, target, window }) { async test({ assert, component, target, window }) {
@ -32,7 +32,7 @@ export default {
'15', '15',
'16', '16',
'17', '17',
'18', '18'
]); ]);
}, }
}; };

@ -33,5 +33,5 @@ export default {
<input> <input>
<p>HE</p> <p>HE</p>
`); `);
}, }
}; };

@ -3,5 +3,5 @@ export default {
test({ assert, component, target }) { test({ assert, component, target }) {
const textarea = target.querySelector('textarea'); const textarea = target.querySelector('textarea');
assert.ok(textarea.readOnly === false); assert.ok(textarea.readOnly === false);
}, }
}; };

@ -3,5 +3,5 @@ export default {
test({ assert, component, target }) { test({ assert, component, target }) {
const textarea = target.querySelector('textarea'); const textarea = target.querySelector('textarea');
assert.ok(textarea.readOnly); assert.ok(textarea.readOnly);
}, }
}; };

@ -1,3 +1,3 @@
export default { export default {
html: '<div data-potato=""></div>', html: '<div data-potato=""></div>'
}; };

@ -1,5 +1,5 @@
export default { export default {
html: ` html: `
<div><div title='foo'>bar</div></div> <div><div title='foo'>bar</div></div>
`, `
}; };

@ -1,3 +1,3 @@
export default { export default {
html: `<div class="false"></div>`, html: `<div class="false"></div>`
}; };

@ -1,7 +1,7 @@
export default { export default {
props: { props: {
testName1: "test1", testName1: "test1",
testName2: "test2", testName2: "test2"
}, },
html: `<div class="test1test2"></div>`, html: `<div class="test1test2"></div>`,

@ -1,7 +1,7 @@
export default { export default {
props: { props: {
testName1: "test1", testName1: "test1",
testName2: "test2", testName2: "test2"
}, },
html: `<div class="test1test2 svelte-x1o6ra"></div>`, html: `<div class="test1test2 svelte-x1o6ra"></div>`,

@ -1,7 +1,7 @@
export default { export default {
props: { props: {
testName1: "test1", testName1: "test1",
testName2: "test2", testName2: "test2"
}, },
html: `<div class="test1test2"></div>`, html: `<div class="test1test2"></div>`,

@ -1,7 +1,7 @@
export default { export default {
props: { props: {
testName1: "test1", testName1: "test1",
testName2: "test2", testName2: "test2"
}, },
html: `<div class="test1test2 svelte-x1o6ra"></div>`, html: `<div class="test1test2 svelte-x1o6ra"></div>`,

@ -1,3 +1,3 @@
export default { export default {
html: `<div></div>`, html: `<div></div>`
}; };

@ -2,7 +2,7 @@ export default {
skip_if_ssr: true, skip_if_ssr: true,
props: { props: {
foo: false, foo: false
}, },
test({ assert, component, target }) { test({ assert, component, target }) {
@ -15,5 +15,5 @@ export default {
assert.ok(!inputs[0].checked); assert.ok(!inputs[0].checked);
assert.ok(inputs[1].checked); assert.ok(inputs[1].checked);
}, }
}; };

@ -1,3 +1,3 @@
export default { export default {
html: `<div></div>`, html: `<div></div>`
}; };

@ -36,5 +36,5 @@ export default {
<editor contenteditable="true">good<span>bye</span></editor> <editor contenteditable="true">good<span>bye</span></editor>
<p>hello good<span>bye</span></p> <p>hello good<span>bye</span></p>
`); `);
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
name: '<b>world</b>', name: '<b>world</b>'
}, },
html: ` html: `
@ -34,5 +34,5 @@ export default {
<editor contenteditable="true">good<span>bye</span></editor> <editor contenteditable="true">good<span>bye</span></editor>
<p>hello good<span>bye</span></p> <p>hello good<span>bye</span></p>
`); `);
}, }
}; };

@ -30,5 +30,5 @@ export default {
<editor contenteditable="true">goodbye</editor> <editor contenteditable="true">goodbye</editor>
<p>hello goodbye</p> <p>hello goodbye</p>
`); `);
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
name: 'world', name: 'world'
}, },
html: ` html: `
@ -28,5 +28,5 @@ export default {
<editor contenteditable="true">goodbye</editor> <editor contenteditable="true">goodbye</editor>
<p>hello goodbye</p> <p>hello goodbye</p>
`); `);
}, }
}; };

@ -2,7 +2,7 @@ export default {
skip_if_ssr: true, skip_if_ssr: true,
props: { props: {
indeterminate: true, indeterminate: true
}, },
html: ` html: `
@ -38,5 +38,5 @@ export default {
<p>checked? true</p> <p>checked? true</p>
<p>indeterminate? true</p> <p>indeterminate? true</p>
`); `);
}, }
}; };

@ -3,13 +3,13 @@ export default {
cats: [ cats: [
{ {
name: "cat 0", name: "cat 0",
checked: false, checked: false
}, },
{ {
name: "cat 1", name: "cat 1",
checked: false, checked: false
}, }
], ]
}, },
html: ` html: `
@ -22,7 +22,7 @@ export default {
const newCats = cats.slice(); const newCats = cats.slice();
newCats.push({ newCats.push({
name: "cat " + cats.length, name: "cat " + cats.length,
checked: false, checked: false
}); });
component.cats = newCats; component.cats = newCats;

@ -77,5 +77,5 @@ export default {
assert.equal(inputs[5].checked, false); assert.equal(inputs[5].checked, false);
assert.equal(inputs[6].checked, false); assert.equal(inputs[6].checked, false);
assert.equal(inputs[7].checked, true); assert.equal(inputs[7].checked, true);
}, }
}; };

@ -7,13 +7,13 @@ const values = [
const selected_array = [ const selected_array = [
[values[1]], [values[1]],
[], [],
[values[2]], [values[2]]
]; ];
export default { export default {
props: { props: {
values, values,
selected_array, selected_array
}, },
html: ` html: `

@ -7,13 +7,13 @@ const values = [
const selected_array = [ const selected_array = [
[values[1]], [values[1]],
[], [],
[values[2]], [values[2]]
]; ];
export default { export default {
props: { props: {
values, values,
selected_array, selected_array
}, },
html: ` html: `

@ -27,5 +27,5 @@ export default {
component.value = 1; component.value = 1;
assert.equal(component.value, 1); assert.equal(component.value, 1);
assert.equal(input.value, "1"); assert.equal(input.value, "1");
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
count: 42, count: 42
}, },
html: ` html: `
@ -44,5 +44,5 @@ export default {
<input type='number'> <input type='number'>
<p>undefined undefined</p> <p>undefined undefined</p>
`); `);
}, }
}; };

@ -29,5 +29,5 @@ export default {
<input type=range min=0 max=20> <input type=range min=0 max=20>
<p>20 of 20</p> <p>20 of 20</p>
`); `);
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
count: 42, count: 42
}, },
html: ` html: `
@ -34,5 +34,5 @@ export default {
<input type='range'> <input type='range'>
<p>number 44</p> <p>number 44</p>
`); `);
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
count: 42, count: 42
}, },
html: ` html: `
@ -34,5 +34,5 @@ export default {
<input type='range'> <input type='range'>
<p>number 44</p> <p>number 44</p>
`); `);
}, }
}; };

@ -1,7 +1,7 @@
export default { export default {
props: { props: {
foo: 'a', foo: 'a',
items: ['x'], items: ['x']
}, },
html: ` html: `
@ -32,5 +32,5 @@ export default {
<div><input><p>b</p></div> <div><input><p>b</p></div>
<div><input><p>y</p></div> <div><input><p>y</p></div>
`); `);
}, }
}; };

@ -121,5 +121,5 @@ export default {
<p>done:one / done:two / remaining:four</p> <p>done:one / done:two / remaining:four</p>
`); `);
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
items: ['one', 'two', 'three'], items: ['one', 'two', 'three']
}, },
html: ` html: `
@ -65,5 +65,5 @@ export default {
<input><p>five</p> <input><p>five</p>
</div> </div>
`); `);
}, }
}; };

@ -1,8 +1,8 @@
export default { export default {
props: { props: {
component: { component: {
name: 'world', name: 'world'
}, }
}, },
html: ` html: `
@ -36,5 +36,5 @@ export default {
<h1>Hello goodbye!</h1> <h1>Hello goodbye!</h1>
<input> <input>
`); `);
}, }
}; };

@ -4,8 +4,8 @@ export default {
obj: { obj: {
foo: 'a', foo: 'a',
bar: 'b', bar: 'b',
baz: 'c', baz: 'c'
}, }
}, },
html: ` html: `
@ -56,5 +56,5 @@ export default {
<input> <input>
<pre>{"foo":"d","bar":"e","baz":"f"}</pre> <pre>{"foo":"d","bar":"e","baz":"f"}</pre>
`); `);
}, }
}; };

@ -2,8 +2,8 @@ export default {
props: { props: {
prop: 'name', prop: 'name',
user: { user: {
name: 'alice', name: 'alice'
}, }
}, },
html: ` html: `
@ -40,5 +40,5 @@ export default {
<input> <input>
<p>hello carol</p> <p>hello carol</p>
`); `);
}, }
}; };

@ -5,9 +5,9 @@ export default {
{ {
foo: 'a', foo: 'a',
bar: 'b', bar: 'b',
baz: 'c', baz: 'c'
}, }
], ]
}, },
html: ` html: `
@ -58,5 +58,5 @@ export default {
<input> <input>
<pre>{"foo":"d","bar":"e","baz":"f"}</pre> <pre>{"foo":"d","bar":"e","baz":"f"}</pre>
`); `);
}, }
}; };

@ -3,8 +3,8 @@ export default {
items: [ items: [
{ description: 'one' }, { description: 'one' },
{ description: 'two' }, { description: 'two' },
{ description: 'three' }, { description: 'three' }
], ]
}, },
html: ` html: `
@ -45,5 +45,5 @@ export default {
<div><input><p>four</p></div> <div><input><p>four</p></div>
<div><input><p>five</p></div> <div><input><p>five</p></div>
`); `);
}, }
}; };

@ -1,8 +1,8 @@
export default { export default {
props: { props: {
user: { user: {
name: 'alice', name: 'alice'
}, }
}, },
html: ` html: `
@ -39,5 +39,5 @@ export default {
<input> <input>
<p>hello carol</p> <p>hello carol</p>
`); `);
}, }
}; };

@ -26,5 +26,5 @@ export default {
component.x = undefined; component.x = undefined;
assert.equal(input.value, ''); assert.equal(input.value, '');
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
name: 'world', name: 'world'
}, },
html: ` html: `
@ -33,5 +33,5 @@ export default {
<input> <input>
<p>hello goodbye</p> <p>hello goodbye</p>
`); `);
}, }
}; };

@ -24,7 +24,7 @@ export default {
`, `,
props: { props: {
selected: 'b', selected: 'b'
}, },
test({ assert, component, target }) { test({ assert, component, target }) {
@ -33,5 +33,5 @@ export default {
assert.equal(select.value, 'b'); assert.equal(select.value, 'b');
assert.ok(options[1].selected); assert.ok(options[1].selected);
}, }
}; };

@ -45,5 +45,5 @@ export default {
</optgroup> </optgroup>
</select> </select>
`); `);
}, }
}; };

@ -24,7 +24,7 @@ export default {
`, `,
props: { props: {
selected: 'one', selected: 'one'
}, },
async test({ assert, component, target, window }) { async test({ assert, component, target, window }) {
@ -53,5 +53,5 @@ export default {
`); `);
component.selected = 'three'; component.selected = 'three';
}, }
}; };

@ -37,5 +37,5 @@ export default {
assert.deepEqual(names, ['world', 'everybody', 'goodbye']); assert.deepEqual(names, ['world', 'everybody', 'goodbye']);
unsubscribe(); unsubscribe();
}, }
}; };

@ -37,5 +37,5 @@ export default {
assert.deepEqual(names, ['world', 'everybody', 'goodbye']); assert.deepEqual(names, ['world', 'everybody', 'goodbye']);
unsubscribe(); unsubscribe();
}, }
}; };

@ -1,6 +1,6 @@
export default { export default {
props: { props: {
value: 'some text', value: 'some text'
}, },
html: ` html: `
@ -33,5 +33,5 @@ export default {
<textarea></textarea> <textarea></textarea>
<p>goodbye</p> <p>goodbye</p>
`); `);
}, }
}; };

@ -1,3 +1,3 @@
export default { export default {
error: `potato is not defined`, error: `potato is not defined`
}; };

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save