diff --git a/.eslintrc.js b/.eslintrc.js index 66c533eb5d..fff483ac0a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { root: true, - extends: '@sveltejs', + extends: ['@sveltejs', 'prettier'], settings: { 'import/core-modules': [ 'svelte', diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93116a8df0..2082d2cfba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: with: node-version: 16 cache: pnpm - - run: 'pnpm i && pnpm lint' + - run: 'pnpm i && pnpm format:check && pnpm lint' Unit: runs-on: ${{ matrix.os }} timeout-minutes: 10 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..447573c618 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +/* +!/elements +!/scripts +# TODO: after launch new site, format site dir. +/site +!/src +src/compiler/compile/internal_exports.ts +!/test +/test/**/*.svelte +/test/**/_expected* +/test/**/_actual* +/test/**/expected* +/types diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..c187505941 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,23 @@ +{ + "useTabs": true, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "overrides": [ + { + "files": ["*.svelte"], + "options": { + "bracketSameLine": false + } + }, + { + "files": ["README.md", "packages/*/README.md"], + "options": { + "useTabs": false, + "tabWidth": 2 + } + } + ], + "pluginSearchDirs": ["."] +} diff --git a/elements/index.d.ts b/elements/index.d.ts index 0676ff4ef5..046ba94786 100644 --- a/elements/index.d.ts +++ b/elements/index.d.ts @@ -39,8 +39,9 @@ type Booleanish = boolean | 'true' | 'false'; // Event Handler Types // ---------------------------------------------------------------------- -type EventHandler = -(event: E & { currentTarget: EventTarget & T}) => any; +type EventHandler = ( + event: E & { currentTarget: EventTarget & T } +) => any; export type ClipboardEventHandler = EventHandler; export type CompositionEventHandler = EventHandler; @@ -196,7 +197,7 @@ export interface DOMAttributes { // Message Events 'on:message'?: MessageEventHandler | undefined | null; 'on:messageerror'?: MessageEventHandler | undefined | null; - + // Document Events 'on:visibilitychange'?: EventHandler | undefined | null; @@ -350,7 +351,19 @@ export interface AriaAttributes { * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ - 'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined | null; + 'aria-relevant'?: + | 'additions' + | 'additions removals' + | 'additions text' + | 'all' + | 'removals' + | 'removals additions' + | 'removals text' + | 'text' + | 'text additions' + | 'text removals' + | undefined + | null; /** Indicates that user input is required on the element before a form may be submitted. */ 'aria-required'?: Booleanish | undefined | null; /** Defines a human-readable, author-localized description for the role of an element. */ @@ -470,14 +483,23 @@ export type AriaRole = export interface HTMLAttributes extends AriaAttributes, DOMAttributes { // Standard HTML Attributes - accesskey?: string | undefined | null; + accesskey?: string | undefined | null; autofocus?: boolean | undefined | null; class?: string | undefined | null; contenteditable?: Booleanish | 'inherit' | undefined | null; contextmenu?: string | undefined | null; dir?: string | undefined | null; draggable?: Booleanish | undefined | null; - enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined | null; + enterkeyhint?: + | 'enter' + | 'done' + | 'go' + | 'next' + | 'previous' + | 'search' + | 'send' + | undefined + | null; hidden?: boolean | undefined | null; id?: string | undefined | null; lang?: string | undefined | null; @@ -526,7 +548,17 @@ export interface HTMLAttributes extends AriaAttributes, D * Hints at the type of data that might be entered by the user while editing the element or its contents * @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute */ - inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined | null; + inputmode?: + | 'none' + | 'text' + | 'tel' + | 'url' + | 'email' + | 'numeric' + | 'decimal' + | 'search' + | undefined + | null; /** * Specify that a standard HTML element should behave like a defined custom built-in element * @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is @@ -554,7 +586,16 @@ export interface HTMLAttributes extends AriaAttributes, D // SvelteKit 'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null; 'data-sveltekit-noscroll'?: true | '' | 'off' | undefined | null; - 'data-sveltekit-preload-code'?: true | '' | 'eager' | 'viewport' | 'hover' | 'tap' | 'off' | undefined | null; + 'data-sveltekit-preload-code'?: + | true + | '' + | 'eager' + | 'viewport' + | 'hover' + | 'tap' + | 'off' + | undefined + | null; 'data-sveltekit-preload-data'?: true | '' | 'hover' | 'tap' | 'off' | undefined | null; 'data-sveltekit-reload'?: true | '' | 'off' | undefined | null; 'data-sveltekit-replacestate'?: true | '' | 'off' | undefined | null; @@ -563,12 +604,7 @@ export interface HTMLAttributes extends AriaAttributes, D [key: `data-${string}`]: any; } -export type HTMLAttributeAnchorTarget = - | '_self' - | '_blank' - | '_parent' - | '_top' - | (string & {}); +export type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {}); export interface HTMLAnchorAttributes extends HTMLAttributes { download?: any; @@ -844,7 +880,14 @@ export interface HTMLMenuAttributes extends HTMLAttributes { export interface HTMLMediaAttributes extends HTMLAttributes { autoplay?: boolean | undefined | null; controls?: boolean | undefined | null; - controlslist?: 'nodownload' | 'nofullscreen' | 'noplaybackrate' | 'noremoteplayback' | (string & {}) | undefined | null; + controlslist?: + | 'nodownload' + | 'nofullscreen' + | 'noplaybackrate' + | 'noremoteplayback' + | (string & {}) + | undefined + | null; crossorigin?: string | undefined | null; currenttime?: number | undefined | null; defaultmuted?: boolean | undefined | null; @@ -1155,9 +1198,22 @@ export interface SVGAttributes extends AriaAttributes, DO 'accent-height'?: number | string | undefined | null; accumulate?: 'none' | 'sum' | undefined | null; additive?: 'replace' | 'sum' | undefined | null; - 'alignment-baseline'?: 'auto' | 'baseline' | 'before-edge' | 'text-before-edge' | 'middle' | - 'central' | 'after-edge' | 'text-after-edge' | 'ideographic' | 'alphabetic' | 'hanging' | - 'mathematical' | 'inherit' | undefined | null; + 'alignment-baseline'?: + | 'auto' + | 'baseline' + | 'before-edge' + | 'text-before-edge' + | 'middle' + | 'central' + | 'after-edge' + | 'text-after-edge' + | 'ideographic' + | 'alphabetic' + | 'hanging' + | 'mathematical' + | 'inherit' + | undefined + | null; allowReorder?: 'no' | 'yes' | undefined | null; alphabetic?: number | string | undefined | null; amplitude?: number | string | undefined | null; @@ -1604,15 +1660,27 @@ export interface SvelteHTMLElements { 'svelte:body': HTMLAttributes; 'svelte:fragment': { slot?: string }; 'svelte:options': { - customElement?: string | undefined | { - tag: string; - shadow?: 'open' | 'none' | undefined; - props?: Record | undefined; - }; + customElement?: + | string + | undefined + | { + tag: string; + shadow?: 'open' | 'none' | undefined; + props?: + | Record< + string, + { + attribute?: string; + reflect?: boolean; + type?: 'String' | 'Boolean' | 'Number' | 'Array' | 'Object'; + } + > + | undefined; + }; immutable?: boolean | undefined; accessors?: boolean | undefined; namespace?: string | undefined; - [name: string]: any + [name: string]: any; }; 'svelte:head': { [name: string]: any }; diff --git a/elements/package.json b/elements/package.json index 1704e6b78b..aab9cdce27 100644 --- a/elements/package.json +++ b/elements/package.json @@ -1,3 +1,3 @@ { - "types": "./index.d.ts" + "types": "./index.d.ts" } diff --git a/package.json b/package.json index 790302e2c5..9c2ada6782 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,8 @@ }, "types": "types/runtime/index.d.ts", "scripts": { + "format:fix": "prettier . --cache --plugin-search-dir=. --write", + "format:check": "prettier . --cache --plugin-search-dir=. --check", "test": "npm run test:unit && npm run test:integration && echo \"manually check that there are no type errors in test/types by opening the files in there\"", "test:integration": "mocha --exit", "test:unit": "mocha --config .mocharc.unit.js --exit", @@ -133,6 +135,7 @@ "code-red": "^1.0.0", "css-tree": "^2.3.1", "eslint": "^8.35.0", + "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-svelte3": "^4.0.0", "estree-walker": "^3.0.3", @@ -143,6 +146,8 @@ "magic-string": "^0.30.0", "mocha": "^10.2.0", "periscopic": "^3.1.0", + "prettier": "^2.8.8", + "prettier-plugin-svelte": "^2.10.0", "puppeteer": "^19.8.5", "rollup": "^3.20.2", "source-map": "^0.7.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68bf1304f6..ed6da5e726 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -70,6 +70,9 @@ devDependencies: eslint: specifier: ^8.35.0 version: 8.35.0 + eslint-config-prettier: + specifier: ^8.8.0 + version: 8.8.0(eslint@8.35.0) eslint-plugin-import: specifier: ^2.27.5 version: 2.27.5(@typescript-eslint/parser@5.58.0)(eslint@8.35.0) @@ -100,6 +103,12 @@ devDependencies: periscopic: specifier: ^3.1.0 version: 3.1.0 + prettier: + specifier: ^2.8.8 + version: 2.8.8 + prettier-plugin-svelte: + specifier: ^2.10.0 + version: 2.10.0(prettier@2.8.8)(svelte@3.58.0) puppeteer: specifier: ^19.8.5 version: 19.8.5(typescript@5.0.4) @@ -1238,6 +1247,15 @@ packages: source-map: 0.6.1 dev: true + /eslint-config-prettier@8.8.0(eslint@8.35.0): + resolution: {integrity: sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + dependencies: + eslint: 8.35.0 + dev: true + /eslint-import-resolver-node@0.3.7: resolution: {integrity: sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==} dependencies: @@ -2552,6 +2570,22 @@ packages: engines: {node: '>= 0.8.0'} dev: true + /prettier-plugin-svelte@2.10.0(prettier@2.8.8)(svelte@3.58.0): + resolution: {integrity: sha512-GXMY6t86thctyCvQq+jqElO+MKdB09BkL3hexyGP3Oi8XLKRFaJP1ud/xlWCZ9ZIa2BxHka32zhHfcuU+XsRQg==} + peerDependencies: + prettier: ^1.16.4 || ^2.0.0 + svelte: ^3.2.0 + dependencies: + prettier: 2.8.8 + svelte: 3.58.0 + dev: true + + /prettier@2.8.8: + resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + dev: true + /progress@2.0.3: resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} engines: {node: '>=0.4.0'} diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs index 1c4274a024..47dbc240ff 100644 --- a/scripts/globals-extractor.mjs +++ b/scripts/globals-extractor.mjs @@ -15,13 +15,14 @@ const GLOBAL_TS_PATH = './src/compiler/utils/globals.ts'; // before this script was introduced but could not be retrieved by this process. const SPECIALS = ['global', 'globalThis', 'InternalError', 'process', 'undefined']; -const get_url = (name) => `https://raw.githubusercontent.com/microsoft/TypeScript/main/lib/lib.${name}.d.ts`; +const get_url = (name) => + `https://raw.githubusercontent.com/microsoft/TypeScript/main/lib/lib.${name}.d.ts`; const extract_name = (split) => split.match(/^[a-zA-Z0-9_$]+/)[0]; const extract_functions_and_references = (name, data) => { const functions = []; const references = []; - data.split('\n').forEach(line => { + data.split('\n').forEach((line) => { const trimmed = line.trim(); const split = trimmed.replace(/[\s+]/, ' ').split(' '); if (split[0] === 'declare' && split[1] !== 'type') { @@ -35,17 +36,20 @@ const extract_functions_and_references = (name, data) => { return { functions, references }; }; -const do_get = (url) => new Promise((resolve, reject) => { - http.get(url, (res) => { - let body = ''; - res.setEncoding('utf8'); - res.on('data', (chunk) => body += chunk); - res.on('end', () => resolve(body)); - }).on('error', (e) => { - console.error(e.message); - reject(e); +const do_get = (url) => + new Promise((resolve, reject) => { + http + .get(url, (res) => { + let body = ''; + res.setEncoding('utf8'); + res.on('data', (chunk) => (body += chunk)); + res.on('end', () => resolve(body)); + }) + .on('error', (e) => { + console.error(e.message); + reject(e); + }); }); -}); const fetched_names = new Set(); const get_functions = async (name) => { @@ -56,7 +60,7 @@ const get_functions = async (name) => { const { functions, references } = extract_functions_and_references(name, body); res.push(...functions); const chile_functions = await Promise.all(references.map(get_functions)); - chile_functions.forEach(i => res.push(...i)); + chile_functions.forEach((i) => res.push(...i)); return res; }; @@ -76,10 +80,11 @@ ${sorted.map((i) => `\t'${i}'`).join(',\n')} const get_exists_globals = () => { const regexp = /^\s*["'](.+)["'],?\s*$/; - return fs.readFileSync(GLOBAL_TS_PATH, 'utf8') + return fs + .readFileSync(GLOBAL_TS_PATH, 'utf8') .split('\n') - .filter(line => line.match(regexp)) - .map(line => line.match(regexp)[1]); + .filter((line) => line.match(regexp)) + .map((line) => line.match(regexp)[1]); }; (async () => { diff --git a/src/compiler/Stats.ts b/src/compiler/Stats.ts index 200fa448e9..e22c18e0f0 100644 --- a/src/compiler/Stats.ts +++ b/src/compiler/Stats.ts @@ -1,9 +1,10 @@ -const now = (typeof process !== 'undefined' && process.hrtime) - ? () => { - const t = process.hrtime(); - return t[0] * 1e3 + t[1] / 1e6; - } - : () => self.performance.now(); +const now = + typeof process !== 'undefined' && process.hrtime + ? () => { + const t = process.hrtime(); + return t[0] * 1e3 + t[1] / 1e6; + } + : () => self.performance.now(); interface Timing { label: string; @@ -14,10 +15,13 @@ interface Timing { function collapse_timings(timings) { const result = {}; - timings.forEach(timing => { - result[timing.label] = Object.assign({ - total: timing.end - timing.start - }, timing.children && collapse_timings(timing.children)); + timings.forEach((timing) => { + result[timing.label] = Object.assign( + { + total: timing.end - timing.start + }, + timing.children && collapse_timings(timing.children) + ); }); return result; } @@ -52,7 +56,9 @@ export default class Stats { stop(label) { if (label !== this.current_timing.label) { - throw new Error(`Mismatched timing labels (expected ${this.current_timing.label}, got ${label})`); + throw new Error( + `Mismatched timing labels (expected ${this.current_timing.label}, got ${label})` + ); } this.current_timing.end = now(); @@ -62,9 +68,12 @@ export default class Stats { } render() { - const timings = Object.assign({ - total: now() - this.start_time - }, collapse_timings(this.timings)); + const timings = Object.assign( + { + total: now() - this.start_time + }, + collapse_timings(this.timings) + ); return { timings diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 37f6388d42..22a8b46af6 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -6,12 +6,7 @@ import { reserved, is_valid } from '../utils/names'; import globals from '../utils/globals'; import { namespaces, valid_namespaces } from '../utils/namespaces'; import create_module from './create_module'; -import { - create_scopes, - extract_names, - Scope, - extract_identifiers -} from './utils/scope'; +import { create_scopes, extract_names, Scope, extract_identifiers } from './utils/scope'; import Stylesheet from './css/Stylesheet'; import { test } from '../config'; import Fragment from './nodes/Fragment'; @@ -26,7 +21,25 @@ import TemplateScope from './nodes/shared/TemplateScope'; import fuzzymatch from '../utils/fuzzymatch'; import get_object from './utils/get_object'; import Slot from './nodes/Slot'; -import { Node, ImportDeclaration, ExportNamedDeclaration, Identifier, ExpressionStatement, AssignmentExpression, Literal, Property, RestElement, ExportDefaultDeclaration, ExportAllDeclaration, FunctionDeclaration, FunctionExpression, VariableDeclarator, ObjectExpression, Pattern, Expression } from 'estree'; +import { + Node, + ImportDeclaration, + ExportNamedDeclaration, + Identifier, + ExpressionStatement, + AssignmentExpression, + Literal, + Property, + RestElement, + ExportDefaultDeclaration, + ExportAllDeclaration, + FunctionDeclaration, + FunctionExpression, + VariableDeclarator, + ObjectExpression, + Pattern, + Expression +} from 'estree'; import add_to_set from './utils/add_to_set'; import check_graph_for_cycles from './utils/check_graph_for_cycles'; import { print, b } from 'code-red'; @@ -36,7 +49,10 @@ import Element from './nodes/Element'; import { clone } from '../utils/clone'; import compiler_warnings from './compiler_warnings'; import compiler_errors from './compiler_errors'; -import { extract_ignores_above_position, extract_svelte_ignore_from_comments } from '../utils/extract_svelte_ignore'; +import { + extract_ignores_above_position, + extract_svelte_ignore_from_comments +} from '../utils/extract_svelte_ignore'; import check_enable_sourcemap from './utils/check_enable_sourcemap'; import Tag from './nodes/shared/Tag'; @@ -48,7 +64,14 @@ interface ComponentOptions { customElement?: { tag: string | null; shadow?: 'open' | 'none'; - props?: Record; + props?: Record< + string, + { + attribute?: string; + reflect?: boolean; + type?: 'String' | 'Boolean' | 'Number' | 'Array' | 'Object'; + } + >; }; } @@ -86,8 +109,8 @@ export default class Component { hoistable_nodes: Set = new Set(); node_for_declaration: Map = new Map(); - partly_hoisted: Array<(Node | Node[])> = []; - fully_hoisted: Array<(Node | Node[])> = []; + partly_hoisted: Array = []; + fully_hoisted: Array = []; reactive_declarations: Array<{ assignees: Set; dependencies: Set; @@ -146,8 +169,8 @@ export default class Component { compile_options.filename && (typeof process !== 'undefined' ? compile_options.filename - .replace(process.cwd(), '') - .replace(regex_leading_directory_separator, '') + .replace(process.cwd(), '') + .replace(regex_leading_directory_separator, '') : compile_options.filename); this.locate = getLocator(this.source, { offsetLine: 1 }); @@ -162,13 +185,9 @@ export default class Component { }); this.stylesheet.validate(this); - this.component_options = process_component_options( - this, - this.ast.html.children - ); + this.component_options = process_component_options(this, this.ast.html.children); this.namespace = - namespaces[this.component_options.namespace] || - this.component_options.namespace; + namespaces[this.component_options.namespace] || this.component_options.namespace; if (compile_options.customElement) { this.tag = this.component_options.customElement?.tag || compile_options.tag || this.name.name; @@ -178,18 +197,26 @@ export default class Component { this.walk_module_js(); - this.push_ignores(this.ast.instance ? extract_ignores_above_position(this.ast.instance.start, this.ast.html.children) : []); + this.push_ignores( + this.ast.instance + ? extract_ignores_above_position(this.ast.instance.start, this.ast.html.children) + : [] + ); this.walk_instance_js_pre_template(); this.pop_ignores(); this.fragment = new Fragment(this, ast.html); this.name = this.get_unique_name(name); - this.push_ignores(this.ast.instance ? extract_ignores_above_position(this.ast.instance.start, this.ast.html.children) : []); + this.push_ignores( + this.ast.instance + ? extract_ignores_above_position(this.ast.instance.start, this.ast.html.children) + : [] + ); this.walk_instance_js_post_template(); this.pop_ignores(); - this.elements.forEach(element => this.stylesheet.apply(element)); + this.elements.forEach((element) => this.stylesheet.apply(element)); this.stylesheet.reify(); this.stylesheet.warn_on_unused_selectors(this); } @@ -341,17 +368,15 @@ export default class Component { referenced_globals, this.imports, this.vars - .filter(variable => variable.module && variable.export_name) - .map(variable => ({ + .filter((variable) => variable.module && variable.export_name) + .map((variable) => ({ name: variable.name, as: variable.export_name })), this.exports_from ); - css = compile_options.customElement - ? { code: null, map: null } - : result.css; + css = compile_options.customElement ? { code: null, map: null } : result.css; const js_sourcemap_enabled = check_enable_sourcemap(compile_options.enableSourcemap, 'js'); @@ -365,15 +390,15 @@ export default class Component { sourceMapSource: sourcemap_source_filename }); - js.map.sources = [ - sourcemap_source_filename - ]; + js.map.sources = [sourcemap_source_filename]; - js.map.sourcesContent = [ - this.source - ]; + js.map.sourcesContent = [this.source]; - js.map = apply_preprocessor_sourcemap(sourcemap_source_filename, js.map, compile_options.sourcemap as (string | RawSourceMap | DecodedSourceMap)); + js.map = apply_preprocessor_sourcemap( + sourcemap_source_filename, + js.map, + compile_options.sourcemap as string | RawSourceMap | DecodedSourceMap + ); } } @@ -435,13 +460,14 @@ export default class Component { get_vars_report(): Var[] { const { compile_options, vars } = this; - const vars_report = compile_options.varsReport === false - ? [] - : compile_options.varsReport === 'full' + const vars_report = + compile_options.varsReport === false + ? [] + : compile_options.varsReport === 'full' ? vars - : vars.filter(v => !v.global && !v.internal); + : vars.filter((v) => !v.global && !v.internal); - return vars_report.map(v => ({ + return vars_report.map((v) => ({ name: v.name, export_name: v.export_name || null, injected: v.injected || false, @@ -505,8 +531,7 @@ export default class Component { end, pos: pos.start, filename: this.compile_options.filename, - toString: () => - `${warning.message} (${start.line}:${start.column})\n${frame}` + toString: () => `${warning.message} (${start.line}:${start.column})\n${frame}` }); } @@ -522,7 +547,10 @@ export default class Component { return result; } - private _extract_exports(node: ExportDefaultDeclaration | ExportNamedDeclaration | ExportAllDeclaration, module_script: boolean) { + private _extract_exports( + node: ExportDefaultDeclaration | ExportNamedDeclaration | ExportAllDeclaration, + module_script: boolean + ) { if (node.type === 'ExportDefaultDeclaration') { return this.error(node as any, compiler_errors.default_export); } @@ -538,15 +566,25 @@ export default class Component { } if (node.declaration) { if (node.declaration.type === 'VariableDeclaration') { - node.declaration.declarations.forEach(declarator => { - extract_names(declarator.id).forEach(name => { + node.declaration.declarations.forEach((declarator) => { + extract_names(declarator.id).forEach((name) => { const variable = this.var_lookup.get(name); variable.export_name = name; - if (declarator.init?.type === 'Literal' && typeof declarator.init.value === 'boolean') { + if ( + declarator.init?.type === 'Literal' && + typeof declarator.init.value === 'boolean' + ) { variable.is_boolean = true; } - if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) { - this.warn(declarator as any, compiler_warnings.unused_export_let(this.name.name, name)); + if ( + !module_script && + variable.writable && + !(variable.referenced || variable.referenced_from_script || variable.subscribable) + ) { + this.warn( + declarator as any, + compiler_warnings.unused_export_let(this.name.name, name) + ); } }); }); @@ -559,14 +597,21 @@ export default class Component { return node.declaration; } else { - node.specifiers.forEach(specifier => { + node.specifiers.forEach((specifier) => { const variable = this.var_lookup.get(specifier.local.name); if (variable) { variable.export_name = specifier.exported.name; - if (!module_script && variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) { - this.warn(specifier as any, compiler_warnings.unused_export_let(this.name.name, specifier.exported.name)); + if ( + !module_script && + variable.writable && + !(variable.referenced || variable.referenced_from_script || variable.subscribable) + ) { + this.warn( + specifier as any, + compiler_warnings.unused_export_let(this.name.name, specifier.exported.name) + ); } } }); @@ -579,7 +624,7 @@ export default class Component { extract_javascript(script) { if (!script) return null; - return script.content.body.filter(node => { + return script.content.body.filter((node) => { if (!node) return false; if (this.hoistable_nodes.has(node)) return false; if (this.reactive_declaration_nodes.has(node)) return false; @@ -610,7 +655,8 @@ export default class Component { return this.error(node as any, compiler_errors.illegal_declaration); } - const writable = node.type === 'VariableDeclaration' && (node.kind === 'var' || node.kind === 'let'); + const writable = + node.type === 'VariableDeclaration' && (node.kind === 'var' || node.kind === 'let'); const imported = node.type.startsWith('Import'); this.add_var(node, { @@ -659,7 +705,7 @@ export default class Component { if (!script) return; // inject vars for reactive declarations - script.content.body.forEach(node => { + script.content.body.forEach((node) => { if (node.type !== 'LabeledStatement') return; if (node.body.type !== 'ExpressionStatement') return; @@ -667,16 +713,14 @@ export default class Component { if (expression.type !== 'AssignmentExpression') return; if (expression.left.type === 'MemberExpression') return; - extract_names(expression.left).forEach(name => { + extract_names(expression.left).forEach((name) => { if (!this.var_lookup.has(name) && name[0] !== '$') { this.injected_reactive_declaration_vars.add(name); } }); }); - const { scope: instance_scope, map, globals } = create_scopes( - script.content - ); + const { scope: instance_scope, map, globals } = create_scopes(script.content); this.instance_scope = instance_scope; this.instance_scope_map = map; @@ -685,7 +729,8 @@ export default class Component { return this.error(node as any, compiler_errors.illegal_declaration); } - const writable = node.type === 'VariableDeclaration' && (node.kind === 'var' || node.kind === 'let'); + const writable = + node.type === 'VariableDeclaration' && (node.kind === 'var' || node.kind === 'let'); const imported = node.type.startsWith('Import'); this.add_var(node, { @@ -702,11 +747,11 @@ export default class Component { // as `$store` will mark `store` variable as referenced and subscribable const global_keys = Array.from(globals.keys()); const sorted_globals = [ - ...global_keys.filter(key => key[0] !== '$'), - ...global_keys.filter(key => key[0] === '$') + ...global_keys.filter((key) => key[0] !== '$'), + ...global_keys.filter((key) => key[0] === '$') ]; - sorted_globals.forEach(name => { + sorted_globals.forEach((name) => { if (this.var_lookup.has(name)) return; const node = globals.get(name); @@ -786,8 +831,8 @@ export default class Component { walk(content, { enter(node: Node, parent: Node, prop, index) { - if ((node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression')) { - current_function_stack.push(current_function = node); + if (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') { + current_function_stack.push((current_function = node)); } if (map.has(node)) { @@ -801,18 +846,18 @@ export default class Component { if (node.left.type === 'ArrayPattern') { walk(node.left, { enter(node: Node, parent: Node) { - if (node.type === 'Identifier' && + if ( + node.type === 'Identifier' && parent.type !== 'MemberExpression' && - (parent.type !== 'AssignmentPattern' || parent.right !== node)) { - names.push(node.name); + (parent.type !== 'AssignmentPattern' || parent.right !== node) + ) { + names.push(node.name); } } }); } else { deep = node.left.type === 'MemberExpression'; - names = deep - ? [get_object(node.left).name] - : extract_names(node.left); + names = deep ? [get_object(node.left).name] : extract_names(node.left); } } else if (node.type === 'UpdateExpression') { deep = node.argument.type === 'MemberExpression'; @@ -820,7 +865,7 @@ export default class Component { names.push(name); } if (names.length > 0) { - names.forEach(name => { + names.forEach((name) => { let current_scope = scope; let declaration; @@ -863,14 +908,22 @@ export default class Component { }, leave(node: Node) { - if ((node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression')) { + if (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') { current_function_stack.pop(); current_function = current_function_stack[current_function_stack.length - 1]; } // do it on leave, to prevent infinite loop - if (component.compile_options.dev && component.compile_options.loopGuardTimeout > 0 && (!current_function || (!current_function.generator && !current_function.async))) { - const to_replace_for_loop_protect = component.loop_protect(node, scope, component.compile_options.loopGuardTimeout); + if ( + component.compile_options.dev && + component.compile_options.loopGuardTimeout > 0 && + (!current_function || (!current_function.generator && !current_function.async)) + ) { + const to_replace_for_loop_protect = component.loop_protect( + node, + scope, + component.compile_options.loopGuardTimeout + ); if (to_replace_for_loop_protect) { this.replace(to_replace_for_loop_protect); scope_updated = true; @@ -922,7 +975,7 @@ export default class Component { const deep = assignee.type === 'MemberExpression'; - names.forEach(name => { + names.forEach((name) => { const scope_owner = scope.find_owner(name); if ( scope_owner !== null @@ -952,12 +1005,13 @@ export default class Component { }); } - warn_on_undefined_store_value_references(node: Node, parent: Node, prop: string | number | symbol, scope: Scope) { - if ( - node.type === 'LabeledStatement' && - node.label.name === '$' && - parent.type !== 'Program' - ) { + warn_on_undefined_store_value_references( + node: Node, + parent: Node, + prop: string | number | symbol, + scope: Scope + ) { + if (node.type === 'LabeledStatement' && node.label.name === '$' && parent.type !== 'Program') { this.warn(node as any, compiler_warnings.non_top_level_reactive_declaration); } @@ -970,8 +1024,17 @@ export default class Component { this.warn_if_undefined(name, object, null); } - if (name[1] !== '$' && scope.has(name.slice(1)) && scope.find_owner(name.slice(1)) !== this.instance_scope) { - if (!((regex_contains_term_function.test(parent.type) && prop === 'params') || (parent.type === 'VariableDeclarator' && prop === 'id'))) { + if ( + name[1] !== '$' && + scope.has(name.slice(1)) && + scope.find_owner(name.slice(1)) !== this.instance_scope + ) { + if ( + !( + (regex_contains_term_function.test(parent.type) && prop === 'params') || + (parent.type === 'VariableDeclarator' && prop === 'id') + ) + ) { return this.error(node as any, compiler_errors.contextual_store); } } @@ -980,9 +1043,11 @@ export default class Component { } loop_protect(node, scope: Scope, timeout: number): Node | null { - if (node.type === 'WhileStatement' || + if ( + node.type === 'WhileStatement' || node.type === 'ForStatement' || - node.type === 'DoWhileStatement') { + node.type === 'DoWhileStatement' + ) { const guard = this.get_unique_name('guard', scope); this.used_names.add(guard.name); @@ -1000,10 +1065,7 @@ export default class Component { return { type: 'BlockStatement', - body: [ - before[0], - node - ] + body: [before[0], node] }; } return null; @@ -1036,7 +1098,11 @@ export default class Component { const inserts = []; const props = []; - function add_new_props(exported: Identifier, local: Pattern, default_value: Expression) { + function add_new_props( + exported: Identifier, + local: Pattern, + default_value: Expression + ) { props.push({ type: 'Property', method: false, @@ -1046,10 +1112,10 @@ export default class Component { key: exported, value: default_value ? { - type: 'AssignmentPattern', - left: local, - right: default_value - } + type: 'AssignmentPattern', + left: local, + right: default_value + } : local }); } @@ -1074,7 +1140,11 @@ export default class Component { if (variable.export_name && variable.writable) { const alias_name = component.get_unique_name(local.name); - add_new_props({ type: 'Identifier', name: variable.export_name }, local, alias_name); + add_new_props( + { type: 'Identifier', name: variable.export_name }, + local, + alias_name + ); return alias_name; } return local; @@ -1097,7 +1167,11 @@ export default class Component { break; } case 'ArrayPattern': { - const handle_element = (element: Pattern | null, index: number, array: Array) => { + const handle_element = ( + element: Pattern | null, + index: number, + array: Array + ) => { if (element) { if (element.type === 'Identifier') { array[index] = get_new_name(element); @@ -1135,7 +1209,11 @@ export default class Component { const variable = component.var_lookup.get(name); const is_props = variable.export_name && variable.writable; if (is_props) { - add_new_props({ type: 'Identifier', name: variable.export_name }, declarator.id, declarator.init); + add_new_props( + { type: 'Identifier', name: variable.export_name }, + declarator.id, + declarator.init + ); node.declarations.splice(index--, 1); } if (variable.subscribable && (is_props || declarator.init)) { @@ -1144,11 +1222,13 @@ export default class Component { } } - this.replace(b` + this.replace( + b` ${node.declarations.length ? node : null} - ${ props.length > 0 && b`let { ${props} } = $$props;`} + ${props.length > 0 && b`let { ${props} } = $$props;`} ${inserts} - ` as any); + ` as any + ); return this.skip(); } } @@ -1168,12 +1248,7 @@ export default class Component { // reference instance variables other than other // hoistable functions. TODO others? - const { - hoistable_nodes, - var_lookup, - injected_reactive_declaration_vars, - imports - } = this; + const { hoistable_nodes, var_lookup, injected_reactive_declaration_vars, imports } = this; const top_level_function_declarations = new Map(); @@ -1183,7 +1258,7 @@ export default class Component { const node = body[i]; if (node.type === 'VariableDeclaration') { - const all_hoistable = node.declarations.every(d => { + const all_hoistable = node.declarations.every((d) => { if (!d.init) return false; if (d.init.type !== 'Literal') return false; @@ -1198,11 +1273,7 @@ export default class Component { if (v.export_name) return false; if (this.var_lookup.get(name).reassigned) return false; - if ( - this.vars.find( - variable => variable.name === name && variable.module - ) - ) { + if (this.vars.find((variable) => variable.name === name && variable.module)) { return false; } @@ -1210,7 +1281,7 @@ export default class Component { }); if (all_hoistable) { - node.declarations.forEach(d => { + node.declarations.forEach((d) => { const variable = this.var_lookup.get((d.id as Identifier).name); variable.hoistable = true; }); @@ -1238,7 +1309,7 @@ export default class Component { const checked = new Set(); const walking = new Set(); - const is_hoistable = fn_declaration => { + const is_hoistable = (fn_declaration) => { if (fn_declaration.type === 'ExportNamedDeclaration') { fn_declaration = fn_declaration.declaration; } @@ -1260,7 +1331,9 @@ export default class Component { scope = map.get(node); } - if (is_reference(node as NodeWithPropertyDefinition, parent as NodeWithPropertyDefinition)) { + if ( + is_reference(node as NodeWithPropertyDefinition, parent as NodeWithPropertyDefinition) + ) { const { name } = flatten_reference(node); const owner = scope.find_owner(name); @@ -1278,9 +1351,7 @@ export default class Component { if (variable.hoistable) return; if (top_level_function_declarations.has(name)) { - const other_declaration = top_level_function_declarations.get( - name - ); + const other_declaration = top_level_function_declarations.get(name); if (walking.has(other_declaration)) { hoistable = false; @@ -1347,7 +1418,7 @@ export default class Component { declaration: Node; }> = []; - this.ast.instance.content.body.forEach(node => { + this.ast.instance.content.body.forEach((node) => { const ignores = extract_svelte_ignore_from_comments(node); if (ignores.length) this.push_ignores(ignores); @@ -1384,7 +1455,7 @@ export default class Component { if (node.type === 'AssignmentExpression') { const left = get_object(node.left); - extract_identifiers(left).forEach(node => { + extract_identifiers(left).forEach((node) => { assignee_nodes.add(node); assignees.add(node.name); }); @@ -1395,7 +1466,9 @@ export default class Component { } else if (node.type === 'UpdateExpression') { const identifier = get_object(node.argument); assignees.add(identifier.name); - } else if (is_reference(node as NodeWithPropertyDefinition, parent as NodeWithPropertyDefinition)) { + } else if ( + is_reference(node as NodeWithPropertyDefinition, parent as NodeWithPropertyDefinition) + ) { const identifier = get_object(node); if (!assignee_nodes.has(identifier)) { const { name } = identifier; @@ -1410,8 +1483,7 @@ export default class Component { module_dependencies.add(name); } } - const is_writable_or_mutated = - variable && (variable.writable || variable.mutated); + const is_writable_or_mutated = variable && (variable.writable || variable.mutated); if ( should_add_as_dependency && (!owner || owner === component.instance_scope) && @@ -1433,7 +1505,12 @@ export default class Component { }); if (module_dependencies.size > 0 && dependencies.size === 0) { - component.warn(node.body as any, compiler_warnings.module_script_variable_reactive_declaration(Array.from(module_dependencies))); + component.warn( + node.body as any, + compiler_warnings.module_script_variable_reactive_declaration( + Array.from(module_dependencies) + ) + ); } const { expression } = node.body as ExpressionStatement; @@ -1452,8 +1529,8 @@ export default class Component { const lookup = new Map(); - unsorted_reactive_declarations.forEach(declaration => { - declaration.assignees.forEach(name => { + unsorted_reactive_declarations.forEach((declaration) => { + declaration.assignees.forEach((name) => { if (!lookup.has(name)) { lookup.set(name, []); } @@ -1464,16 +1541,18 @@ export default class Component { }); }); - const cycle = check_graph_for_cycles(unsorted_reactive_declarations.reduce((acc, declaration) => { - declaration.assignees.forEach(v => { - declaration.dependencies.forEach(w => { - if (!declaration.assignees.has(w)) { - acc.push([v, w]); - } + const cycle = check_graph_for_cycles( + unsorted_reactive_declarations.reduce((acc, declaration) => { + declaration.assignees.forEach((v) => { + declaration.dependencies.forEach((w) => { + if (!declaration.assignees.has(w)) { + acc.push([v, w]); + } + }); }); - }); - return acc; - }, [])); + return acc; + }, []) + ); if (cycle && cycle.length) { const declarationList = lookup.get(cycle[0]); @@ -1481,10 +1560,10 @@ export default class Component { return this.error(declaration.node, compiler_errors.cyclical_reactive_declaration(cycle)); } - const add_declaration = declaration => { + const add_declaration = (declaration) => { if (this.reactive_declarations.includes(declaration)) return; - declaration.dependencies.forEach(name => { + declaration.dependencies.forEach((name) => { if (declaration.assignees.has(name)) return; const earlier_declarations = lookup.get(name); if (earlier_declarations) { @@ -1499,14 +1578,14 @@ export default class Component { } check_if_tags_content_dynamic() { - this.tags.forEach(tag => { + this.tags.forEach((tag) => { tag.check_if_content_dynamic(); }); } warn_if_undefined(name: string, node, template_scope: TemplateScope) { if (name[0] === '$') { - if (name === '$' || name[1] === '$' && !is_reserved_keyword(name)) { + if (name === '$' || (name[1] === '$' && !is_reserved_keyword(name))) { return this.error(node, compiler_errors.illegal_global(name)); } @@ -1549,7 +1628,7 @@ function process_component_options(component: Component, nodes) { namespace: component.compile_options.namespace }; - const node = nodes.find(node => node.name === 'svelte:options'); + const node = nodes.find((node) => node.name === 'svelte:options'); function get_value(attribute, { code, message }) { const { value } = attribute; @@ -1571,7 +1650,7 @@ function process_component_options(component: Component, nodes) { } if (node) { - node.attributes.forEach(attribute => { + node.attributes.forEach((attribute) => { if (attribute.type === 'Attribute') { const { name } = attribute; @@ -1588,7 +1667,7 @@ function process_component_options(component: Component, nodes) { component.warn(attribute, compiler_warnings.missing_custom_element_compile_options); } - component_options.customElement = component_options.customElement || {} as any; + component_options.customElement = component_options.customElement || ({} as any); component_options.customElement.tag = tag; } @@ -1600,7 +1679,7 @@ function process_component_options(component: Component, nodes) { } case 'customElement': { - component_options.customElement = component_options.customElement || {} as any; + component_options.customElement = component_options.customElement || ({} as any); const { value } = attribute; @@ -1614,9 +1693,7 @@ function process_component_options(component: Component, nodes) { return component.error(attribute, compiler_errors.invalid_customElement_attribute); } - const tag = value[0].expression.properties.find( - (prop: any) => prop.key.name === 'tag' - ); + const tag = value[0].expression.properties.find((prop: any) => prop.key.name === 'tag'); if (tag) { parse_tag(tag, tag.value?.value); } else { @@ -1627,7 +1704,8 @@ function process_component_options(component: Component, nodes) { (prop: any) => prop.key.name === 'props' ); if (props) { - const error = () => component.error(attribute, compiler_errors.invalid_props_attribute); + const error = () => + component.error(attribute, compiler_errors.invalid_props_attribute); if (props.value?.type !== 'ObjectExpression') { return error(); } @@ -1635,22 +1713,37 @@ function process_component_options(component: Component, nodes) { component_options.customElement.props = {}; for (const property of (props.value as ObjectExpression).properties) { - if (property.type !== 'Property' || property.computed || property.key.type !== 'Identifier' || property.value.type !== 'ObjectExpression') { + if ( + property.type !== 'Property' || + property.computed || + property.key.type !== 'Identifier' || + property.value.type !== 'ObjectExpression' + ) { return error(); } component_options.customElement.props[property.key.name] = {}; for (const prop of property.value.properties) { - if (prop.type !== 'Property' || prop.computed || prop.key.type !== 'Identifier' || prop.value.type !== 'Literal') { + if ( + prop.type !== 'Property' || + prop.computed || + prop.key.type !== 'Identifier' || + prop.value.type !== 'Literal' + ) { return error(); } - if (['reflect', 'attribute', 'type'].indexOf(prop.key.name) === -1 || - prop.key.name === 'type' && ['String', 'Number', 'Boolean', 'Array', 'Object'].indexOf(prop.value.value as string) === -1 || - prop.key.name === 'reflect' && typeof prop.value.value !== 'boolean' || - prop.key.name === 'attribute' && typeof prop.value.value !== 'string' + if ( + ['reflect', 'attribute', 'type'].indexOf(prop.key.name) === -1 || + (prop.key.name === 'type' && + ['String', 'Number', 'Boolean', 'Array', 'Object'].indexOf( + prop.value.value as string + ) === -1) || + (prop.key.name === 'reflect' && typeof prop.value.value !== 'boolean') || + (prop.key.name === 'attribute' && typeof prop.value.value !== 'string') ) { return error(); } - component_options.customElement.props[property.key.name][prop.key.name] = prop.value.value; + component_options.customElement.props[property.key.name][prop.key.name] = + prop.value.value; } } } @@ -1680,7 +1773,10 @@ function process_component_options(component: Component, nodes) { if (valid_namespaces.indexOf(ns) === -1) { const match = fuzzymatch(ns, valid_namespaces); - return component.error(attribute, compiler_errors.invalid_namespace_property(ns, match)); + return component.error( + attribute, + compiler_errors.invalid_namespace_property(ns, match) + ); } component_options.namespace = ns; @@ -1701,7 +1797,10 @@ function process_component_options(component: Component, nodes) { } default: - return component.error(attribute, compiler_errors.invalid_options_attribute_unknown(name)); + return component.error( + attribute, + compiler_errors.invalid_options_attribute_unknown(name) + ); } } else { return component.error(attribute, compiler_errors.invalid_options_attribute); diff --git a/src/compiler/compile/compiler_errors.ts b/src/compiler/compile/compiler_errors.ts index 6b891d2574..40c5758842 100644 --- a/src/compiler/compile/compiler_errors.ts +++ b/src/compiler/compile/compiler_errors.ts @@ -22,7 +22,9 @@ export default { }), invalid_binding_no_checkbox: (binding: string, is_radio: boolean) => ({ code: 'invalid-binding', - message: `'${binding}' binding can only be used with ` + (is_radio ? ' — for , use \'group\' binding' : '') + message: + `'${binding}' binding can only be used with ` + + (is_radio ? ' — for , use \'group\' binding' : '') }), invalid_binding: (binding: string) => ({ code: 'invalid-binding', @@ -30,7 +32,9 @@ export default { }), invalid_binding_window: (parts: string[]) => ({ code: 'invalid-binding', - message: `Bindings on must be to top-level properties, e.g. '${parts[parts.length - 1]}' rather than '${parts.join('.')}'` + message: `Bindings on must be to top-level properties, e.g. '${ + parts[parts.length - 1] + }' rather than '${parts.join('.')}'` }), invalid_binding_let: { code: 'invalid-binding', @@ -54,23 +58,24 @@ export default { }), invalid_type: { code: 'invalid-type', - message: '\'type\' attribute cannot be dynamic if input uses two-way binding' + message: "'type' attribute cannot be dynamic if input uses two-way binding" }, missing_type: { code: 'missing-type', - message: '\'type\' attribute must be specified' + message: "'type' attribute must be specified" }, dynamic_multiple_attribute: { code: 'dynamic-multiple-attribute', - message: '\'multiple\' attribute cannot be dynamic if select uses two-way binding' + message: "'multiple' attribute cannot be dynamic if select uses two-way binding" }, missing_contenteditable_attribute: { code: 'missing-contenteditable-attribute', - message: '\'contenteditable\' attribute is required for textContent, innerHTML and innerText two-way bindings' + message: + "'contenteditable' attribute is required for textContent, innerHTML and innerText two-way bindings" }, dynamic_contenteditable_attribute: { code: 'dynamic-contenteditable-attribute', - message: '\'contenteditable\' attribute cannot be dynamic if element uses two-way binding' + message: "'contenteditable' attribute cannot be dynamic if element uses two-way binding" }, invalid_event_modifier_combination: (modifier1: string, modifier2: string) => ({ code: 'invalid-event-modifier', @@ -90,7 +95,8 @@ export default { }, textarea_duplicate_value: { code: 'textarea-duplicate-value', - message: 'A ', - ssrHtml: '' + ssrHtml: + "" }; diff --git a/test/runtime/samples/attribute-namespaced/_config.js b/test/runtime/samples/attribute-namespaced/_config.js index f3a7f28a93..4800efb696 100644 --- a/test/runtime/samples/attribute-namespaced/_config.js +++ b/test/runtime/samples/attribute-namespaced/_config.js @@ -8,7 +8,7 @@ export default { `, test({ assert, target }) { - const use = target.querySelector( 'use' ); - assert.equal( use.getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' ), '#bar' ); + const use = target.querySelector('use'); + assert.equal(use.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), '#bar'); } }; diff --git a/test/runtime/samples/attribute-prefer-expression/_config.js b/test/runtime/samples/attribute-prefer-expression/_config.js index 22bed8a6bc..67d212076b 100644 --- a/test/runtime/samples/attribute-prefer-expression/_config.js +++ b/test/runtime/samples/attribute-prefer-expression/_config.js @@ -1,5 +1,4 @@ export default { - props: { foo: false }, diff --git a/test/runtime/samples/attribute-static-boolean/_config.js b/test/runtime/samples/attribute-static-boolean/_config.js index 2d31b26747..87857fd605 100644 --- a/test/runtime/samples/attribute-static-boolean/_config.js +++ b/test/runtime/samples/attribute-static-boolean/_config.js @@ -1,7 +1,7 @@ export default { html: '', test({ assert, target }) { - const textarea = target.querySelector( 'textarea' ); - assert.ok( textarea.readOnly ); + const textarea = target.querySelector('textarea'); + assert.ok(textarea.readOnly); } }; diff --git a/test/runtime/samples/attribute-url/_config.js b/test/runtime/samples/attribute-url/_config.js index 28bc1bcb0c..48227d0106 100644 --- a/test/runtime/samples/attribute-url/_config.js +++ b/test/runtime/samples/attribute-url/_config.js @@ -1,8 +1,8 @@ export default { test({ assert, target }) { - const div = target.querySelector( 'div' ); + const div = target.querySelector('div'); - assert.equal( div.style.backgroundImage, 'url(https://example.com/foo.jpg)'); - assert.equal( div.style.color, 'red' ); + assert.equal(div.style.backgroundImage, 'url(https://example.com/foo.jpg)'); + assert.equal(div.style.color, 'red'); } }; diff --git a/test/runtime/samples/autofocus/_config.js b/test/runtime/samples/autofocus/_config.js index b0131f8bfe..f9873b5b66 100644 --- a/test/runtime/samples/autofocus/_config.js +++ b/test/runtime/samples/autofocus/_config.js @@ -6,19 +6,31 @@ export default { assert.equal(target.querySelector('input[title="default"]'), window.document.activeElement); component.active = 'dynamic-false'; - assert.notEqual(target.querySelector('input[title="dynamic-false"]'), window.document.activeElement); + assert.notEqual( + target.querySelector('input[title="dynamic-false"]'), + window.document.activeElement + ); // when dynamically set autofocus to true, don't autofocus component.autofocusFalse = true; - assert.notEqual(target.querySelector('input[title="dynamic-false"]'), window.document.activeElement); + assert.notEqual( + target.querySelector('input[title="dynamic-false"]'), + window.document.activeElement + ); component.active = 'dynamic-true'; - assert.equal(target.querySelector('input[title="dynamic-true"]'), window.document.activeElement); + assert.equal( + target.querySelector('input[title="dynamic-true"]'), + window.document.activeElement + ); component.active = 'spread'; assert.equal(target.querySelector('input[title="spread"]'), window.document.activeElement); component.active = 'spread-override'; - assert.notEqual(target.querySelector('input[title="spread-override"]'), window.document.activeElement); + assert.notEqual( + target.querySelector('input[title="spread-override"]'), + window.document.activeElement + ); } }; diff --git a/test/runtime/samples/await-catch-no-expression/_config.js b/test/runtime/samples/await-catch-no-expression/_config.js index 5274e60e2d..67710eb913 100644 --- a/test/runtime/samples/await-catch-no-expression/_config.js +++ b/test/runtime/samples/await-catch-no-expression/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -29,19 +29,25 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the promise is pending

- `); + ` + ); reject(new Error()); await thePromise.catch(() => {}); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

oh no! Something broke!


oh no! Something broke!

- `); + ` + ); } }; diff --git a/test/runtime/samples/await-catch-shorthand/_config.js b/test/runtime/samples/await-catch-shorthand/_config.js index fc65773107..3947a34416 100644 --- a/test/runtime/samples/await-catch-shorthand/_config.js +++ b/test/runtime/samples/await-catch-shorthand/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -33,9 +33,12 @@ export default { return thePromise.catch(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

oh no! something broke

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-component-oncreate/_config.js b/test/runtime/samples/await-component-oncreate/_config.js index 1de86c9f44..a695777fde 100644 --- a/test/runtime/samples/await-component-oncreate/_config.js +++ b/test/runtime/samples/await-component-oncreate/_config.js @@ -7,10 +7,13 @@ export default { test({ assert, target }) { return promise.then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

42

true

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-conservative-update/_config.js b/test/runtime/samples/await-conservative-update/_config.js index c548a400af..eed0493997 100644 --- a/test/runtime/samples/await-conservative-update/_config.js +++ b/test/runtime/samples/await-conservative-update/_config.js @@ -7,10 +7,13 @@ export default { test({ assert, target }) { return sleep(50).then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the answer is 42

count: 1

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-conservative-update/sleep.js b/test/runtime/samples/await-conservative-update/sleep.js index be592a4ea4..e69d86817a 100644 --- a/test/runtime/samples/await-conservative-update/sleep.js +++ b/test/runtime/samples/await-conservative-update/sleep.js @@ -1,11 +1,12 @@ export let stopped = false; -export const stop = () => stopped = true; +export const stop = () => (stopped = true); -export const sleep = ms => new Promise(f => { - if (stopped) return; - setTimeout(() => { +export const sleep = (ms) => + new Promise((f) => { if (stopped) return; - f(); - }, ms); -}); + setTimeout(() => { + if (stopped) return; + f(); + }, ms); + }); diff --git a/test/runtime/samples/await-containing-if/_config.js b/test/runtime/samples/await-containing-if/_config.js index a81b040a12..ffb76b988f 100644 --- a/test/runtime/samples/await-containing-if/_config.js +++ b/test/runtime/samples/await-containing-if/_config.js @@ -1,6 +1,6 @@ let fulfil; -const thePromise = new Promise(f => { +const thePromise = new Promise((f) => { fulfil = f; }); @@ -17,19 +17,24 @@ export default { test({ assert, component, target }) { fulfil(42); - return thePromise - .then(() => { - assert.htmlEqual(target.innerHTML, ` + return thePromise.then(() => { + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); + ` + ); - component.show = false; - assert.htmlEqual(target.innerHTML, '
'); + component.show = false; + assert.htmlEqual(target.innerHTML, '
'); - component.show = true; - assert.htmlEqual(target.innerHTML, ` + component.show = true; + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); - }); + ` + ); + }); } }; diff --git a/test/runtime/samples/await-function-promise/_config.js b/test/runtime/samples/await-function-promise/_config.js index b6a9de6856..d2948f3084 100644 --- a/test/runtime/samples/await-function-promise/_config.js +++ b/test/runtime/samples/await-function-promise/_config.js @@ -11,9 +11,12 @@ export default { test({ assert, target }) { return promise.then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

42

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-in-each/_config.js b/test/runtime/samples/await-in-each/_config.js index 617194a95c..0cfe3cba49 100644 --- a/test/runtime/samples/await-in-each/_config.js +++ b/test/runtime/samples/await-in-each/_config.js @@ -1,13 +1,15 @@ let fulfil; -const thePromise = new Promise(f => { +const thePromise = new Promise((f) => { fulfil = f; }); -const items = [{ - title: 'a title', - data: thePromise -}]; +const items = [ + { + title: 'a title', + data: thePromise + } +]; export default { props: { @@ -21,11 +23,13 @@ export default { test({ assert, target }) { fulfil(42); - return thePromise - .then(() => { - assert.htmlEqual(target.innerHTML, ` + return thePromise.then(() => { + assert.htmlEqual( + target.innerHTML, + `

a title: 42

- `); - }); + ` + ); + }); } }; diff --git a/test/runtime/samples/await-in-removed-if/_config.js b/test/runtime/samples/await-in-removed-if/_config.js index 18b2ac7b74..279f6b845d 100644 --- a/test/runtime/samples/await-in-removed-if/_config.js +++ b/test/runtime/samples/await-in-removed-if/_config.js @@ -1,6 +1,6 @@ let fulfil; -const promise = new Promise(f => { +const promise = new Promise((f) => { fulfil = f; }); @@ -15,7 +15,7 @@ export default { component.condition = false; fulfil(); - await new Promise(f => setTimeout(f, 0)); + await new Promise((f) => setTimeout(f, 0)); assert.htmlEqual(target.innerHTML, ''); } diff --git a/test/runtime/samples/await-set-simultaneous-reactive/_config.js b/test/runtime/samples/await-set-simultaneous-reactive/_config.js index 0b5c0b8c74..1f1ccacffc 100644 --- a/test/runtime/samples/await-set-simultaneous-reactive/_config.js +++ b/test/runtime/samples/await-set-simultaneous-reactive/_config.js @@ -1,13 +1,14 @@ export default { html: '

wait for it...

', test({ assert, component, target }) { - - return component.promise - .then(() => { - assert.htmlEqual(target.innerHTML, ` + return component.promise.then(() => { + assert.htmlEqual( + target.innerHTML, + `

the answer is 42!

the answer100 is 4200!

- `); - }); + ` + ); + }); } }; diff --git a/test/runtime/samples/await-set-simultaneous/_config.js b/test/runtime/samples/await-set-simultaneous/_config.js index fb75a9f6f0..88feed7c13 100644 --- a/test/runtime/samples/await-set-simultaneous/_config.js +++ b/test/runtime/samples/await-set-simultaneous/_config.js @@ -8,11 +8,13 @@ export default { assert.htmlEqual(target.innerHTML, '

wait for it...

'); - return promise - .then(() => { - assert.htmlEqual(target.innerHTML, ` + return promise.then(() => { + assert.htmlEqual( + target.innerHTML, + `

the answer is 42!

- `); - }); + ` + ); + }); } }; diff --git a/test/runtime/samples/await-then-catch-anchor/_config.js b/test/runtime/samples/await-then-catch-anchor/_config.js index bb075095e5..f32cc88f45 100644 --- a/test/runtime/samples/await-then-catch-anchor/_config.js +++ b/test/runtime/samples/await-then-catch-anchor/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -18,9 +18,12 @@ export default { return thePromise .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); + ` + ); let reject; @@ -30,18 +33,24 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loading...

- `); + ` + ); reject(new Error('something broke')); return thePromise.catch(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

oh no! something broke

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-then-catch-event/_config.js b/test/runtime/samples/await-then-catch-event/_config.js index 0f4ce27628..c367130521 100644 --- a/test/runtime/samples/await-then-catch-event/_config.js +++ b/test/runtime/samples/await-then-catch-event/_config.js @@ -1,5 +1,5 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -17,9 +17,12 @@ export default { return thePromise .then(async () => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); const { button } = component; diff --git a/test/runtime/samples/await-then-catch-if/_config.js b/test/runtime/samples/await-then-catch-if/_config.js index 88f84dff79..1fc447654c 100644 --- a/test/runtime/samples/await-then-catch-if/_config.js +++ b/test/runtime/samples/await-then-catch-if/_config.js @@ -1,6 +1,6 @@ let fulfil; -const thePromise = new Promise(f => { +const thePromise = new Promise((f) => { fulfil = f; }); @@ -17,25 +17,33 @@ export default { test({ assert, component, target }) { fulfil(42); - return thePromise - .then(() => { - assert.htmlEqual(target.innerHTML, ` + return thePromise.then(() => { + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); + ` + ); - component.show = false; + component.show = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Else

- `); + ` + ); - component.show = true; + component.show = true; - return thePromise.then(() => { - assert.htmlEqual(target.innerHTML, ` + return thePromise.then(() => { + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); - }); + ` + ); }); + }); } }; diff --git a/test/runtime/samples/await-then-catch-in-slot/_config.js b/test/runtime/samples/await-then-catch-in-slot/_config.js index 14f3e7fdf5..a99f09c78d 100644 --- a/test/runtime/samples/await-then-catch-in-slot/_config.js +++ b/test/runtime/samples/await-then-catch-in-slot/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -18,9 +18,12 @@ export default { return thePromise .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); + ` + ); let reject; @@ -30,18 +33,24 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loading...

- `); + ` + ); reject(new Error('something broke')); return thePromise.catch(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

oh no! something broke

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-then-catch-multiple/_config.js b/test/runtime/samples/await-then-catch-multiple/_config.js index 8d2de596df..ba660aa5dd 100644 --- a/test/runtime/samples/await-then-catch-multiple/_config.js +++ b/test/runtime/samples/await-then-catch-multiple/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -19,10 +19,13 @@ export default { return thePromise .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the value is 42

the value is 42

- `); + ` + ); let reject; @@ -32,20 +35,26 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loading...

loading...

- `); + ` + ); reject(new Error('something broke')); return thePromise.catch(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

oh no! something broke

oh no! something broke

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-then-catch-no-values/_config.js b/test/runtime/samples/await-then-catch-no-values/_config.js index 51a79a50d0..45292dc2ce 100644 --- a/test/runtime/samples/await-then-catch-no-values/_config.js +++ b/test/runtime/samples/await-then-catch-no-values/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); diff --git a/test/runtime/samples/await-then-catch-non-promise/_config.js b/test/runtime/samples/await-then-catch-non-promise/_config.js index c05236cc5f..4d9cb7ef16 100644 --- a/test/runtime/samples/await-then-catch-non-promise/_config.js +++ b/test/runtime/samples/await-then-catch-non-promise/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.thePromise = 'still not a promise'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the value is still not a promise

- `); + ` + ); } }; diff --git a/test/runtime/samples/await-then-catch-order/_config.js b/test/runtime/samples/await-then-catch-order/_config.js index 29fc074162..23abb846a4 100644 --- a/test/runtime/samples/await-then-catch-order/_config.js +++ b/test/runtime/samples/await-then-catch-order/_config.js @@ -1,6 +1,6 @@ let fulfil; -const thePromise = new Promise(f => { +const thePromise = new Promise((f) => { fulfil = f; }); @@ -16,12 +16,13 @@ export default { test({ assert, target }) { fulfil(42); - return thePromise - .then(() => { - assert.htmlEqual(target.innerHTML, ` + return thePromise.then(() => { + assert.htmlEqual( + target.innerHTML, + `

the value is 42

true!

- `); - }); - + ` + ); + }); } }; diff --git a/test/runtime/samples/await-then-catch-static/_config.js b/test/runtime/samples/await-then-catch-static/_config.js index 6918986950..1493a8e41a 100644 --- a/test/runtime/samples/await-then-catch-static/_config.js +++ b/test/runtime/samples/await-then-catch-static/_config.js @@ -1,6 +1,6 @@ let fulfil; -let promise = new Promise(f => { +let promise = new Promise((f) => { fulfil = f; }); @@ -18,9 +18,12 @@ export default { return promise .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loaded

- `); + ` + ); promise = new Promise((f, _) => { fulfil = f; @@ -28,18 +31,24 @@ export default { component.promise = promise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loading...

- `); + ` + ); fulfil(43); return promise.then(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loaded

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-then-catch/_config.js b/test/runtime/samples/await-then-catch/_config.js index 14f3e7fdf5..a99f09c78d 100644 --- a/test/runtime/samples/await-then-catch/_config.js +++ b/test/runtime/samples/await-then-catch/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -18,9 +18,12 @@ export default { return thePromise .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); + ` + ); let reject; @@ -30,18 +33,24 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loading...

- `); + ` + ); reject(new Error('something broke')); return thePromise.catch(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

oh no! something broke

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-then-destruct-array-nested-rest/_config.js b/test/runtime/samples/await-then-destruct-array-nested-rest/_config.js index 9a287e35e2..942f46ca33 100644 --- a/test/runtime/samples/await-then-destruct-array-nested-rest/_config.js +++ b/test/runtime/samples/await-then-destruct-array-nested-rest/_config.js @@ -1,6 +1,6 @@ export default { props: { - thePromise: new Promise(_ => {}) + thePromise: new Promise((_) => {}) }, html: ` diff --git a/test/runtime/samples/await-then-destruct-array/_config.js b/test/runtime/samples/await-then-destruct-array/_config.js index 58a66a698d..5a5fb671aa 100644 --- a/test/runtime/samples/await-then-destruct-array/_config.js +++ b/test/runtime/samples/await-then-destruct-array/_config.js @@ -1,6 +1,6 @@ export default { props: { - thePromise: new Promise(_ => {}) + thePromise: new Promise((_) => {}) }, html: ` diff --git a/test/runtime/samples/await-then-destruct-computed-props/_config.js b/test/runtime/samples/await-then-destruct-computed-props/_config.js index 6d147535e3..587ae019c7 100644 --- a/test/runtime/samples/await-then-destruct-computed-props/_config.js +++ b/test/runtime/samples/await-then-destruct-computed-props/_config.js @@ -15,7 +15,12 @@ export default { ` ); - await (component.object = Promise.resolve({ prop1: 'one', prop2: 'two', prop3: { prop7: 'seven' }, prop4: { prop10: 'ten' }})); + await (component.object = Promise.resolve({ + prop1: 'one', + prop2: 'two', + prop3: { prop7: 'seven' }, + prop4: { prop10: 'ten' } + })); assert.htmlEqual( target.innerHTML, ` diff --git a/test/runtime/samples/await-then-destruct-number-props/_config.js b/test/runtime/samples/await-then-destruct-number-props/_config.js index 6ef5e978d1..649229fe3f 100644 --- a/test/runtime/samples/await-then-destruct-number-props/_config.js +++ b/test/runtime/samples/await-then-destruct-number-props/_config.js @@ -1,6 +1,6 @@ export default { props: { - thePromise: new Promise(_ => {}) + thePromise: new Promise((_) => {}) }, html: ` @@ -46,7 +46,7 @@ export default { ); try { - await (component.thePromise = Promise.reject({ 0: 40, 2: 42, 5: 45 })); + await (component.thePromise = Promise.reject({ 0: 40, 2: 42, 5: 45 })); } catch (e) { // do nothing } diff --git a/test/runtime/samples/await-then-destruct-object-if/_config.js b/test/runtime/samples/await-then-destruct-object-if/_config.js index 6a29b2db37..71c472b7d1 100644 --- a/test/runtime/samples/await-then-destruct-object-if/_config.js +++ b/test/runtime/samples/await-then-destruct-object-if/_config.js @@ -16,7 +16,7 @@ export default { ` ); - await new Promise(resolve => setTimeout(resolve, 1)); + await new Promise((resolve) => setTimeout(resolve, 1)); assert.htmlEqual( target.innerHTML, diff --git a/test/runtime/samples/await-then-destruct-object/_config.js b/test/runtime/samples/await-then-destruct-object/_config.js index 47e8422cc4..9a1ef0ffcb 100644 --- a/test/runtime/samples/await-then-destruct-object/_config.js +++ b/test/runtime/samples/await-then-destruct-object/_config.js @@ -1,6 +1,6 @@ export default { props: { - thePromise: new Promise(_ => {}) + thePromise: new Promise((_) => {}) }, html: ` diff --git a/test/runtime/samples/await-then-if/_config.js b/test/runtime/samples/await-then-if/_config.js index f29f5df0e5..bb192ac910 100644 --- a/test/runtime/samples/await-then-if/_config.js +++ b/test/runtime/samples/await-then-if/_config.js @@ -1,6 +1,6 @@ let fulfil; -const thePromise = new Promise(f => { +const thePromise = new Promise((f) => { fulfil = f; }); @@ -18,8 +18,11 @@ export default { await thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

promise array is empty

- `); + ` + ); } }; diff --git a/test/runtime/samples/await-then-no-expression/_config.js b/test/runtime/samples/await-then-no-expression/_config.js index f684da52ed..14a7729295 100644 --- a/test/runtime/samples/await-then-no-expression/_config.js +++ b/test/runtime/samples/await-then-no-expression/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -20,13 +20,16 @@ export default { await thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the promise is resolved


the promise is resolved


the promise is resolved

- `); + ` + ); let reject; @@ -36,20 +39,26 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the promise is pending

- `); + ` + ); reject(new Error('something broke')); - + await thePromise.catch(() => {}); - - assert.htmlEqual(target.innerHTML, ` + + assert.htmlEqual( + target.innerHTML, + `

oh no! something broke



- `); + ` + ); } }; diff --git a/test/runtime/samples/await-then-shorthand/_config.js b/test/runtime/samples/await-then-shorthand/_config.js index ca07dd19e0..80f1158f04 100644 --- a/test/runtime/samples/await-then-shorthand/_config.js +++ b/test/runtime/samples/await-then-shorthand/_config.js @@ -1,6 +1,6 @@ let fulfil; -let thePromise = new Promise(f => { +let thePromise = new Promise((f) => { fulfil = f; }); @@ -16,9 +16,12 @@ export default { return thePromise .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

the value is 42

- `); + ` + ); let reject; @@ -35,9 +38,12 @@ export default { return thePromise.catch(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

oh no! something broke

- `); + ` + ); }); } }; diff --git a/test/runtime/samples/await-with-components/_config.js b/test/runtime/samples/await-with-components/_config.js index a0a558782a..4ddbf73e46 100644 --- a/test/runtime/samples/await-with-components/_config.js +++ b/test/runtime/samples/await-with-components/_config.js @@ -2,7 +2,7 @@ export default { async test({ assert, component, target }) { let resolve; let reject; - let promise = new Promise(ok => resolve = ok); + let promise = new Promise((ok) => (resolve = ok)); component.promise = promise; assert.htmlEqual(target.innerHTML, 'Loading...'); @@ -11,7 +11,7 @@ export default { await promise; assert.htmlEqual(target.innerHTML, '42'); - promise = new Promise((ok, fail) => reject = fail); + promise = new Promise((ok, fail) => (reject = fail)); component.promise = promise; assert.htmlEqual(target.innerHTML, 'Loading...'); @@ -19,7 +19,7 @@ export default { await promise.then(null, () => {}); assert.htmlEqual(target.innerHTML, '99'); - promise = new Promise(ok => resolve = ok); + promise = new Promise((ok) => (resolve = ok)); component.promise = promise; assert.htmlEqual(target.innerHTML, 'Loading...'); diff --git a/test/runtime/samples/await-with-update-2/_config.js b/test/runtime/samples/await-with-update-2/_config.js index 68f884c127..6f2dd46c94 100644 --- a/test/runtime/samples/await-with-update-2/_config.js +++ b/test/runtime/samples/await-with-update-2/_config.js @@ -9,7 +9,10 @@ export default { `, async test({ assert, component, target }) { - await (component.thePromise = Promise.resolve({ value: 'success', Component: component.Component })); + await (component.thePromise = Promise.resolve({ + value: 'success', + Component: component.Component + })); assert.htmlEqual( target.innerHTML, @@ -34,7 +37,10 @@ export default { ); try { - await (component.thePromise = Promise.reject({ value: 'failure', Component: component.Component })); + await (component.thePromise = Promise.reject({ + value: 'failure', + Component: component.Component + })); } catch (error) { // ignore } diff --git a/test/runtime/samples/await-without-catch/_config.js b/test/runtime/samples/await-without-catch/_config.js index 5bc291bf1f..949913fb14 100644 --- a/test/runtime/samples/await-without-catch/_config.js +++ b/test/runtime/samples/await-without-catch/_config.js @@ -1,6 +1,6 @@ let fulfil; -let promise = new Promise(f => { +let promise = new Promise((f) => { fulfil = f; }); @@ -17,29 +17,35 @@ export default { fulfil(42); return promise - .then(() => { - assert.htmlEqual(target.innerHTML, ` + .then(() => { + assert.htmlEqual( + target.innerHTML, + `

loaded

- `); + ` + ); - let reject; + let reject; - promise = new Promise((f, r) => { - reject = r; - }); + promise = new Promise((f, r) => { + reject = r; + }); - component.promise = promise; + component.promise = promise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

loading...

- `); - - reject(new Error('this error should be thrown')); - return promise; - }) - .catch((err) => { - assert.equal(err.message, 'this error should be thrown'); - assert.htmlEqual(target.innerHTML, ''); - }); + ` + ); + + reject(new Error('this error should be thrown')); + return promise; + }) + .catch((err) => { + assert.equal(err.message, 'this error should be thrown'); + assert.htmlEqual(target.innerHTML, ''); + }); } }; diff --git a/test/runtime/samples/before-render-chain/_config.js b/test/runtime/samples/before-render-chain/_config.js index 838d96991d..d50543115d 100644 --- a/test/runtime/samples/before-render-chain/_config.js +++ b/test/runtime/samples/before-render-chain/_config.js @@ -10,12 +10,15 @@ export default { async test({ assert, component, target }) { await component.list.update(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 1 2 3 4 5 - `); + ` + ); } }; diff --git a/test/runtime/samples/before-render-prevents-loop/_config.js b/test/runtime/samples/before-render-prevents-loop/_config.js index e922fed358..4ccf6b11ba 100644 --- a/test/runtime/samples/before-render-prevents-loop/_config.js +++ b/test/runtime/samples/before-render-prevents-loop/_config.js @@ -12,9 +12,12 @@ export default { test({ assert, component, target }) { component.value = 'goodbye!'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

goodbye!

goodbye!

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-contenteditable-html-initial/_config.js b/test/runtime/samples/binding-contenteditable-html-initial/_config.js index 4c30a3231a..973e21c10f 100644 --- a/test/runtime/samples/binding-contenteditable-html-initial/_config.js +++ b/test/runtime/samples/binding-contenteditable-html-initial/_config.js @@ -17,24 +17,33 @@ export default { el.innerHTML = 'everybody'; // No updates to data yet - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` everybody

hello world

- `); + ` + ); // Handle user input const event = new window.Event('input'); await el.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` everybody

hello everybody

- `); + ` + ); component.name = 'goodbye'; assert.equal(el.innerHTML, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` goodbye

hello goodbye

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-contenteditable-html/_config.js b/test/runtime/samples/binding-contenteditable-html/_config.js index 639572faea..fff33b64ff 100644 --- a/test/runtime/samples/binding-contenteditable-html/_config.js +++ b/test/runtime/samples/binding-contenteditable-html/_config.js @@ -15,24 +15,33 @@ export default { el.innerHTML = 'everybody'; // No updates to data yet - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` everybody

hello world

- `); + ` + ); // Handle user input const event = new window.Event('input'); await el.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` everybody

hello everybody

- `); + ` + ); component.name = 'goodbye'; assert.equal(el.innerHTML, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` goodbye

hello goodbye

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-contenteditable-text-initial/_config.js b/test/runtime/samples/binding-contenteditable-text-initial/_config.js index d5f331bb7a..8c4a4de2bf 100644 --- a/test/runtime/samples/binding-contenteditable-text-initial/_config.js +++ b/test/runtime/samples/binding-contenteditable-text-initial/_config.js @@ -19,16 +19,22 @@ export default { el.textContent = 'everybody'; await el.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` everybody

hello everybody

- `); + ` + ); component.name = 'goodbye'; assert.equal(el.textContent, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` goodbye

hello goodbye

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-contenteditable-text/_config.js b/test/runtime/samples/binding-contenteditable-text/_config.js index 89f3968258..620e088aae 100644 --- a/test/runtime/samples/binding-contenteditable-text/_config.js +++ b/test/runtime/samples/binding-contenteditable-text/_config.js @@ -17,16 +17,22 @@ export default { el.textContent = 'everybody'; await el.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` everybody

hello everybody

- `); + ` + ); component.name = 'goodbye'; assert.equal(el.textContent, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` goodbye

hello goodbye

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-details-open/_config.js b/test/runtime/samples/binding-details-open/_config.js index cf2459c3f1..b603a4693b 100644 --- a/test/runtime/samples/binding-details-open/_config.js +++ b/test/runtime/samples/binding-details-open/_config.js @@ -10,16 +10,22 @@ export default { details.open = true; await details.dispatchEvent(event); assert.equal(component.visible, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
toggle

hello!

- `); + ` + ); details.open = false; await details.dispatchEvent(event); assert.equal(component.visible, false); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
toggle
- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-indirect-computed/_config.js b/test/runtime/samples/binding-indirect-computed/_config.js index 68be22d1f8..587c797ccc 100644 --- a/test/runtime/samples/binding-indirect-computed/_config.js +++ b/test/runtime/samples/binding-indirect-computed/_config.js @@ -21,7 +21,9 @@ export default { await select.dispatchEvent(change); assert.equal(component.selected.letter, 'B'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` B - `); + ` + ); } }; diff --git a/test/runtime/samples/binding-indirect-value/_config.js b/test/runtime/samples/binding-indirect-value/_config.js index 4eaf6839aa..d64a070aa2 100644 --- a/test/runtime/samples/binding-indirect-value/_config.js +++ b/test/runtime/samples/binding-indirect-value/_config.js @@ -1,8 +1,11 @@ export default { async test({ assert, target }) { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` Parent component "bar"
Child component "bar"
- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-indirect/_config.js b/test/runtime/samples/binding-indirect/_config.js index e0f10b94bd..230818a062 100644 --- a/test/runtime/samples/binding-indirect/_config.js +++ b/test/runtime/samples/binding-indirect/_config.js @@ -43,7 +43,9 @@ export default { await input.dispatchEvent(change); assert.ok(component.tasks[0].done); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -85,6 +90,7 @@ export default {

Pending tasks

in, out, in, out

shake it all about

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js b/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js index 539a07312b..006b9f9e88 100644 --- a/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js +++ b/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js @@ -24,7 +24,7 @@ export default { `, async test({ assert, component, target, window }) { - const inputs = [ ...target.querySelectorAll('input') ]; + const inputs = [...target.querySelectorAll('input')]; const event = new window.Event('change'); @@ -33,18 +33,24 @@ export default { await component.clear(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

three

- `); + ` + ); inputs[1].checked = true; await inputs[1].dispatchEvent(event); await component.clear(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js b/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js index 959b17777b..4dce10fd9c 100644 --- a/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js +++ b/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js @@ -34,7 +34,7 @@ export default { `, async test({ assert, component, target, window }) { - const inputs = [ ...target.querySelectorAll('input') ]; + const inputs = [...target.querySelectorAll('input')]; assert.ok(inputs[0].checked); assert.ok(!inputs[1].checked); @@ -46,19 +46,25 @@ export default { await inputs[1].dispatchEvent(event); assert.equal(component.numCompleted, 2); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

two

three

2 completed

- `); + ` + ); const items = component.items; items[2].completed = true; component.items = items; assert.ok(inputs[2].checked); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

two

three

3 completed

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js b/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js index 0948797865..5a57db38b3 100644 --- a/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js +++ b/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js @@ -1,8 +1,4 @@ -const values = [ - { name: 'Alpha' }, - { name: 'Beta' }, - { name: 'Gamma' } -]; +const values = [{ name: 'Alpha' }, { name: 'Beta' }, { name: 'Gamma' }]; export default { props: { @@ -51,7 +47,9 @@ export default { inputs[0].checked = true; await inputs[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -65,14 +63,17 @@ export default {

Alpha, Beta

- `); + ` + ); component.selected = [values[1], values[2]]; assert.equal(inputs[0].checked, false); assert.equal(inputs[1].checked, true); assert.equal(inputs[2].checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -86,6 +87,7 @@ export default {

Beta, Gamma

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-checkbox-group/_config.js b/test/runtime/samples/binding-input-checkbox-group/_config.js index 0948797865..5a57db38b3 100644 --- a/test/runtime/samples/binding-input-checkbox-group/_config.js +++ b/test/runtime/samples/binding-input-checkbox-group/_config.js @@ -1,8 +1,4 @@ -const values = [ - { name: 'Alpha' }, - { name: 'Beta' }, - { name: 'Gamma' } -]; +const values = [{ name: 'Alpha' }, { name: 'Beta' }, { name: 'Gamma' }]; export default { props: { @@ -51,7 +47,9 @@ export default { inputs[0].checked = true; await inputs[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -65,14 +63,17 @@ export default {

Alpha, Beta

- `); + ` + ); component.selected = [values[1], values[2]]; assert.equal(inputs[0].checked, false); assert.equal(inputs[1].checked, true); assert.equal(inputs[2].checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -86,6 +87,7 @@ export default {

Beta, Gamma

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js b/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js index 9d099feb0a..b2547942e7 100644 --- a/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js +++ b/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js @@ -24,19 +24,25 @@ export default { assert.equal(component.indeterminate, false); assert.equal(component.checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

checked? true

indeterminate? false

- `); + ` + ); component.indeterminate = true; assert.equal(input.indeterminate, true); assert.equal(input.checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

checked? true

indeterminate? true

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-checkbox/_config.js b/test/runtime/samples/binding-input-checkbox/_config.js index f6b553ee23..c519c505ea 100644 --- a/test/runtime/samples/binding-input-checkbox/_config.js +++ b/test/runtime/samples/binding-input-checkbox/_config.js @@ -22,16 +22,22 @@ export default { input.checked = false; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

false

- `); + ` + ); component.foo = true; assert.equal(input.checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

true

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-group-each-1/_config.js b/test/runtime/samples/binding-input-group-each-1/_config.js index 9bdf784f73..c37909875e 100644 --- a/test/runtime/samples/binding-input-group-each-1/_config.js +++ b/test/runtime/samples/binding-input-group-each-1/_config.js @@ -1,14 +1,6 @@ -const values = [ - { name: 'Alpha' }, - { name: 'Beta' }, - { name: 'Gamma' } -]; - -const selected_array = [ - [values[1]], - [], - [values[2]] -]; +const values = [{ name: 'Alpha' }, { name: 'Beta' }, { name: 'Gamma' }]; + +const selected_array = [[values[1]], [], [values[2]]]; export default { props: { @@ -129,7 +121,9 @@ export default { inputs[0].checked = true; await inputs[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); inputs[3].checked = true; await inputs[3].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); inputs[8].checked = false; await inputs[8].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); component.selected_array = [[values[1], values[2]], [values[2]]]; @@ -287,7 +288,9 @@ export default { assert.equal(inputs[4].checked, false); assert.equal(inputs[5].checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-group-each-10/_config.js b/test/runtime/samples/binding-input-group-each-10/_config.js index 735a4c0b11..2a0b29428e 100644 --- a/test/runtime/samples/binding-input-group-each-10/_config.js +++ b/test/runtime/samples/binding-input-group-each-10/_config.js @@ -32,7 +32,7 @@ export default { assert.equal(inputs[1].checked, false); assert.equal(inputs[2].checked, true); - (component.current = 'b'); + component.current = 'b'; await Promise.resolve(); inputs = target.querySelectorAll('input'); diff --git a/test/runtime/samples/binding-input-group-each-11/_config.js b/test/runtime/samples/binding-input-group-each-11/_config.js index a90993861a..5e0dc07b00 100644 --- a/test/runtime/samples/binding-input-group-each-11/_config.js +++ b/test/runtime/samples/binding-input-group-each-11/_config.js @@ -82,7 +82,7 @@ export default { inputs[2].checked = true; await inputs[2].dispatchEvent(event); - + check(new Set([0, 2, 5, 6])); } }; diff --git a/test/runtime/samples/binding-input-group-each-12/_config.js b/test/runtime/samples/binding-input-group-each-12/_config.js index a3d6c92879..a256d48b4a 100644 --- a/test/runtime/samples/binding-input-group-each-12/_config.js +++ b/test/runtime/samples/binding-input-group-each-12/_config.js @@ -82,7 +82,7 @@ export default { inputs[5].checked = true; await inputs[5].dispatchEvent(event); - + check(new Set([0, 2, 3, 5])); assert.deepEqual(component.pipelineOperations[1].operation.args[0].value, ['b']); } diff --git a/test/runtime/samples/binding-input-group-each-13/_config.js b/test/runtime/samples/binding-input-group-each-13/_config.js index affb94b8fb..47bc183e09 100644 --- a/test/runtime/samples/binding-input-group-each-13/_config.js +++ b/test/runtime/samples/binding-input-group-each-13/_config.js @@ -4,9 +4,9 @@ export default { const radio = target.querySelector('input[type=radio]'); assert.equal(radio.checked, false); - + const event = new window.Event('input'); - + input1.value = 'world'; await input1.dispatchEvent(event); assert.equal(radio.checked, true); @@ -14,15 +14,15 @@ export default { input2.value = 'foo'; await input2.dispatchEvent(event); assert.equal(radio.checked, false); - + input1.value = 'foo'; await input1.dispatchEvent(event); assert.equal(radio.checked, true); - + input1.value = 'bar'; await input1.dispatchEvent(event); assert.equal(radio.checked, false); - + input2.value = 'bar'; await input2.dispatchEvent(event); assert.equal(radio.checked, true); diff --git a/test/runtime/samples/binding-input-group-each-2/_config.js b/test/runtime/samples/binding-input-group-each-2/_config.js index 880b183f88..af4376dbaf 100644 --- a/test/runtime/samples/binding-input-group-each-2/_config.js +++ b/test/runtime/samples/binding-input-group-each-2/_config.js @@ -36,7 +36,9 @@ export default { inputs[0].checked = false; await inputs[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -48,14 +50,17 @@ export default {

2, 3

- `); + ` + ); component.selected = [[1, 3]]; assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, false); assert.equal(inputs[2].checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -67,6 +72,7 @@ export default {

1, 3

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-group-each-3/_config.js b/test/runtime/samples/binding-input-group-each-3/_config.js index f4018295d7..9b6daa0d0e 100644 --- a/test/runtime/samples/binding-input-group-each-3/_config.js +++ b/test/runtime/samples/binding-input-group-each-3/_config.js @@ -1,14 +1,6 @@ -const values = [ - { name: 'Alpha' }, - { name: 'Beta' }, - { name: 'Gamma' } -]; - -const selected_array = [ - [values[1]], - [], - [values[2]] -]; +const values = [{ name: 'Alpha' }, { name: 'Beta' }, { name: 'Gamma' }]; + +const selected_array = [[values[1]], [], [values[2]]]; export default { props: { @@ -127,7 +119,9 @@ export default { inputs[0].checked = true; await inputs[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); inputs[3].checked = true; await inputs[3].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); inputs[8].checked = false; await inputs[8].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); component.selected_array = [[values[1], values[2]], [values[2]]]; @@ -285,7 +286,9 @@ export default { assert.equal(inputs[4].checked, false); assert.equal(inputs[5].checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-group-each-4/_config.js b/test/runtime/samples/binding-input-group-each-4/_config.js index da5edf18bc..e29b3ea2f6 100644 --- a/test/runtime/samples/binding-input-group-each-4/_config.js +++ b/test/runtime/samples/binding-input-group-each-4/_config.js @@ -58,7 +58,9 @@ export default { inputs[2].checked = true; await inputs[2].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -75,12 +77,15 @@ export default {

3

- `); + ` + ); inputs[9].checked = true; await inputs[9].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -97,7 +102,8 @@ export default {

1, 3

- `); + ` + ); inputs[4].checked = false; await inputs[4].dispatchEvent(event); @@ -110,7 +116,9 @@ export default { inputs[11].checked = false; await inputs[11].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -127,7 +135,8 @@ export default {

1

- `); + ` + ); component.selected_array_1 = [[3], [1]]; component.selected_array_2 = [[], [2]]; @@ -148,7 +157,9 @@ export default { assert.equal(inputs[10].checked, true); assert.equal(inputs[11].checked, false); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -165,6 +176,7 @@ export default {

2

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-group-each-5/_config.js b/test/runtime/samples/binding-input-group-each-5/_config.js index cdfe9308df..f95c303119 100644 --- a/test/runtime/samples/binding-input-group-each-5/_config.js +++ b/test/runtime/samples/binding-input-group-each-5/_config.js @@ -58,7 +58,9 @@ export default { inputs[2].checked = true; await inputs[2].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -75,12 +77,15 @@ export default {

1

- `); + ` + ); inputs[8].checked = true; await inputs[8].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -97,11 +102,14 @@ export default {

1

- `); + ` + ); component.selected_index = [1, 1]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -118,7 +126,8 @@ export default {

1

- `); + ` + ); assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, true); @@ -139,7 +148,9 @@ export default { inputs[5].checked = false; await inputs[5].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -156,7 +167,8 @@ export default {

1

- `); + ` + ); assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, true); diff --git a/test/runtime/samples/binding-input-group-each-6/_config.js b/test/runtime/samples/binding-input-group-each-6/_config.js index 7fd1232a27..5eac49a2a8 100644 --- a/test/runtime/samples/binding-input-group-each-6/_config.js +++ b/test/runtime/samples/binding-input-group-each-6/_config.js @@ -32,7 +32,9 @@ export default { inputs[2].checked = true; await inputs[2].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -45,12 +47,15 @@ export default {

- `); + ` + ); inputs[4].checked = true; await inputs[4].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -63,12 +68,15 @@ export default {

- `); + ` + ); inputs[5].checked = true; await inputs[5].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -81,6 +89,7 @@ export default {

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-group-each-8/_config.js b/test/runtime/samples/binding-input-group-each-8/_config.js index b17b801a83..ea76e4713b 100644 --- a/test/runtime/samples/binding-input-group-each-8/_config.js +++ b/test/runtime/samples/binding-input-group-each-8/_config.js @@ -3,7 +3,9 @@ export default { async test({ assert, target, component, window }) { let inputs = target.querySelectorAll('input'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

{"foo":[],"bar":[]}

foo

    @@ -17,7 +19,8 @@ export default {
- `); + ` + ); const event = new window.Event('change'); @@ -28,7 +31,9 @@ export default { inputs[3].checked = true; await inputs[3].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

{"foo":[1,3],"bar":[1]}

foo

    @@ -42,11 +47,14 @@ export default {
- `); - + ` + ); + await component.update(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

{"foo":[1,3],"bar":[1],"qux":[]}

qux

    @@ -54,13 +62,16 @@ export default {
- `); + ` + ); inputs = target.querySelectorAll('input'); inputs[0].checked = true; await inputs[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

{"foo":[1,3],"bar":[1],"qux":[4]}

qux

    @@ -68,11 +79,10 @@ export default {
- `); + ` + ); assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, false); assert.equal(inputs[2].checked, false); } }; - - diff --git a/test/runtime/samples/binding-input-group-each-9/_config.js b/test/runtime/samples/binding-input-group-each-9/_config.js index 55bb11c26a..c3ebc6cc53 100644 --- a/test/runtime/samples/binding-input-group-each-9/_config.js +++ b/test/runtime/samples/binding-input-group-each-9/_config.js @@ -9,7 +9,7 @@ export default { await component.moveDown(0); await component.moveDown(1); - + assert.htmlEqual( target.innerHTML, ` @@ -32,7 +32,7 @@ export default { assert.equal(inputs[2].checked, true); await (component.current = 'b'); - + inputs = target.querySelectorAll('input'); assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, false); diff --git a/test/runtime/samples/binding-input-group-undefined/_config.js b/test/runtime/samples/binding-input-group-undefined/_config.js index 501e37813c..d788cc0e7b 100644 --- a/test/runtime/samples/binding-input-group-undefined/_config.js +++ b/test/runtime/samples/binding-input-group-undefined/_config.js @@ -1,5 +1,4 @@ export default { - async test({ assert, target, component, window }) { const [input1, input2, input3] = target.querySelectorAll('input'); const event = new window.Event('change'); diff --git a/test/runtime/samples/binding-input-member-expression-update/_config.js b/test/runtime/samples/binding-input-member-expression-update/_config.js index c0dfc3bbe8..1d4e964143 100644 --- a/test/runtime/samples/binding-input-member-expression-update/_config.js +++ b/test/runtime/samples/binding-input-member-expression-update/_config.js @@ -10,9 +10,9 @@ export default { assert.deepEqual(component.values.a, 'hij'); assert.deepEqual(component.logs.length, 1); - + component.paths = ['b']; assert.deepEqual(component.logs.length, 2); - assert.equal(input.value, 'def'); + assert.equal(input.value, 'def'); } }; diff --git a/test/runtime/samples/binding-input-number/_config.js b/test/runtime/samples/binding-input-number/_config.js index 1a56a75c0c..66cffb5a9b 100644 --- a/test/runtime/samples/binding-input-number/_config.js +++ b/test/runtime/samples/binding-input-number/_config.js @@ -23,26 +23,35 @@ export default { await input.dispatchEvent(event); assert.equal(component.count, 43); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

number 43

- `); + ` + ); component.count = 44; assert.equal(input.value, '44'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

number 44

- `); + ` + ); // empty string should be treated as null input.value = ''; await input.dispatchEvent(event); assert.equal(component.count, null); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

object null

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-radio-group/_config.js b/test/runtime/samples/binding-input-radio-group/_config.js index 9684f60fa6..0051c68086 100644 --- a/test/runtime/samples/binding-input-radio-group/_config.js +++ b/test/runtime/samples/binding-input-radio-group/_config.js @@ -1,8 +1,4 @@ -const values = [ - { name: 'Alpha' }, - { name: 'Beta' }, - { name: 'Gamma' } -]; +const values = [{ name: 'Alpha' }, { name: 'Beta' }, { name: 'Gamma' }]; export default { props: { @@ -51,7 +47,9 @@ export default { inputs[0].checked = true; await inputs[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -65,7 +63,8 @@ export default {

Alpha

- `); + ` + ); assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, false); @@ -76,7 +75,9 @@ export default { assert.equal(inputs[1].checked, false); assert.equal(inputs[2].checked, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` @@ -90,6 +91,7 @@ export default {

Gamma

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-range-change-with-max/_config.js b/test/runtime/samples/binding-input-range-change-with-max/_config.js index dc3cf4ce28..b4c3ca5a5f 100644 --- a/test/runtime/samples/binding-input-range-change-with-max/_config.js +++ b/test/runtime/samples/binding-input-range-change-with-max/_config.js @@ -24,10 +24,13 @@ export default { await button.dispatchEvent(new window.Event('click')); assert.equal(input.value, '20'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

20 of 20

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-range-change/_config.js b/test/runtime/samples/binding-input-range-change/_config.js index f6ec2d9c53..4f74b056bf 100644 --- a/test/runtime/samples/binding-input-range-change/_config.js +++ b/test/runtime/samples/binding-input-range-change/_config.js @@ -23,16 +23,22 @@ export default { await input.dispatchEvent(event); assert.equal(component.count, 43); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

number 43

- `); + ` + ); component.count = 44; assert.equal(input.value, '44'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

number 44

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-range/_config.js b/test/runtime/samples/binding-input-range/_config.js index dc6178e088..f62a301a84 100644 --- a/test/runtime/samples/binding-input-range/_config.js +++ b/test/runtime/samples/binding-input-range/_config.js @@ -23,16 +23,22 @@ export default { await input.dispatchEvent(event); assert.equal(component.count, 43); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

number 43

- `); + ` + ); component.count = 44; assert.equal(input.value, '44'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

number 44

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js b/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js index de4d6325b0..10fcfa6bf4 100644 --- a/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js +++ b/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js @@ -28,9 +28,12 @@ export default { assert.equal(component.foo, 'b'); assert.equal(component.items[0], 'y'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

b

y

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js index a1584c18b8..8f332dc346 100644 --- a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js +++ b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js @@ -56,7 +56,9 @@ export default { component.filter = 'remaining'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

@@ -67,11 +69,14 @@ export default {

remaining:one / done:two / remaining:three

- `); + ` + ); await set_text(1, 'four'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

@@ -82,7 +87,8 @@ export default {

remaining:one / done:two / remaining:four

- `); + ` + ); assert.deepEqual(component.items, [ { done: false, text: 'one' }, @@ -92,14 +98,17 @@ export default { await set_done(0, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

four

done:one / done:two / remaining:four

- `); + ` + ); assert.deepEqual(component.items, [ { done: true, text: 'one' }, @@ -109,7 +118,9 @@ export default { component.filter = 'done'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

@@ -120,6 +131,7 @@ export default {

done:one / done:two / remaining:four

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-contextual/_config.js b/test/runtime/samples/binding-input-text-contextual/_config.js index 1c66ea7ff5..abf0463353 100644 --- a/test/runtime/samples/binding-input-text-contextual/_config.js +++ b/test/runtime/samples/binding-input-text-contextual/_config.js @@ -38,7 +38,9 @@ export default { await inputs[1].dispatchEvent(event); assert.equal(items[1], 'four'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

@@ -48,13 +50,16 @@ export default {

three

- `); + ` + ); items[2] = 'five'; component.items = items; assert.equal(inputs[2].value, 'five'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

@@ -64,6 +69,7 @@ export default {

five

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-deconflicted/_config.js b/test/runtime/samples/binding-input-text-deconflicted/_config.js index 48a7d2590a..411bfd6c21 100644 --- a/test/runtime/samples/binding-input-text-deconflicted/_config.js +++ b/test/runtime/samples/binding-input-text-deconflicted/_config.js @@ -25,16 +25,22 @@ export default { await input.dispatchEvent(event); assert.equal(input.value, 'everybody'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Hello everybody!

- `); + ` + ); component.component = { name: 'goodbye' }; assert.equal(input.value, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Hello goodbye!

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js b/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js index 0afbb9d952..da4428602a 100644 --- a/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js +++ b/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js @@ -28,10 +28,13 @@ export default { input.value = 'e'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
{"foo":"a","bar":"e","baz":"c"}
- `); + ` + ); // edit baz component.prop = 'baz'; @@ -40,10 +43,13 @@ export default { input.value = 'f'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
{"foo":"a","bar":"e","baz":"f"}
- `); + ` + ); // edit foo component.prop = 'foo'; @@ -52,9 +58,12 @@ export default { input.value = 'd'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
{"foo":"d","bar":"e","baz":"f"}
- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-deep-computed/_config.js b/test/runtime/samples/binding-input-text-deep-computed/_config.js index 3a85d50d76..b44c78c4ca 100644 --- a/test/runtime/samples/binding-input-text-deep-computed/_config.js +++ b/test/runtime/samples/binding-input-text-deep-computed/_config.js @@ -26,19 +26,25 @@ export default { input.value = 'bob'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello bob

- `); + ` + ); const user = component.user; user.name = 'carol'; component.user = user; assert.equal(input.value, 'carol'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello carol

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js b/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js index 627ef5f15e..43658830fe 100644 --- a/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js +++ b/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js @@ -30,10 +30,13 @@ export default { input.value = 'e'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
{"foo":"a","bar":"e","baz":"c"}
- `); + ` + ); // edit baz component.prop = 'baz'; @@ -42,10 +45,13 @@ export default { input.value = 'f'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
{"foo":"a","bar":"e","baz":"f"}
- `); + ` + ); // edit foo component.prop = 'foo'; @@ -54,9 +60,12 @@ export default { input.value = 'd'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
{"foo":"d","bar":"e","baz":"f"}
- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-deep-contextual/_config.js b/test/runtime/samples/binding-input-text-deep-contextual/_config.js index cc80d38042..11d481a7e7 100644 --- a/test/runtime/samples/binding-input-text-deep-contextual/_config.js +++ b/test/runtime/samples/binding-input-text-deep-contextual/_config.js @@ -1,10 +1,6 @@ export default { props: { - items: [ - { description: 'one' }, - { description: 'two' }, - { description: 'three' } - ] + items: [{ description: 'one' }, { description: 'two' }, { description: 'three' }] }, html: ` @@ -29,21 +25,27 @@ export default { inputs[1].value = 'four'; await inputs[1].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

four

three

- `); + ` + ); const items = component.items; items[2].description = 'five'; component.items = items; assert.equal(inputs[2].value, 'five'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one

four

five

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text-deep/_config.js b/test/runtime/samples/binding-input-text-deep/_config.js index 35443e9073..19b0b89fe7 100644 --- a/test/runtime/samples/binding-input-text-deep/_config.js +++ b/test/runtime/samples/binding-input-text-deep/_config.js @@ -25,19 +25,25 @@ export default { input.value = 'bob'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello bob

- `); + ` + ); const user = component.user; user.name = 'carol'; component.user = user; assert.equal(input.value, 'carol'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello carol

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-input-text/_config.js b/test/runtime/samples/binding-input-text/_config.js index 52d8e44902..0303b66c16 100644 --- a/test/runtime/samples/binding-input-text/_config.js +++ b/test/runtime/samples/binding-input-text/_config.js @@ -22,16 +22,22 @@ export default { input.value = 'everybody'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello everybody

- `); + ` + ); component.name = 'goodbye'; assert.equal(input.value, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello goodbye

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-no-unnecessary-invalidation.skip/_config.js b/test/runtime/samples/binding-no-unnecessary-invalidation.skip/_config.js index d7e553fd46..8cf108ab76 100644 --- a/test/runtime/samples/binding-no-unnecessary-invalidation.skip/_config.js +++ b/test/runtime/samples/binding-no-unnecessary-invalidation.skip/_config.js @@ -3,8 +3,11 @@ export default { skip: true, async test({ assert, target }) { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

0

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-implicit-option-value/_config.js b/test/runtime/samples/binding-select-implicit-option-value/_config.js index 1266602a47..66d0585f09 100644 --- a/test/runtime/samples/binding-select-implicit-option-value/_config.js +++ b/test/runtime/samples/binding-select-implicit-option-value/_config.js @@ -27,7 +27,9 @@ export default { await select.dispatchEvent(change); assert.equal(component.foo, 3); - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo: 3

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-in-each-block/_config.js b/test/runtime/samples/binding-select-in-each-block/_config.js index 80ea375b78..c4d447137a 100644 --- a/test/runtime/samples/binding-select-in-each-block/_config.js +++ b/test/runtime/samples/binding-select-in-each-block/_config.js @@ -23,8 +23,6 @@ export default { selects[1].options[0].selected = true; selects[1].dispatchEvent(change); - assert.deepEqual(component.items, [ - { value: 'hullo' }, { value: 'hullo' } - ]); + assert.deepEqual(component.items, [{ value: 'hullo' }, { value: 'hullo' }]); } }; diff --git a/test/runtime/samples/binding-select-in-yield/_config.js b/test/runtime/samples/binding-select-in-yield/_config.js index 042fba832b..070aac51a7 100644 --- a/test/runtime/samples/binding-select-in-yield/_config.js +++ b/test/runtime/samples/binding-select-in-yield/_config.js @@ -8,7 +8,9 @@ export default { async test({ assert, component, target, window }) { await component.modal.toggle(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` b - `); + ` + ); let select = target.querySelector('select'); const change = new window.MouseEvent('change'); @@ -25,13 +28,14 @@ export default { await select.dispatchEvent(change); assert.equal(component.letter, 'c'); - assert.deepEqual(Array.from(select.options).map(o => o.selected), [ - false, - false, - true - ]); + assert.deepEqual( + Array.from(select.options).map((o) => o.selected), + [false, false, true] + ); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` c - `); + ` + ); await component.modal.toggle(); await component.modal.toggle(); select = target.querySelector('select'); - assert.deepEqual(Array.from(select.options).map(o => o.selected), [ - false, - false, - true - ]); + assert.deepEqual( + Array.from(select.options).map((o) => o.selected), + [false, false, true] + ); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` c - `); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-late-2/_config.js b/test/runtime/samples/binding-select-late-2/_config.js index f4b0088fb9..aa16e260a2 100644 --- a/test/runtime/samples/binding-select-late-2/_config.js +++ b/test/runtime/samples/binding-select-late-2/_config.js @@ -10,20 +10,23 @@ export default { `, test({ assert, component, target }) { - component.items = [ 'one', 'two', 'three' ]; + component.items = ['one', 'two', 'three']; const options = target.querySelectorAll('option'); assert.ok(!options[0].selected); assert.ok(options[1].selected); assert.ok(!options[2].selected); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: two

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-late-3/_config.js b/test/runtime/samples/binding-select-late-3/_config.js index 42c45d1366..d2d5574166 100644 --- a/test/runtime/samples/binding-select-late-3/_config.js +++ b/test/runtime/samples/binding-select-late-3/_config.js @@ -15,20 +15,23 @@ export default { `, test({ assert, component, target }) { - component.items = [ 'one', 'two', 'three' ]; + component.items = ['one', 'two', 'three']; const options = target.querySelectorAll('option'); assert.ok(!options[0].selected); assert.ok(options[1].selected); assert.ok(!options[2].selected); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: two

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-late/_config.js b/test/runtime/samples/binding-select-late/_config.js index 98f53740af..36a032a25a 100644 --- a/test/runtime/samples/binding-select-late/_config.js +++ b/test/runtime/samples/binding-select-late/_config.js @@ -10,7 +10,7 @@ export default { `, test({ assert, component, target }) { - component.items = [ 'one', 'two', 'three' ]; + component.items = ['one', 'two', 'three']; component.selected = 'two'; const options = target.querySelectorAll('option'); @@ -18,13 +18,16 @@ export default { assert.ok(options[1].selected); assert.ok(!options[2].selected); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: two

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-multiple/_config.js b/test/runtime/samples/binding-select-multiple/_config.js index 70a5620d05..d507c8c878 100644 --- a/test/runtime/samples/binding-select-multiple/_config.js +++ b/test/runtime/samples/binding-select-multiple/_config.js @@ -1,7 +1,6 @@ export default { - props: { - selected: [ 'two', 'three' ] + selected: ['two', 'three'] }, html: ` @@ -15,16 +14,18 @@ export default { `, async test({ assert, component, target, window }) { - const select = target.querySelector( 'select' ); - const options = [ ...target.querySelectorAll( 'option' ) ]; + const select = target.querySelector('select'); + const options = [...target.querySelectorAll('option')]; - const change = new window.Event( 'change' ); + const change = new window.Event('change'); options[1].selected = false; - await select.dispatchEvent( change ); + await select.dispatchEvent(change); - assert.deepEqual( component.selected, [ 'three' ] ); - assert.htmlEqual( target.innerHTML, ` + assert.deepEqual(component.selected, ['three']); + assert.htmlEqual( + target.innerHTML, + `

selected: three

- ` ); + ` + ); options[0].selected = true; - await select.dispatchEvent( change ); + await select.dispatchEvent(change); - assert.deepEqual( component.selected, [ 'one', 'three' ] ); - assert.htmlEqual( target.innerHTML, ` + assert.deepEqual(component.selected, ['one', 'three']); + assert.htmlEqual( + target.innerHTML, + `

selected: one, three

- ` ); + ` + ); - component.selected = [ 'one', 'two' ]; + component.selected = ['one', 'two']; - assert.ok( options[0].selected ); - assert.ok( options[1].selected ); - assert.ok( !options[2].selected ); + assert.ok(options[0].selected); + assert.ok(options[1].selected); + assert.ok(!options[2].selected); - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: one, two

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-null-placeholder/_config.js b/test/runtime/samples/binding-select-null-placeholder/_config.js index b453e6869a..3fc7fa991a 100644 --- a/test/runtime/samples/binding-select-null-placeholder/_config.js +++ b/test/runtime/samples/binding-select-null-placeholder/_config.js @@ -1,4 +1,4 @@ -const items = [ { id: 'a' }, { id: 'b' } ]; +const items = [{ id: 'a' }, { id: 'b' }]; export default { props: { @@ -7,22 +7,22 @@ export default { }, test({ assert, component, target }) { - const select = target.querySelector( 'select' ); - const options = target.querySelectorAll( 'option' ); + const select = target.querySelector('select'); + const options = target.querySelectorAll('option'); - assert.equal( options[0].selected, true ); - assert.equal( options[0].disabled, true ); - assert.equal( options[1].selected, false ); - assert.equal( options[1].disabled, false ); + assert.equal(options[0].selected, true); + assert.equal(options[0].disabled, true); + assert.equal(options[1].selected, false); + assert.equal(options[1].disabled, false); // placeholder option value must be blank string for native required field validation - assert.equal( options[0].value, '' ); - assert.equal( select.checkValidity(), false ); + assert.equal(options[0].value, ''); + assert.equal(select.checkValidity(), false); component.foo = items[0]; - assert.equal( options[0].selected, false ); - assert.equal( options[1].selected, true ); - assert.equal( select.checkValidity(), true ); + assert.equal(options[0].selected, false); + assert.equal(options[1].selected, true); + assert.equal(select.checkValidity(), true); } }; diff --git a/test/runtime/samples/binding-select-optgroup/_config.js b/test/runtime/samples/binding-select-optgroup/_config.js index 03ad3e3280..b35ba3c740 100644 --- a/test/runtime/samples/binding-select-optgroup/_config.js +++ b/test/runtime/samples/binding-select-optgroup/_config.js @@ -1,5 +1,4 @@ export default { - ssrHtml: `

Hello undefined!

@@ -35,7 +34,9 @@ export default { await select.dispatchEvent(change); assert.equal(component.name, 'World'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Hello World!

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-select-unmatched/_config.js b/test/runtime/samples/binding-select-unmatched/_config.js index 45594407b3..8febc6588e 100644 --- a/test/runtime/samples/binding-select-unmatched/_config.js +++ b/test/runtime/samples/binding-select-unmatched/_config.js @@ -26,7 +26,9 @@ export default { assert.equal(select.value, 'a'); assert.ok(options[0].selected); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: a

selected: a

- `); + ` + ); component.selected = 'd'; // doesn't match an option @@ -45,7 +48,9 @@ export default { assert.equal(select.selectedIndex, -1); assert.ok(!options[0].selected); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: d

selected: d

- `); + ` + ); component.selected = 'b'; // second option should now be selected assert.equal(select.value, 'b'); assert.ok(options[1].selected); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: b

selected: b

- `); + ` + ); component.selected = undefined; // also doesn't match an option @@ -80,7 +89,9 @@ export default { assert.equal(select.selectedIndex, -1); assert.ok(!options[0].selected); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: undefined

selected: undefined

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-select/_config.js b/test/runtime/samples/binding-select/_config.js index 6cdef2651a..20170941c4 100644 --- a/test/runtime/samples/binding-select/_config.js +++ b/test/runtime/samples/binding-select/_config.js @@ -28,7 +28,9 @@ export default { await select.dispatchEvent(change); assert.equal(component.selected, 'two'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: two

selected: two

- `); + ` + ); component.selected = 'three'; } diff --git a/test/runtime/samples/binding-store-deep/_config.js b/test/runtime/samples/binding-store-deep/_config.js index c0f4f63578..e6d3c79f16 100644 --- a/test/runtime/samples/binding-store-deep/_config.js +++ b/test/runtime/samples/binding-store-deep/_config.js @@ -16,24 +16,30 @@ export default { const event = new window.Event('input'); const names = []; - const unsubscribe = component.user.subscribe(user => { + const unsubscribe = component.user.subscribe((user) => { names.push(user.name); }); input.value = 'everybody'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello everybody

- `); + ` + ); await component.user.set({ name: 'goodbye' }); assert.equal(input.value, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello goodbye

- `); + ` + ); assert.deepEqual(names, ['world', 'everybody', 'goodbye']); unsubscribe(); diff --git a/test/runtime/samples/binding-store/_config.js b/test/runtime/samples/binding-store/_config.js index 6e7a70878a..8c90f073b0 100644 --- a/test/runtime/samples/binding-store/_config.js +++ b/test/runtime/samples/binding-store/_config.js @@ -16,24 +16,30 @@ export default { const event = new window.Event('input'); const names = []; - const unsubscribe = component.name.subscribe(name => { + const unsubscribe = component.name.subscribe((name) => { names.push(name); }); input.value = 'everybody'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello everybody

- `); + ` + ); await component.name.set('goodbye'); assert.equal(input.value, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello goodbye

- `); + ` + ); assert.deepEqual(names, ['world', 'everybody', 'goodbye']); unsubscribe(); diff --git a/test/runtime/samples/binding-textarea/_config.js b/test/runtime/samples/binding-textarea/_config.js index 70646e5e4b..17bc2b92a8 100644 --- a/test/runtime/samples/binding-textarea/_config.js +++ b/test/runtime/samples/binding-textarea/_config.js @@ -22,16 +22,22 @@ export default { textarea.value = 'hello'; await textarea.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello

- `); + ` + ); component.value = 'goodbye'; assert.equal(textarea.value, 'goodbye'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

goodbye

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-this-and-value/_config.js b/test/runtime/samples/binding-this-and-value/_config.js index 70cc8d4110..6fb8bb1e68 100644 --- a/test/runtime/samples/binding-this-and-value/_config.js +++ b/test/runtime/samples/binding-this-and-value/_config.js @@ -16,9 +16,12 @@ export default { input.value = 'changed'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

value: changed

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-this-each-block-property-component/_config.js b/test/runtime/samples/binding-this-each-block-property-component/_config.js index 3346888555..0cc433432f 100644 --- a/test/runtime/samples/binding-this-each-block-property-component/_config.js +++ b/test/runtime/samples/binding-this-each-block-property-component/_config.js @@ -3,9 +3,12 @@ export default { async test({ assert, component, target }) { component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

a

- `); + ` + ); assert.ok(component.items[0].ref.isFoo()); } diff --git a/test/runtime/samples/binding-this-each-block-property/_config.js b/test/runtime/samples/binding-this-each-block-property/_config.js index bb24bcc0bf..abfdb419e9 100644 --- a/test/runtime/samples/binding-this-each-block-property/_config.js +++ b/test/runtime/samples/binding-this-each-block-property/_config.js @@ -3,9 +3,12 @@ export default { async test({ assert, component, target }) { component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
a
- `); + ` + ); assert.equal(component.items[0].ref, target.querySelector('div')); } diff --git a/test/runtime/samples/binding-this-each-object-props/_config.js b/test/runtime/samples/binding-this-each-object-props/_config.js index e9ec7d90f0..24c1f4a990 100644 --- a/test/runtime/samples/binding-this-each-object-props/_config.js +++ b/test/runtime/samples/binding-this-each-object-props/_config.js @@ -3,9 +3,12 @@ export default { async test({ assert, component, target }) { component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
b
b
c
c
- `); + ` + ); assert.equal(component.items1[1], target.querySelector('div')); assert.equal(component.items2[1], target.querySelector('div:nth-child(2)')); assert.equal(component.items1[2], target.querySelector('div:nth-child(3)')); diff --git a/test/runtime/samples/binding-this-each-object-spread/_config.js b/test/runtime/samples/binding-this-each-object-spread/_config.js index e88ebe8de5..ae6c55e0c2 100644 --- a/test/runtime/samples/binding-this-each-object-spread/_config.js +++ b/test/runtime/samples/binding-this-each-object-spread/_config.js @@ -3,9 +3,12 @@ export default { async test({ assert, component, target }) { component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
a
a
b
b
- `); + ` + ); assert.equal(component.items1[1], target.querySelector('div')); assert.equal(component.items2[1], target.querySelector('div:nth-child(2)')); assert.equal(component.items1[2], target.querySelector('div:nth-child(3)')); diff --git a/test/runtime/samples/binding-this-element-reactive-b/_config.js b/test/runtime/samples/binding-this-element-reactive-b/_config.js index bcea590c17..e5c42c3734 100644 --- a/test/runtime/samples/binding-this-element-reactive-b/_config.js +++ b/test/runtime/samples/binding-this-element-reactive-b/_config.js @@ -8,14 +8,20 @@ export default { test({ assert, component, target }) { component.visible = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
The text is missing
- `); + ` + ); component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
The text is hello

hello

- `); + ` + ); } }; diff --git a/test/runtime/samples/binding-this-with-context/_config.js b/test/runtime/samples/binding-this-with-context/_config.js index 66e862b6ea..2162d7d184 100644 --- a/test/runtime/samples/binding-this-with-context/_config.js +++ b/test/runtime/samples/binding-this-with-context/_config.js @@ -12,9 +12,17 @@ export default { }); elems = target.querySelectorAll('span'); - assert.equal(Object.keys(component.spans).length, 3, 'three spans are registered (unkeyed object)'); + assert.equal( + Object.keys(component.spans).length, + 3, + 'three spans are registered (unkeyed object)' + ); component.items.forEach((e, i) => { - assert.equal(component.spans[`-${e}${i}`], elems[i], `span -${e}${i} is correct (unkeyed object)`); + assert.equal( + component.spans[`-${e}${i}`], + elems[i], + `span -${e}${i} is correct (unkeyed object)` + ); }); elems = target.querySelectorAll('p'); diff --git a/test/runtime/samples/binding-using-props/_config.js b/test/runtime/samples/binding-using-props/_config.js index 2e5fef1f4f..b3de6fad7d 100644 --- a/test/runtime/samples/binding-using-props/_config.js +++ b/test/runtime/samples/binding-using-props/_config.js @@ -1,14 +1,17 @@ export default { async test({ assert, target, window }) { const input = target.querySelector('input'); - + const event = new window.Event('input'); input.value = 'changed'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

changed

- `); + ` + ); } }; diff --git a/test/runtime/samples/bitmask-overflow-slot-2/_config.js b/test/runtime/samples/bitmask-overflow-slot-2/_config.js index 1f9613711a..a0167e8ab9 100644 --- a/test/runtime/samples/bitmask-overflow-slot-2/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-2/_config.js @@ -47,7 +47,9 @@ export default { component._1 = 'b'; component._2 = 'c'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

d1

d2

d3

@@ -86,7 +88,8 @@ export default {

a

b

c

- `); + ` + ); assert.deepEqual(component.reads, { _0: 2, diff --git a/test/runtime/samples/bitmask-overflow-slot-3/_config.js b/test/runtime/samples/bitmask-overflow-slot-3/_config.js index 7921253e18..91789300ec 100644 --- a/test/runtime/samples/bitmask-overflow-slot-3/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-3/_config.js @@ -1,5 +1,4 @@ export default { - html: `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40

0

@@ -11,20 +10,26 @@ export default { const button = target.querySelector('button'); await button.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40

1

- `); + ` + ); // change from outside component._0 = 'a'; component._40 = 'b'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

a_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39b

1

- `); + ` + ); } }; diff --git a/test/runtime/samples/bitmask-overflow-slot-4/_config.js b/test/runtime/samples/bitmask-overflow-slot-4/_config.js index 5aa339afd6..8e97a97282 100644 --- a/test/runtime/samples/bitmask-overflow-slot-4/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-4/_config.js @@ -11,31 +11,40 @@ export default { const button = target.querySelector('button'); await button.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40

0

1

- `); + ` + ); // change from outside component._0 = 'a'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40

a

1

- `); + ` + ); // change from outside through props component._40 = 'b'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39b

a

1

- `); + ` + ); } }; diff --git a/test/runtime/samples/bitmask-overflow-slot-5/_config.js b/test/runtime/samples/bitmask-overflow-slot-5/_config.js index 80900d0042..0c18abd9f5 100644 --- a/test/runtime/samples/bitmask-overflow-slot-5/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-5/_config.js @@ -13,37 +13,46 @@ export default { const button = target.querySelector('button'); await button.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40

b

-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40

0

1

- `); + ` + ); // change from outside component.a = 'AA'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40

b

-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40

AA

1

- `); + ` + ); // change from outside through props component.b = 'BB'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40

BB

-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40

AA

1

- `); + ` + ); } }; diff --git a/test/runtime/samples/bitmask-overflow-slot-6/_config.js b/test/runtime/samples/bitmask-overflow-slot-6/_config.js index 3bcf4b98e4..50e4b21dc1 100644 --- a/test/runtime/samples/bitmask-overflow-slot-6/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-6/_config.js @@ -12,21 +12,27 @@ export default { const div = target.querySelector('div'); await div.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
Open
- `); + ` + ); await button.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
Open
- `); + ` + ); } }; diff --git a/test/runtime/samples/bitmask-overflow-slot/_config.js b/test/runtime/samples/bitmask-overflow-slot/_config.js index a14ef3270f..ec9e08b9ed 100644 --- a/test/runtime/samples/bitmask-overflow-slot/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot/_config.js @@ -61,7 +61,9 @@ export default { component._36 = 'h'; component._37 = 'i'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

a

1

2

@@ -107,7 +109,8 @@ export default {

g:i

38

a

- `); + ` + ); assert.deepEqual(component.reads, { _0: 1, diff --git a/test/runtime/samples/bitmask-overflow/_config.js b/test/runtime/samples/bitmask-overflow/_config.js index e5e54ac10e..08d280db63 100644 --- a/test/runtime/samples/bitmask-overflow/_config.js +++ b/test/runtime/samples/bitmask-overflow/_config.js @@ -60,7 +60,9 @@ export default { component._36 = 'h'; component._37 = 'i'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

a

1

2

@@ -105,7 +107,8 @@ export default {

f:h

g:i

38

- `); + ` + ); assert.deepEqual(component.reads, { _0: 1, diff --git a/test/runtime/samples/class-helper/_config.js b/test/runtime/samples/class-helper/_config.js index 6a62476493..61f1d84503 100644 --- a/test/runtime/samples/class-helper/_config.js +++ b/test/runtime/samples/class-helper/_config.js @@ -8,8 +8,11 @@ export default { test({ assert, component, target }) { component.user = { active: false }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/class-in-each/_config.js b/test/runtime/samples/class-in-each/_config.js index 9ce2b5db8c..8e96dd3789 100644 --- a/test/runtime/samples/class-in-each/_config.js +++ b/test/runtime/samples/class-in-each/_config.js @@ -12,10 +12,13 @@ export default { test({ assert, component, target }) { component.selected = 'three'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/class-shortcut-with-class/_config.js b/test/runtime/samples/class-shortcut-with-class/_config.js index 5f2f28555e..adbe1e69de 100644 --- a/test/runtime/samples/class-shortcut-with-class/_config.js +++ b/test/runtime/samples/class-shortcut-with-class/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.foo = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/class-shortcut/_config.js b/test/runtime/samples/class-shortcut/_config.js index ac5be276b0..b339027d65 100644 --- a/test/runtime/samples/class-shortcut/_config.js +++ b/test/runtime/samples/class-shortcut/_config.js @@ -9,8 +9,11 @@ export default { test({ assert, component, target }) { component.foo = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js b/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js index 0c357926e2..e38b224868 100644 --- a/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js +++ b/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js @@ -14,8 +14,11 @@ export default { 'aria-label': 'Test' }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/class-with-dynamic-attribute/_config.js b/test/runtime/samples/class-with-dynamic-attribute/_config.js index 8e05c72065..594f9cb597 100644 --- a/test/runtime/samples/class-with-dynamic-attribute/_config.js +++ b/test/runtime/samples/class-with-dynamic-attribute/_config.js @@ -8,8 +8,11 @@ export default { test({ assert, component, target }) { component.myClass = 'one'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/class-with-spread/_config.js b/test/runtime/samples/class-with-spread/_config.js index d49b3f053e..74f80ef10d 100644 --- a/test/runtime/samples/class-with-spread/_config.js +++ b/test/runtime/samples/class-with-spread/_config.js @@ -14,8 +14,11 @@ export default { 'aria-label': 'Test' }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-blowback-b/_config.js b/test/runtime/samples/component-binding-blowback-b/_config.js index 2f6350c4fb..73471f268e 100644 --- a/test/runtime/samples/component-binding-blowback-b/_config.js +++ b/test/runtime/samples/component-binding-blowback-b/_config.js @@ -20,7 +20,9 @@ export default { input.value = 4; await input.dispatchEvent(new window.Event('input')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
  1. id-0: value is zero
  2. @@ -28,6 +30,7 @@ export default {
  3. id-2: value is two
  4. id-3: value is three
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-blowback-c/_config.js b/test/runtime/samples/component-binding-blowback-c/_config.js index 5ff0ae34f6..ed3f5dcb54 100644 --- a/test/runtime/samples/component-binding-blowback-c/_config.js +++ b/test/runtime/samples/component-binding-blowback-c/_config.js @@ -20,7 +20,9 @@ export default { input.value = 4; await input.dispatchEvent(new window.Event('input')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
  1. id-3: value is three
  2. @@ -28,6 +30,7 @@ export default {
  3. id-1: value is one
  4. id-0: value is zero
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-blowback-d/_config.js b/test/runtime/samples/component-binding-blowback-d/_config.js index 1716eb6ff9..a58b56c617 100644 --- a/test/runtime/samples/component-binding-blowback-d/_config.js +++ b/test/runtime/samples/component-binding-blowback-d/_config.js @@ -12,12 +12,15 @@ export default { await button.dispatchEvent(new window.Event('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

{"value":"0:0"}

{"value":"1:0"}

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-blowback-e/_config.js b/test/runtime/samples/component-binding-blowback-e/_config.js index 1c0e6aa0e1..32469da55a 100644 --- a/test/runtime/samples/component-binding-blowback-e/_config.js +++ b/test/runtime/samples/component-binding-blowback-e/_config.js @@ -12,12 +12,15 @@ export default { await button.dispatchEvent(new window.Event('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

{"value":{"i":0,"j":0}}

{"value":{"i":1,"j":0}}

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-blowback-f/_config.js b/test/runtime/samples/component-binding-blowback-f/_config.js index 46f6b379f6..cb3b5559fa 100644 --- a/test/runtime/samples/component-binding-blowback-f/_config.js +++ b/test/runtime/samples/component-binding-blowback-f/_config.js @@ -20,12 +20,15 @@ export default { await button.dispatchEvent(new window.Event('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

{"value":{"i":0,"j":0}}

{"value":{"i":1,"j":0}}

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-conditional-b/_config.js b/test/runtime/samples/component-binding-conditional-b/_config.js index 9a48befe13..4718057cad 100644 --- a/test/runtime/samples/component-binding-conditional-b/_config.js +++ b/test/runtime/samples/component-binding-conditional-b/_config.js @@ -16,9 +16,12 @@ export default { test({ assert, component, target }) { component.x = false; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

y: foo

y: foo

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-conditional/_config.js b/test/runtime/samples/component-binding-conditional/_config.js index 65d8dea2a7..5862ca7f22 100644 --- a/test/runtime/samples/component-binding-conditional/_config.js +++ b/test/runtime/samples/component-binding-conditional/_config.js @@ -9,9 +9,12 @@ export default { test({ assert, component, target }) { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

y: bar

y: bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-deep-b/_config.js b/test/runtime/samples/component-binding-deep-b/_config.js index 5adee6eac1..259367acd9 100644 --- a/test/runtime/samples/component-binding-deep-b/_config.js +++ b/test/runtime/samples/component-binding-deep-b/_config.js @@ -38,7 +38,9 @@ export default { await textarea.dispatchEvent(event); assert.equal(component.compiled, 'ONE SOURCE CHANGED\nTWO SOURCE'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
ONE SOURCE CHANGED\nTWO SOURCE
- `); + ` + ); // const select = target.querySelector('select'); // console.log(`select.options[0].selected`, select.options[0].selected) @@ -68,7 +71,9 @@ export default { await textarea.dispatchEvent(event); assert.equal(component.compiled, 'ONE SOURCE CHANGED\nTWO SOURCE CHANGED'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
ONE SOURCE CHANGED\nTWO SOURCE CHANGED
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-deep/_config.js b/test/runtime/samples/component-binding-deep/_config.js index 8a2f5a56cf..8103bfa2b8 100644 --- a/test/runtime/samples/component-binding-deep/_config.js +++ b/test/runtime/samples/component-binding-deep/_config.js @@ -17,9 +17,12 @@ export default { await input.dispatchEvent(event); assert.deepEqual(component.deep, { name: 'blah' }); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

blah

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-each-nested/_config.js b/test/runtime/samples/component-binding-each-nested/_config.js index 45644eec0f..a4d0d12011 100644 --- a/test/runtime/samples/component-binding-each-nested/_config.js +++ b/test/runtime/samples/component-binding-each-nested/_config.js @@ -19,9 +19,12 @@ export default { await inputs[0].dispatchEvent(event); assert.deepEqual(component.a, [{ name: 'blah' }, { name: 'bar' }, { name: 'baz' }]); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

blah, bar, baz

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-each-object/_config.js b/test/runtime/samples/component-binding-each-object/_config.js index 12b4094f2a..dfdbfd5cbe 100644 --- a/test/runtime/samples/component-binding-each-object/_config.js +++ b/test/runtime/samples/component-binding-each-object/_config.js @@ -8,13 +8,13 @@ export default { `, test({ assert, component, target }) { - component.a = [ - { id: 'yep' }, - { id: 'nope' } - ]; + component.a = [{ id: 'yep' }, { id: 'nope' }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` yepnope - `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-each-remount-keyed/_config.js b/test/runtime/samples/component-binding-each-remount-keyed/_config.js index 181c1bce8b..a0d2a60173 100644 --- a/test/runtime/samples/component-binding-each-remount-keyed/_config.js +++ b/test/runtime/samples/component-binding-each-remount-keyed/_config.js @@ -35,7 +35,9 @@ export default { async test({ assert, component, target }) { await component.done; assert.equal(component.getCounter(), 13); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
0 1 @@ -48,6 +50,7 @@ export default { 0 1
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-each-remount-unkeyed/_config.js b/test/runtime/samples/component-binding-each-remount-unkeyed/_config.js index 181c1bce8b..a0d2a60173 100644 --- a/test/runtime/samples/component-binding-each-remount-unkeyed/_config.js +++ b/test/runtime/samples/component-binding-each-remount-unkeyed/_config.js @@ -35,7 +35,9 @@ export default { async test({ assert, component, target }) { await component.done; assert.equal(component.getCounter(), 13); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
0 1 @@ -48,6 +50,7 @@ export default { 0 1
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-each/_config.js b/test/runtime/samples/component-binding-each/_config.js index ed49e194f4..51dfab3d93 100644 --- a/test/runtime/samples/component-binding-each/_config.js +++ b/test/runtime/samples/component-binding-each/_config.js @@ -19,9 +19,12 @@ export default { await inputs[0].dispatchEvent(event); assert.deepEqual(component.a, ['blah', 'bar', 'baz']); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

blah, bar, baz

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-infinite-loop/_config.js b/test/runtime/samples/component-binding-infinite-loop/_config.js index 92c5d5cd39..71f9ccf1b9 100644 --- a/test/runtime/samples/component-binding-infinite-loop/_config.js +++ b/test/runtime/samples/component-binding-infinite-loop/_config.js @@ -32,7 +32,9 @@ export default { await spans[0].dispatchEvent(click); assert.equal(component.currentIdentifier, 1); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

1

2

3

@@ -56,12 +58,15 @@ export default {

3

2

1

- `); + ` + ); await spans[0].dispatchEvent(click); assert.equal(component.currentIdentifier, null); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

1

2

3

@@ -85,6 +90,7 @@ export default {

3

2

1

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-nested/_config.js b/test/runtime/samples/component-binding-nested/_config.js index 77a4d5c1ab..f2d602e4f2 100644 --- a/test/runtime/samples/component-binding-nested/_config.js +++ b/test/runtime/samples/component-binding-nested/_config.js @@ -22,7 +22,9 @@ export default { await buttons[0].dispatchEvent(click); assert.equal(component.x, 'p'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: p

foo x: p

@@ -30,12 +32,15 @@ export default {

bar x: p

baz x: p

- `); + ` + ); await buttons[1].dispatchEvent(click); assert.equal(component.x, 'q'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: q

foo x: q

@@ -43,12 +48,15 @@ export default {

bar x: q

baz x: q

- `); + ` + ); await buttons[2].dispatchEvent(click); assert.equal(component.x, 'r'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: r

foo x: r

@@ -56,6 +64,7 @@ export default {

bar x: r

baz x: r

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-non-leaky/_config.js b/test/runtime/samples/component-binding-non-leaky/_config.js index 1b6f29dd74..3fcf6bf34d 100644 --- a/test/runtime/samples/component-binding-non-leaky/_config.js +++ b/test/runtime/samples/component-binding-non-leaky/_config.js @@ -11,17 +11,23 @@ export default { await button.dispatchEvent(click); assert.equal(component.x, undefined); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

count: undefined

- `); + ` + ); await button.dispatchEvent(click); assert.equal(component.x, undefined); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

count: undefined

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-onMount/_config.js b/test/runtime/samples/component-binding-onMount/_config.js index 4ae78b588a..e831e6e573 100644 --- a/test/runtime/samples/component-binding-onMount/_config.js +++ b/test/runtime/samples/component-binding-onMount/_config.js @@ -1,11 +1,14 @@ export default { async test({ assert, target }) { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bound? true

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-parent-supercedes-child-b/_config.js b/test/runtime/samples/component-binding-parent-supercedes-child-b/_config.js index 4e31a4d79c..952b414ead 100644 --- a/test/runtime/samples/component-binding-parent-supercedes-child-b/_config.js +++ b/test/runtime/samples/component-binding-parent-supercedes-child-b/_config.js @@ -7,25 +7,34 @@ export default { async test({ assert, component, target }) { component.a = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar: yes

x in parent: yes

- `); + ` + ); component.a = true; assert.equal(component.x, 'yes'); component.x = undefined; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Foo: undefined

x in parent: undefined

- `); + ` + ); component.a = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar: no

x in parent: no

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-parent-supercedes-child-c/_config.js b/test/runtime/samples/component-binding-parent-supercedes-child-c/_config.js index 4e31a4d79c..952b414ead 100644 --- a/test/runtime/samples/component-binding-parent-supercedes-child-c/_config.js +++ b/test/runtime/samples/component-binding-parent-supercedes-child-c/_config.js @@ -7,25 +7,34 @@ export default { async test({ assert, component, target }) { component.a = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar: yes

x in parent: yes

- `); + ` + ); component.a = true; assert.equal(component.x, 'yes'); component.x = undefined; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Foo: undefined

x in parent: undefined

- `); + ` + ); component.a = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar: no

x in parent: no

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-parent-supercedes-child/_config.js b/test/runtime/samples/component-binding-parent-supercedes-child/_config.js index 4ba02c5913..e4dfd0664b 100644 --- a/test/runtime/samples/component-binding-parent-supercedes-child/_config.js +++ b/test/runtime/samples/component-binding-parent-supercedes-child/_config.js @@ -11,17 +11,23 @@ export default { await button.dispatchEvent(click); assert.equal(component.x, 11); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

count: 11

- `); + ` + ); await button.dispatchEvent(click); assert.equal(component.x, 12); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

count: 12

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-private-state/_config.js b/test/runtime/samples/component-binding-private-state/_config.js index f4f2fd6f83..b81952d8a0 100644 --- a/test/runtime/samples/component-binding-private-state/_config.js +++ b/test/runtime/samples/component-binding-private-state/_config.js @@ -7,25 +7,34 @@ export default { async test({ assert, component, target }) { component.a = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar: no

x in parent: undefined

- `); + ` + ); component.a = true; assert.equal(component.x, undefined); component.x = 'maybe'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Foo: yes

x in parent: maybe

- `); + ` + ); component.a = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar: no

x in parent: maybe

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-reactive-statement/_config.js b/test/runtime/samples/component-binding-reactive-statement/_config.js index 8b8d091c73..a447eb4e2c 100644 --- a/test/runtime/samples/component-binding-reactive-statement/_config.js +++ b/test/runtime/samples/component-binding-reactive-statement/_config.js @@ -10,29 +10,41 @@ export default { const buttons = target.querySelectorAll('button'); await buttons[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); await buttons[1].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); // reactive update, reset to 2 await buttons[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); // bound to main, reset to 2 await buttons[1].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding-self-destroying/_config.js b/test/runtime/samples/component-binding-self-destroying/_config.js index 17cf23881e..a585f7f289 100644 --- a/test/runtime/samples/component-binding-self-destroying/_config.js +++ b/test/runtime/samples/component-binding-self-destroying/_config.js @@ -13,15 +13,21 @@ export default { await target.querySelector('button').dispatchEvent(click); assert.equal(component.show, false); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); await target.querySelector('button').dispatchEvent(click); assert.equal(component.show, true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/component-binding/_config.js b/test/runtime/samples/component-binding/_config.js index 42b0d578ce..711bb7a4b8 100644 --- a/test/runtime/samples/component-binding/_config.js +++ b/test/runtime/samples/component-binding/_config.js @@ -13,17 +13,23 @@ export default { await button.dispatchEvent(click); assert.equal(component.x, 1); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

count: 1

- `); + ` + ); await button.dispatchEvent(click); assert.equal(component.x, 2); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

count: 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-data-dynamic-late/_config.js b/test/runtime/samples/component-data-dynamic-late/_config.js index 21a06791e2..865f8bf812 100644 --- a/test/runtime/samples/component-data-dynamic-late/_config.js +++ b/test/runtime/samples/component-data-dynamic-late/_config.js @@ -3,8 +3,11 @@ export default { component.q = 42; component.foo = true; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

42

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/component-data-dynamic-shorthand/_config.js b/test/runtime/samples/component-data-dynamic-shorthand/_config.js index 779966d4aa..02f8c2867f 100644 --- a/test/runtime/samples/component-data-dynamic-shorthand/_config.js +++ b/test/runtime/samples/component-data-dynamic-shorthand/_config.js @@ -8,6 +8,6 @@ export default { test({ assert, component, target }) { component.foo = 99; - assert.equal( target.innerHTML, '

foo: 99

' ); + assert.equal(target.innerHTML, '

foo: 99

'); } }; diff --git a/test/runtime/samples/component-data-dynamic/_config.js b/test/runtime/samples/component-data-dynamic/_config.js index 40436066fa..66a1559e06 100644 --- a/test/runtime/samples/component-data-dynamic/_config.js +++ b/test/runtime/samples/component-data-dynamic/_config.js @@ -19,11 +19,14 @@ export default { component.compound = 'rather boring'; component.go = { deeper: 'heart' }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo: wut

baz: 43 (number)

qux: this is a rather boring string

quux: heart

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-event-not-stale/_config.js b/test/runtime/samples/component-event-not-stale/_config.js index 7951afb9d5..5f7db9dd59 100644 --- a/test/runtime/samples/component-event-not-stale/_config.js +++ b/test/runtime/samples/component-event-not-stale/_config.js @@ -8,7 +8,7 @@ export default { const click = new window.MouseEvent('click'); const events = []; - component.$on('value', event => { + component.$on('value', (event) => { events.push(event.detail); }); @@ -20,11 +20,6 @@ export default { buttons[0].dispatchEvent(click); buttons[1].dispatchEvent(click); - assert.deepEqual(events, [ - { value: 1 }, - { value: 1 }, - { value: 2 }, - { value: 2 } - ]); + assert.deepEqual(events, [{ value: 1 }, { value: 1 }, { value: 2 }, { value: 2 }]); } }; diff --git a/test/runtime/samples/component-events-console/_config.js b/test/runtime/samples/component-events-console/_config.js index fc3b4daa85..6772f2aa25 100644 --- a/test/runtime/samples/component-events-console/_config.js +++ b/test/runtime/samples/component-events-console/_config.js @@ -6,15 +6,13 @@ export default { const messages = []; const log = console.log; - console.log = msg => { + console.log = (msg) => { messages.push(msg); }; try { button.dispatchEvent(new window.MouseEvent('click')); - assert.deepEqual(messages, [ - 'clicked' - ]); + assert.deepEqual(messages, ['clicked']); } catch (err) { console.log = log; throw err; diff --git a/test/runtime/samples/component-events-data/_config.js b/test/runtime/samples/component-events-data/_config.js index e4ef16c6f8..633186fe19 100644 --- a/test/runtime/samples/component-events-data/_config.js +++ b/test/runtime/samples/component-events-data/_config.js @@ -5,7 +5,7 @@ export default { const selected = []; - component.$on('select', event => { + component.$on('select', (event) => { selected.push(event.detail); }); @@ -14,11 +14,6 @@ export default { buttons[1].dispatchEvent(click); buttons[0].dispatchEvent(click); - assert.deepEqual(selected, [ - 'bar', - 'baz', - 'bar', - 'foo' - ]); + assert.deepEqual(selected, ['bar', 'baz', 'bar', 'foo']); } }; diff --git a/test/runtime/samples/component-events-each/_config.js b/test/runtime/samples/component-events-each/_config.js index 3165dda676..a360184f5f 100644 --- a/test/runtime/samples/component-events-each/_config.js +++ b/test/runtime/samples/component-events-each/_config.js @@ -16,7 +16,7 @@ export default { const clicks = []; - component.$on('foo', event => { + component.$on('foo', (event) => { clicks.push(event.detail); }); diff --git a/test/runtime/samples/component-events-nullish/_config.js b/test/runtime/samples/component-events-nullish/_config.js index 7c540b2a08..f03b527c14 100644 --- a/test/runtime/samples/component-events-nullish/_config.js +++ b/test/runtime/samples/component-events-nullish/_config.js @@ -2,7 +2,7 @@ export default { async test({ assert, component, window, target }) { const event = new window.MouseEvent('click'); const button = target.querySelector('button'); - + await button.dispatchEvent(event); assert.equal(component.logs.length, 0); } diff --git a/test/runtime/samples/component-events/_config.js b/test/runtime/samples/component-events/_config.js index 26034edc99..06c1df3ee6 100644 --- a/test/runtime/samples/component-events/_config.js +++ b/test/runtime/samples/component-events/_config.js @@ -8,7 +8,7 @@ export default { test({ assert, component }) { let count = 0; - component.$on('widgetTornDown', function() { + component.$on('widgetTornDown', function () { assert.equal(this, component); count += 1; }); diff --git a/test/runtime/samples/component-if-placement/_config.js b/test/runtime/samples/component-if-placement/_config.js index abeda9e9be..007855f7aa 100644 --- a/test/runtime/samples/component-if-placement/_config.js +++ b/test/runtime/samples/component-if-placement/_config.js @@ -11,10 +11,13 @@ export default { test({ assert, component, target }) { component.flag = false; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` Before Component After - `); + ` + ); } }; diff --git a/test/runtime/samples/component-name-deconflicted/_config.js b/test/runtime/samples/component-name-deconflicted/_config.js index 5813042745..8c97e2a1eb 100644 --- a/test/runtime/samples/component-name-deconflicted/_config.js +++ b/test/runtime/samples/component-name-deconflicted/_config.js @@ -7,9 +7,12 @@ export default { test({ assert, component, target }) { component.list = [3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 3 4 - `); + ` + ); } }; diff --git a/test/runtime/samples/component-namespaced/_config.js b/test/runtime/samples/component-namespaced/_config.js index 7ec4a35c6d..b9c88ff70d 100644 --- a/test/runtime/samples/component-namespaced/_config.js +++ b/test/runtime/samples/component-namespaced/_config.js @@ -9,8 +9,11 @@ export default { test({ assert, component, target }) { component.a = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-not-constructor2-dev/_config.js b/test/runtime/samples/component-not-constructor2-dev/_config.js index 98e3cc942b..dd403ae371 100644 --- a/test/runtime/samples/component-not-constructor2-dev/_config.js +++ b/test/runtime/samples/component-not-constructor2-dev/_config.js @@ -13,7 +13,10 @@ export default { component.componentName = 'banana'; throw new Error('Expected an error'); } catch (err) { - assert.equal(err.message, 'this={...} of should specify a Svelte component.'); + assert.equal( + err.message, + 'this={...} of should specify a Svelte component.' + ); } } }; diff --git a/test/runtime/samples/component-slot-binding-dimensions-destroys-cleanly/_config.js b/test/runtime/samples/component-slot-binding-dimensions-destroys-cleanly/_config.js index 02a61bed5e..ff8b4c5632 100644 --- a/test/runtime/samples/component-slot-binding-dimensions-destroys-cleanly/_config.js +++ b/test/runtime/samples/component-slot-binding-dimensions-destroys-cleanly/_config.js @@ -1,2 +1 @@ -export default { -}; +export default {}; diff --git a/test/runtime/samples/component-slot-context-props-each-nested/_config.js b/test/runtime/samples/component-slot-context-props-each-nested/_config.js index 869cc555b1..aa4df4200a 100644 --- a/test/runtime/samples/component-slot-context-props-each-nested/_config.js +++ b/test/runtime/samples/component-slot-context-props-each-nested/_config.js @@ -13,10 +13,7 @@ export default { assert.deepEqual(component.log, ['setKey(a, value-a-c, c)']); await btn2.dispatchEvent(click); - assert.deepEqual(component.log, [ - 'setKey(a, value-a-c, c)', - 'setKey(b, value-b-c, c)' - ]); + assert.deepEqual(component.log, ['setKey(a, value-a-c, c)', 'setKey(b, value-b-c, c)']); await btn3.dispatchEvent(click); assert.deepEqual(component.log, [ diff --git a/test/runtime/samples/component-slot-context-props-each/_config.js b/test/runtime/samples/component-slot-context-props-each/_config.js index f374e7f827..c993cdfb39 100644 --- a/test/runtime/samples/component-slot-context-props-each/_config.js +++ b/test/runtime/samples/component-slot-context-props-each/_config.js @@ -11,9 +11,6 @@ export default { assert.deepEqual(component.log, ['setKey(a, value-a)']); await btn2.dispatchEvent(click); - assert.deepEqual(component.log, [ - 'setKey(a, value-a)', - 'setKey(b, value-b)' - ]); + assert.deepEqual(component.log, ['setKey(a, value-a)', 'setKey(b, value-b)']); } }; diff --git a/test/runtime/samples/component-slot-context-props-let/_config.js b/test/runtime/samples/component-slot-context-props-let/_config.js index f374e7f827..c993cdfb39 100644 --- a/test/runtime/samples/component-slot-context-props-let/_config.js +++ b/test/runtime/samples/component-slot-context-props-let/_config.js @@ -11,9 +11,6 @@ export default { assert.deepEqual(component.log, ['setKey(a, value-a)']); await btn2.dispatchEvent(click); - assert.deepEqual(component.log, [ - 'setKey(a, value-a)', - 'setKey(b, value-b)' - ]); + assert.deepEqual(component.log, ['setKey(a, value-a)', 'setKey(b, value-b)']); } }; diff --git a/test/runtime/samples/component-slot-each-block/_config.js b/test/runtime/samples/component-slot-each-block/_config.js index d66f613bb4..764af7274d 100644 --- a/test/runtime/samples/component-slot-each-block/_config.js +++ b/test/runtime/samples/component-slot-each-block/_config.js @@ -12,13 +12,16 @@ export default { test({ assert, component, target }) { component.things = [1, 2, 3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-fallback-6/_config.js b/test/runtime/samples/component-slot-fallback-6/_config.js index be47d31d03..25f2a90119 100644 --- a/test/runtime/samples/component-slot-fallback-6/_config.js +++ b/test/runtime/samples/component-slot-fallback-6/_config.js @@ -14,9 +14,12 @@ export default { input.value = 'abc'; await input.dispatchEvent(new window.Event('input')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` {"value":"abc"} - `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-if-block-before-node/_config.js b/test/runtime/samples/component-slot-if-block-before-node/_config.js index dd0fa69981..fc8e62db35 100644 --- a/test/runtime/samples/component-slot-if-block-before-node/_config.js +++ b/test/runtime/samples/component-slot-if-block-before-node/_config.js @@ -6,11 +6,14 @@ export default { test({ assert, component, target }) { component.foo = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

conditional

unconditional

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-if-block/_config.js b/test/runtime/samples/component-slot-if-block/_config.js index 08bfef8999..dcd57edd66 100644 --- a/test/runtime/samples/component-slot-if-block/_config.js +++ b/test/runtime/samples/component-slot-if-block/_config.js @@ -6,11 +6,14 @@ export default { test({ assert, component, target }) { component.foo = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

unconditional

conditional

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-if-else-block-before-node/_config.js b/test/runtime/samples/component-slot-if-else-block-before-node/_config.js index 8aaaa93193..6c2e000a6c 100644 --- a/test/runtime/samples/component-slot-if-else-block-before-node/_config.js +++ b/test/runtime/samples/component-slot-if-else-block-before-node/_config.js @@ -5,9 +5,12 @@ export default { test({ assert, component, target }) { component.enabled = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

enabled

unconditional

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-aliased/_config.js b/test/runtime/samples/component-slot-let-aliased/_config.js index d66f613bb4..764af7274d 100644 --- a/test/runtime/samples/component-slot-let-aliased/_config.js +++ b/test/runtime/samples/component-slot-let-aliased/_config.js @@ -12,13 +12,16 @@ export default { test({ assert, component, target }) { component.things = [1, 2, 3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-b/_config.js b/test/runtime/samples/component-slot-let-b/_config.js index f13a3b2bb6..74bb7132fd 100644 --- a/test/runtime/samples/component-slot-let-b/_config.js +++ b/test/runtime/samples/component-slot-let-b/_config.js @@ -10,9 +10,12 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 1 - `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-c/_config.js b/test/runtime/samples/component-slot-let-c/_config.js index fe8e68b1ac..002fd18e41 100644 --- a/test/runtime/samples/component-slot-let-c/_config.js +++ b/test/runtime/samples/component-slot-let-c/_config.js @@ -10,9 +10,12 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 1 (undefined) - `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-d/_config.js b/test/runtime/samples/component-slot-let-d/_config.js index e293ae136c..64d4e57849 100644 --- a/test/runtime/samples/component-slot-let-d/_config.js +++ b/test/runtime/samples/component-slot-let-d/_config.js @@ -11,10 +11,13 @@ export default { await div.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

b

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-destructured-2/_config.js b/test/runtime/samples/component-slot-let-destructured-2/_config.js index e407dcf2f8..95aaf168a3 100644 --- a/test/runtime/samples/component-slot-let-destructured-2/_config.js +++ b/test/runtime/samples/component-slot-let-destructured-2/_config.js @@ -18,7 +18,9 @@ export default { const event = new window.MouseEvent('click'); await button1.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
hello world 1 hello @@ -31,10 +33,13 @@ export default { hello world 0 hello
- `); + ` + ); await button2.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
hello world 1 hello @@ -47,10 +52,13 @@ export default { hello world 0 hello
- `); + ` + ); await button3.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
hello world 1 hello @@ -63,6 +71,7 @@ export default { hello world 1 hello
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-destructured/_config.js b/test/runtime/samples/component-slot-let-destructured/_config.js index d7aaae2d77..5330d425fa 100644 --- a/test/runtime/samples/component-slot-let-destructured/_config.js +++ b/test/runtime/samples/component-slot-let-destructured/_config.js @@ -1,10 +1,6 @@ export default { props: { - things: [ - { num: 1 }, - { num: 2 }, - { num: 3 } - ] + things: [{ num: 1 }, { num: 2 }, { num: 3 }] }, html: ` @@ -15,20 +11,18 @@ export default { `, test({ assert, component, target }) { - component.things = [ - { num: 1 }, - { num: 2 }, - { num: 3 }, - { num: 4 } - ]; + component.things = [{ num: 1 }, { num: 2 }, { num: 3 }, { num: 4 }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-e/_config.js b/test/runtime/samples/component-slot-let-e/_config.js index 1f7633da0c..6c3cac4374 100644 --- a/test/runtime/samples/component-slot-let-e/_config.js +++ b/test/runtime/samples/component-slot-let-e/_config.js @@ -11,10 +11,13 @@ export default { await div.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-f/_config.js b/test/runtime/samples/component-slot-let-f/_config.js index 74de38be02..1ececbb3ef 100644 --- a/test/runtime/samples/component-slot-let-f/_config.js +++ b/test/runtime/samples/component-slot-let-f/_config.js @@ -7,9 +7,12 @@ export default { async test({ assert, target, component }) { component.x = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 2 2 - `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-g/_config.js b/test/runtime/samples/component-slot-let-g/_config.js index aaa9895ea8..a9489f62c5 100644 --- a/test/runtime/samples/component-slot-let-g/_config.js +++ b/test/runtime/samples/component-slot-let-g/_config.js @@ -6,17 +6,23 @@ export default { async test({ assert, target, component, window }) { component.x = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 2 0 - `); + ` + ); const span = target.querySelector('span'); await span.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 2 2 - `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let-in-slot/_config.js b/test/runtime/samples/component-slot-let-in-slot/_config.js index eb16c27fda..b7b29a899d 100644 --- a/test/runtime/samples/component-slot-let-in-slot/_config.js +++ b/test/runtime/samples/component-slot-let-in-slot/_config.js @@ -7,6 +7,6 @@ export default { test({ assert, component, target }) { component.prop = 'b'; - assert.htmlEqual( target.innerHTML, 'b' ); + assert.htmlEqual(target.innerHTML, 'b'); } }; diff --git a/test/runtime/samples/component-slot-let-inline-function/_config.js b/test/runtime/samples/component-slot-let-inline-function/_config.js index 55318efaea..58b7d783da 100644 --- a/test/runtime/samples/component-slot-let-inline-function/_config.js +++ b/test/runtime/samples/component-slot-let-inline-function/_config.js @@ -19,7 +19,7 @@ export default { assert.deepEqual(logs, ['a: a, b: b']); - component.a = '1'; + component.a = '1'; component.b = '2'; await button.dispatchEvent(new window.MouseEvent('click')); assert.deepEqual(logs, ['a: a, b: b', 'a: 1, b: 2']); diff --git a/test/runtime/samples/component-slot-let-named/_config.js b/test/runtime/samples/component-slot-let-named/_config.js index f65448af93..bf38832b72 100644 --- a/test/runtime/samples/component-slot-let-named/_config.js +++ b/test/runtime/samples/component-slot-let-named/_config.js @@ -12,13 +12,16 @@ export default { test({ assert, component, target }) { component.things = [1, 2, 3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1
2
3
4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-let/_config.js b/test/runtime/samples/component-slot-let/_config.js index d66f613bb4..764af7274d 100644 --- a/test/runtime/samples/component-slot-let/_config.js +++ b/test/runtime/samples/component-slot-let/_config.js @@ -12,13 +12,16 @@ export default { test({ assert, component, target }) { component.things = [1, 2, 3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js b/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js index 8297162b91..df550a6790 100644 --- a/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js +++ b/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js @@ -13,13 +13,16 @@ export default { await button.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

count in default slot: 1

count in foo slot: 1

count in bar slot: 1

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-nested-error-2/_config.js b/test/runtime/samples/component-slot-nested-error-2/_config.js index 08c436b16d..afece8880b 100644 --- a/test/runtime/samples/component-slot-nested-error-2/_config.js +++ b/test/runtime/samples/component-slot-nested-error-2/_config.js @@ -1,3 +1,5 @@ export default { - error: ["Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"] + error: [ + "Element with a slot='...' attribute must be a child of a component or a descendant of a custom element" + ] }; diff --git a/test/runtime/samples/component-slot-nested-error-3/_config.js b/test/runtime/samples/component-slot-nested-error-3/_config.js index 08c436b16d..afece8880b 100644 --- a/test/runtime/samples/component-slot-nested-error-3/_config.js +++ b/test/runtime/samples/component-slot-nested-error-3/_config.js @@ -1,3 +1,5 @@ export default { - error: ["Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"] + error: [ + "Element with a slot='...' attribute must be a child of a component or a descendant of a custom element" + ] }; diff --git a/test/runtime/samples/component-slot-nested-error/_config.js b/test/runtime/samples/component-slot-nested-error/_config.js index 08c436b16d..afece8880b 100644 --- a/test/runtime/samples/component-slot-nested-error/_config.js +++ b/test/runtime/samples/component-slot-nested-error/_config.js @@ -1,3 +1,5 @@ export default { - error: ["Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"] + error: [ + "Element with a slot='...' attribute must be a child of a component or a descendant of a custom element" + ] }; diff --git a/test/runtime/samples/component-slot-nested-in-slot/_config.js b/test/runtime/samples/component-slot-nested-in-slot/_config.js index 56a9ef2668..1af084fc6c 100644 --- a/test/runtime/samples/component-slot-nested-in-slot/_config.js +++ b/test/runtime/samples/component-slot-nested-in-slot/_config.js @@ -5,14 +5,20 @@ export default { test({ assert, component, target }) { component.a = 3; component.b = 4; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one: 3 two: 4

- `); + ` + ); component.a = 5; component.b = 6; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

one: 5 two: 6

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-spread-props/_config.js b/test/runtime/samples/component-slot-spread-props/_config.js index 7beda8d3d5..05e3f5ebfb 100644 --- a/test/runtime/samples/component-slot-spread-props/_config.js +++ b/test/runtime/samples/component-slot-spread-props/_config.js @@ -15,11 +15,14 @@ export default { async test({ assert, component, target }) { component.value = 'foo'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-spread/_config.js b/test/runtime/samples/component-slot-spread/_config.js index dfa2bd86fc..31554c2707 100644 --- a/test/runtime/samples/component-slot-spread/_config.js +++ b/test/runtime/samples/component-slot-spread/_config.js @@ -13,43 +13,58 @@ export default { test({ assert, target, component }) { component.obj = { a: 2, b: 50, c: 30 }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2

50

30

10

- `); + ` + ); component.c = 22; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2

50

30

10

- `); + ` + ); component.d = 44; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2

50

30

44

- `); - + ` + ); + component.obj = { a: 9, b: 12 }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

9

12

22

44

- `); + ` + ); component.c = 88; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

9

12

88

44

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-static-and-dynamic/_config.js b/test/runtime/samples/component-slot-static-and-dynamic/_config.js index 93ec069502..c1003a541e 100644 --- a/test/runtime/samples/component-slot-static-and-dynamic/_config.js +++ b/test/runtime/samples/component-slot-static-and-dynamic/_config.js @@ -9,11 +9,14 @@ export default { test({ assert, component, target }) { component.dynamic += 1; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
static 1
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-slot-warning/_config.js b/test/runtime/samples/component-slot-warning/_config.js index c1785f2764..b85c30fd4d 100644 --- a/test/runtime/samples/component-slot-warning/_config.js +++ b/test/runtime/samples/component-slot-warning/_config.js @@ -2,7 +2,5 @@ export default { compileOptions: { dev: true }, - warnings: [ - ' received an unexpected slot "slot1".' - ] + warnings: [' received an unexpected slot "slot1".'] }; diff --git a/test/runtime/samples/component-svelte-fragment-let-aliased/_config.js b/test/runtime/samples/component-svelte-fragment-let-aliased/_config.js index d66f613bb4..764af7274d 100644 --- a/test/runtime/samples/component-svelte-fragment-let-aliased/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-aliased/_config.js @@ -12,13 +12,16 @@ export default { test({ assert, component, target }) { component.things = [1, 2, 3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-b/_config.js b/test/runtime/samples/component-svelte-fragment-let-b/_config.js index f13a3b2bb6..74bb7132fd 100644 --- a/test/runtime/samples/component-svelte-fragment-let-b/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-b/_config.js @@ -10,9 +10,12 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 1 - `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-c/_config.js b/test/runtime/samples/component-svelte-fragment-let-c/_config.js index fe8e68b1ac..002fd18e41 100644 --- a/test/runtime/samples/component-svelte-fragment-let-c/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-c/_config.js @@ -10,9 +10,12 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 1 (undefined) - `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-d/_config.js b/test/runtime/samples/component-svelte-fragment-let-d/_config.js index e293ae136c..64d4e57849 100644 --- a/test/runtime/samples/component-svelte-fragment-let-d/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-d/_config.js @@ -11,10 +11,13 @@ export default { await div.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

b

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-destructured-2/_config.js b/test/runtime/samples/component-svelte-fragment-let-destructured-2/_config.js index e407dcf2f8..95aaf168a3 100644 --- a/test/runtime/samples/component-svelte-fragment-let-destructured-2/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-destructured-2/_config.js @@ -18,7 +18,9 @@ export default { const event = new window.MouseEvent('click'); await button1.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
hello world 1 hello @@ -31,10 +33,13 @@ export default { hello world 0 hello
- `); + ` + ); await button2.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
hello world 1 hello @@ -47,10 +52,13 @@ export default { hello world 0 hello
- `); + ` + ); await button3.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
hello world 1 hello @@ -63,6 +71,7 @@ export default { hello world 1 hello
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-destructured/_config.js b/test/runtime/samples/component-svelte-fragment-let-destructured/_config.js index d7aaae2d77..5330d425fa 100644 --- a/test/runtime/samples/component-svelte-fragment-let-destructured/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-destructured/_config.js @@ -1,10 +1,6 @@ export default { props: { - things: [ - { num: 1 }, - { num: 2 }, - { num: 3 } - ] + things: [{ num: 1 }, { num: 2 }, { num: 3 }] }, html: ` @@ -15,20 +11,18 @@ export default { `, test({ assert, component, target }) { - component.things = [ - { num: 1 }, - { num: 2 }, - { num: 3 }, - { num: 4 } - ]; + component.things = [{ num: 1 }, { num: 2 }, { num: 3 }, { num: 4 }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-e/_config.js b/test/runtime/samples/component-svelte-fragment-let-e/_config.js index 967955dfd8..92c7028eae 100644 --- a/test/runtime/samples/component-svelte-fragment-let-e/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-e/_config.js @@ -9,11 +9,14 @@ export default { async test({ assert, target, component }) { component.x = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 2 2 2 2 - `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-f/_config.js b/test/runtime/samples/component-svelte-fragment-let-f/_config.js index 73b90885b5..3489e501cb 100644 --- a/test/runtime/samples/component-svelte-fragment-let-f/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-f/_config.js @@ -6,17 +6,23 @@ export default { async test({ assert, target, component, window }) { component.x = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 2 0 - `); + ` + ); const span = target.querySelector('span'); await span.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 2 2 - `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-in-slot/_config.js b/test/runtime/samples/component-svelte-fragment-let-in-slot/_config.js index eb16c27fda..b7b29a899d 100644 --- a/test/runtime/samples/component-svelte-fragment-let-in-slot/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-in-slot/_config.js @@ -7,6 +7,6 @@ export default { test({ assert, component, target }) { component.prop = 'b'; - assert.htmlEqual( target.innerHTML, 'b' ); + assert.htmlEqual(target.innerHTML, 'b'); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let-named/_config.js b/test/runtime/samples/component-svelte-fragment-let-named/_config.js index f65448af93..bf38832b72 100644 --- a/test/runtime/samples/component-svelte-fragment-let-named/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let-named/_config.js @@ -12,13 +12,16 @@ export default { test({ assert, component, target }) { component.things = [1, 2, 3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1
2
3
4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-svelte-fragment-let/_config.js b/test/runtime/samples/component-svelte-fragment-let/_config.js index d66f613bb4..764af7274d 100644 --- a/test/runtime/samples/component-svelte-fragment-let/_config.js +++ b/test/runtime/samples/component-svelte-fragment-let/_config.js @@ -12,13 +12,16 @@ export default { test({ assert, component, target }) { component.things = [1, 2, 3, 4]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- `); + ` + ); } }; diff --git a/test/runtime/samples/component-yield-multiple-in-each/_config.js b/test/runtime/samples/component-yield-multiple-in-each/_config.js index 153a3a5601..36ca6cf1c5 100644 --- a/test/runtime/samples/component-yield-multiple-in-each/_config.js +++ b/test/runtime/samples/component-yield-multiple-in-each/_config.js @@ -6,12 +6,15 @@ export default { `, test({ assert, component, target }) { - component.people = [ 'Alice', 'Charles', 'Bob' ]; + component.people = ['Alice', 'Charles', 'Bob']; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Hello Alice

Hello Charles

Hello Bob

- `); + ` + ); } }; diff --git a/test/runtime/samples/component-yield-nested-if/_config.js b/test/runtime/samples/component-yield-nested-if/_config.js index b46996cea3..a10b31f536 100644 --- a/test/runtime/samples/component-yield-nested-if/_config.js +++ b/test/runtime/samples/component-yield-nested-if/_config.js @@ -6,9 +6,9 @@ export default { test({ assert, component, target }) { component.foo = false; - assert.htmlEqual( target.innerHTML, '' ); + assert.htmlEqual(target.innerHTML, ''); component.foo = true; - assert.htmlEqual( target.innerHTML, 'One\nInner' ); + assert.htmlEqual(target.innerHTML, 'One\nInner'); } }; diff --git a/test/runtime/samples/component-yield-parent/_config.js b/test/runtime/samples/component-yield-parent/_config.js index 1340893883..382fa07477 100644 --- a/test/runtime/samples/component-yield-parent/_config.js +++ b/test/runtime/samples/component-yield-parent/_config.js @@ -4,12 +4,15 @@ export default { `, test({ assert, component, target }) { - assert.equal( component.data, 'Hello' ); + assert.equal(component.data, 'Hello'); component.data = 'World'; - assert.equal( component.data, 'World' ); - assert.htmlEqual( target.innerHTML, ` + assert.equal(component.data, 'World'); + assert.htmlEqual( + target.innerHTML, + `

World

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/component-yield-placement/_config.js b/test/runtime/samples/component-yield-placement/_config.js index 089b3ce752..f044aeba3a 100644 --- a/test/runtime/samples/component-yield-placement/_config.js +++ b/test/runtime/samples/component-yield-placement/_config.js @@ -18,8 +18,11 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/component-yield-static/_config.js b/test/runtime/samples/component-yield-static/_config.js index 351c604bdd..871367d477 100644 --- a/test/runtime/samples/component-yield-static/_config.js +++ b/test/runtime/samples/component-yield-static/_config.js @@ -5,8 +5,11 @@ export default { test({ assert, component, target }) { component.name = 'World'; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` Hello World - ` ); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-await-then-destructuring-computed-in-computed/_config.js b/test/runtime/samples/const-tag-await-then-destructuring-computed-in-computed/_config.js index 9ec4a3e3e6..92e6d63147 100644 --- a/test/runtime/samples/const-tag-await-then-destructuring-computed-in-computed/_config.js +++ b/test/runtime/samples/const-tag-await-then-destructuring-computed-in-computed/_config.js @@ -5,16 +5,19 @@ export default { async test({ component, target, assert }) { component.permutation = [2, 3, 1]; - await (component.promise1 = Promise.resolve({length: 1, width: 2, height: 3})); + await (component.promise1 = Promise.resolve({ length: 1, width: 2, height: 3 })); try { - await (component.promise2 = Promise.reject({length: 97, width: 98, height: 99})); + await (component.promise2 = Promise.reject({ length: 97, width: 98, height: 99 })); } catch (e) { // nothing } - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2, 11, 2

9506, 28811, 98

- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-await-then-destructuring-computed-props/_config.js b/test/runtime/samples/const-tag-await-then-destructuring-computed-props/_config.js index 9ec4a3e3e6..92e6d63147 100644 --- a/test/runtime/samples/const-tag-await-then-destructuring-computed-props/_config.js +++ b/test/runtime/samples/const-tag-await-then-destructuring-computed-props/_config.js @@ -5,16 +5,19 @@ export default { async test({ component, target, assert }) { component.permutation = [2, 3, 1]; - await (component.promise1 = Promise.resolve({length: 1, width: 2, height: 3})); + await (component.promise1 = Promise.resolve({ length: 1, width: 2, height: 3 })); try { - await (component.promise2 = Promise.reject({length: 97, width: 98, height: 99})); + await (component.promise2 = Promise.reject({ length: 97, width: 98, height: 99 })); } catch (e) { // nothing } - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2, 11, 2

9506, 28811, 98

- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-await-then-destructuring-literals/_config.js b/test/runtime/samples/const-tag-await-then-destructuring-literals/_config.js index cb40e7c456..7f0fe80b0d 100644 --- a/test/runtime/samples/const-tag-await-then-destructuring-literals/_config.js +++ b/test/runtime/samples/const-tag-await-then-destructuring-literals/_config.js @@ -1,19 +1,25 @@ export default { html: '
12 120 70, 30+4=34
', async test({ component, target, assert }) { - component.promise1 = Promise.resolve({width: 5, height: 6}); - component.promise2 = Promise.reject({width: 6, height: 7}); + component.promise1 = Promise.resolve({ width: 5, height: 6 }); + component.promise2 = Promise.reject({ width: 6, height: 7 }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 300 110, 50+6=56
42 420 130, 60+7=67
- `); + ` + ); component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-await-then-destructuring-nested-rest/_config.js b/test/runtime/samples/const-tag-await-then-destructuring-nested-rest/_config.js index cb40e7c456..7f0fe80b0d 100644 --- a/test/runtime/samples/const-tag-await-then-destructuring-nested-rest/_config.js +++ b/test/runtime/samples/const-tag-await-then-destructuring-nested-rest/_config.js @@ -1,19 +1,25 @@ export default { html: '
12 120 70, 30+4=34
', async test({ component, target, assert }) { - component.promise1 = Promise.resolve({width: 5, height: 6}); - component.promise2 = Promise.reject({width: 6, height: 7}); + component.promise1 = Promise.resolve({ width: 5, height: 6 }); + component.promise2 = Promise.reject({ width: 6, height: 7 }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 300 110, 50+6=56
42 420 130, 60+7=67
- `); + ` + ); component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-await-then-destructuring/_config.js b/test/runtime/samples/const-tag-await-then-destructuring/_config.js index cb40e7c456..7f0fe80b0d 100644 --- a/test/runtime/samples/const-tag-await-then-destructuring/_config.js +++ b/test/runtime/samples/const-tag-await-then-destructuring/_config.js @@ -1,19 +1,25 @@ export default { html: '
12 120 70, 30+4=34
', async test({ component, target, assert }) { - component.promise1 = Promise.resolve({width: 5, height: 6}); - component.promise2 = Promise.reject({width: 6, height: 7}); + component.promise1 = Promise.resolve({ width: 5, height: 6 }); + component.promise2 = Promise.reject({ width: 6, height: 7 }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 300 110, 50+6=56
42 420 130, 60+7=67
- `); + ` + ); component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-await-then/_config.js b/test/runtime/samples/const-tag-await-then/_config.js index cb40e7c456..7f0fe80b0d 100644 --- a/test/runtime/samples/const-tag-await-then/_config.js +++ b/test/runtime/samples/const-tag-await-then/_config.js @@ -1,19 +1,25 @@ export default { html: '
12 120 70, 30+4=34
', async test({ component, target, assert }) { - component.promise1 = Promise.resolve({width: 5, height: 6}); - component.promise2 = Promise.reject({width: 6, height: 7}); + component.promise1 = Promise.resolve({ width: 5, height: 6 }); + component.promise2 = Promise.reject({ width: 6, height: 7 }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 300 110, 50+6=56
42 420 130, 60+7=67
- `); + ` + ); component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-component-without-let/_config.js b/test/runtime/samples/const-tag-component-without-let/_config.js index 047e034ce9..276b99c915 100644 --- a/test/runtime/samples/const-tag-component-without-let/_config.js +++ b/test/runtime/samples/const-tag-component-without-let/_config.js @@ -6,10 +6,13 @@ export default { `, async test({ component, target, assert }) { component.props = 'xxx'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
static xxx
static xxx
static xxx
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-component/_config.js b/test/runtime/samples/const-tag-component/_config.js index 66399a06fa..292df7ce98 100644 --- a/test/runtime/samples/const-tag-component/_config.js +++ b/test/runtime/samples/const-tag-component/_config.js @@ -14,7 +14,9 @@ export default { `, async test({ component, target, assert }) { component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
12 240 140, 60+4=64
12 240 140, 60+4=64
@@ -26,10 +28,13 @@ export default {
12 240 140, 60+4=64
12 240 140, 60+4=64
- `); + ` + ); - component.box = {width: 5, height: 6}; - assert.htmlEqual(target.innerHTML, ` + component.box = { width: 5, height: 6 }; + assert.htmlEqual( + target.innerHTML, + `
30 600 220, 100+6=106
30 600 220, 100+6=106
30 600 220, 100+6=106
@@ -41,6 +46,7 @@ export default {
30 600 220, 100+6=106
30 600 220, 100+6=106
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-dependencies/_config.js b/test/runtime/samples/const-tag-dependencies/_config.js index 5cbb2da587..05ee6339b7 100644 --- a/test/runtime/samples/const-tag-dependencies/_config.js +++ b/test/runtime/samples/const-tag-dependencies/_config.js @@ -5,8 +5,11 @@ export default { async test({ component, target, assert }) { component.a = 5; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
9
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-each-arrow/_config.js b/test/runtime/samples/const-tag-each-arrow/_config.js index 8e8036b851..e67d4aa4c5 100644 --- a/test/runtime/samples/const-tag-each-arrow/_config.js +++ b/test/runtime/samples/const-tag-each-arrow/_config.js @@ -7,11 +7,14 @@ export default { async test({ component, target, assert }) { component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

#FF0000

#00FF00

#0000FF

- `); + ` + ); component.tags = [ { @@ -36,12 +39,15 @@ export default { } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

#FF0000

#00FF00

#0000FF

#000000

#FFFFFF

- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-each-destructure-computed-in-computed/_config.js b/test/runtime/samples/const-tag-each-destructure-computed-in-computed/_config.js index c299f19da6..26036fcd0c 100644 --- a/test/runtime/samples/const-tag-each-destructure-computed-in-computed/_config.js +++ b/test/runtime/samples/const-tag-each-destructure-computed-in-computed/_config.js @@ -8,8 +8,6 @@ export default { async test({ component, target, assert }) { component.boxes = [{ length: 10, width: 20, height: 30 }]; - assert.htmlEqual(target.innerHTML, - '' - ); + assert.htmlEqual(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/const-tag-each-destructure-computed-props/_config.js b/test/runtime/samples/const-tag-each-destructure-computed-props/_config.js index c299f19da6..26036fcd0c 100644 --- a/test/runtime/samples/const-tag-each-destructure-computed-props/_config.js +++ b/test/runtime/samples/const-tag-each-destructure-computed-props/_config.js @@ -8,8 +8,6 @@ export default { async test({ component, target, assert }) { component.boxes = [{ length: 10, width: 20, height: 30 }]; - assert.htmlEqual(target.innerHTML, - '' - ); + assert.htmlEqual(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/const-tag-each-destructure-literals/_config.js b/test/runtime/samples/const-tag-each-destructure-literals/_config.js index 00f8b31540..6106fdfbd1 100644 --- a/test/runtime/samples/const-tag-each-destructure-literals/_config.js +++ b/test/runtime/samples/const-tag-each-destructure-literals/_config.js @@ -7,24 +7,30 @@ export default { async test({ component, target, assert }) { component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
35 700 240, 100+7=107
48 960 280, 120+8=128
- `); + ` + ); component.boxes = [ - {width: 3, height: 4}, - {width: 4, height: 5}, - {width: 5, height: 6}, - {width: 6, height: 7} + { width: 3, height: 4 }, + { width: 4, height: 5 }, + { width: 5, height: 6 }, + { width: 6, height: 7 } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
20 400 180, 80+5=85
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-each-destructure-nested-rest/_config.js b/test/runtime/samples/const-tag-each-destructure-nested-rest/_config.js index 00f8b31540..6106fdfbd1 100644 --- a/test/runtime/samples/const-tag-each-destructure-nested-rest/_config.js +++ b/test/runtime/samples/const-tag-each-destructure-nested-rest/_config.js @@ -7,24 +7,30 @@ export default { async test({ component, target, assert }) { component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
35 700 240, 100+7=107
48 960 280, 120+8=128
- `); + ` + ); component.boxes = [ - {width: 3, height: 4}, - {width: 4, height: 5}, - {width: 5, height: 6}, - {width: 6, height: 7} + { width: 3, height: 4 }, + { width: 4, height: 5 }, + { width: 5, height: 6 }, + { width: 6, height: 7 } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
20 400 180, 80+5=85
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-each-destructure/_config.js b/test/runtime/samples/const-tag-each-destructure/_config.js index 00f8b31540..6106fdfbd1 100644 --- a/test/runtime/samples/const-tag-each-destructure/_config.js +++ b/test/runtime/samples/const-tag-each-destructure/_config.js @@ -7,24 +7,30 @@ export default { async test({ component, target, assert }) { component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
35 700 240, 100+7=107
48 960 280, 120+8=128
- `); + ` + ); component.boxes = [ - {width: 3, height: 4}, - {width: 4, height: 5}, - {width: 5, height: 6}, - {width: 6, height: 7} + { width: 3, height: 4 }, + { width: 4, height: 5 }, + { width: 5, height: 6 }, + { width: 6, height: 7 } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
20 400 180, 80+5=85
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-each-else/_config.js b/test/runtime/samples/const-tag-each-else/_config.js index d95be09ccc..ab771a51e2 100644 --- a/test/runtime/samples/const-tag-each-else/_config.js +++ b/test/runtime/samples/const-tag-each-else/_config.js @@ -6,21 +6,28 @@ export default { `, async test({ component, target, assert }) { component.boxes = []; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
10 * 2 = 20
- `); - + ` + ); + component.constant = 35; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
35 * 2 = 70
- `); + ` + ); - component.boxes = [ - {width: 3, height: 4} - ]; + component.boxes = [{ width: 3, height: 4 }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 420 245, 105+4=109
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-each/_config.js b/test/runtime/samples/const-tag-each/_config.js index 00f8b31540..6106fdfbd1 100644 --- a/test/runtime/samples/const-tag-each/_config.js +++ b/test/runtime/samples/const-tag-each/_config.js @@ -7,24 +7,30 @@ export default { async test({ component, target, assert }) { component.constant = 20; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
35 700 240, 100+7=107
48 960 280, 120+8=128
- `); + ` + ); component.boxes = [ - {width: 3, height: 4}, - {width: 4, height: 5}, - {width: 5, height: 6}, - {width: 6, height: 7} + { width: 3, height: 4 }, + { width: 4, height: 5 }, + { width: 5, height: 6 }, + { width: 6, height: 7 } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
12 240 140, 60+4=64
20 400 180, 80+5=85
30 600 220, 100+6=106
42 840 260, 120+7=127
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-hoisting/_config.js b/test/runtime/samples/const-tag-hoisting/_config.js index f8f4a5c85e..68f1671ee6 100644 --- a/test/runtime/samples/const-tag-hoisting/_config.js +++ b/test/runtime/samples/const-tag-hoisting/_config.js @@ -5,8 +5,11 @@ export default { async test({ component, target, assert }) { component.value = 3; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
3 ^ 4 = 81
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-if-else-if/_config.js b/test/runtime/samples/const-tag-if-else-if/_config.js index 072eb2e44e..e4a5b92276 100644 --- a/test/runtime/samples/const-tag-if-else-if/_config.js +++ b/test/runtime/samples/const-tag-if-else-if/_config.js @@ -15,7 +15,7 @@ export default {
40 x 70
` ); - + component.boxes = []; assert.htmlEqual(target.innerHTML, ''); diff --git a/test/runtime/samples/const-tag-if-else/_config.js b/test/runtime/samples/const-tag-if-else/_config.js index 13e59bf836..bda55bcf59 100644 --- a/test/runtime/samples/const-tag-if-else/_config.js +++ b/test/runtime/samples/const-tag-if-else/_config.js @@ -5,38 +5,47 @@ export default { }, async test({ component, target, assert }) { component.boxes = [{ width: 30, height: 60 }]; - - assert.htmlEqual(target.innerHTML, ` + + assert.htmlEqual( + target.innerHTML, + `
30 x 60
- `); - + ` + ); + component.boxes = [ { width: 20, height: 40 }, { width: 30, height: 50 } ]; - - assert.htmlEqual(target.innerHTML, ` + + assert.htmlEqual( + target.innerHTML, + `
20 x 40
30 x 50
- `); + ` + ); component.boxes = [ { width: 80, height: 70 }, { width: 90, height: 60 } ]; - - assert.htmlEqual(target.innerHTML, ` + + assert.htmlEqual( + target.innerHTML, + `
80 x 70
90 x 60
- `); - + ` + ); + component.boxes = [ { width: 20, height: 40 }, { width: 30, height: 50 }, { width: 30, height: 50 } ]; assert.htmlEqual(target.innerHTML, '
3
'); - + component.boxes = []; assert.htmlEqual(target.innerHTML, '
0
'); } diff --git a/test/runtime/samples/const-tag-invalidate/_config.js b/test/runtime/samples/const-tag-invalidate/_config.js index bd4bdc2043..e38839776a 100644 --- a/test/runtime/samples/const-tag-invalidate/_config.js +++ b/test/runtime/samples/const-tag-invalidate/_config.js @@ -9,26 +9,35 @@ export default { await btn1.dispatchEvent(new window.MouseEvent('click')); await btn2.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
[N] A
[Y] B
[N] C
- `); + ` + ); await btn2.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
[N] A
[N] B
[N] C
- `); + ` + ); await btn3.dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
[N] A
[N] B
[Y] C
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-ordering/_config.js b/test/runtime/samples/const-tag-ordering/_config.js index f8f4a5c85e..68f1671ee6 100644 --- a/test/runtime/samples/const-tag-ordering/_config.js +++ b/test/runtime/samples/const-tag-ordering/_config.js @@ -5,8 +5,11 @@ export default { async test({ component, target, assert }) { component.value = 3; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
3 ^ 4 = 81
- `); + ` + ); } }; diff --git a/test/runtime/samples/const-tag-shadow/_config.js b/test/runtime/samples/const-tag-shadow/_config.js index 312235f113..831c67d612 100644 --- a/test/runtime/samples/const-tag-shadow/_config.js +++ b/test/runtime/samples/const-tag-shadow/_config.js @@ -13,7 +13,7 @@ export default { component.numbers = [ { a: 4, - b: 5, + b: 5, children: [ { a: 6, b: 7 }, { a: 8, b: 9 } @@ -21,7 +21,7 @@ export default { }, { a: 10, - b: 11, + b: 11, children: [ { a: 12, b: 13 }, { a: 14, b: 15 } @@ -29,7 +29,9 @@ export default { } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 9 13 17 @@ -38,6 +40,7 @@ export default { 25 29 21 - `); + ` + ); } }; diff --git a/test/runtime/samples/constructor-pass-context/_config.js b/test/runtime/samples/constructor-pass-context/_config.js index 02b58f5451..8a93d95853 100644 --- a/test/runtime/samples/constructor-pass-context/_config.js +++ b/test/runtime/samples/constructor-pass-context/_config.js @@ -23,10 +23,12 @@ export default { const Component = require('./Component.svelte').default; const called = []; - const { html } = Component.render(undefined, { context: new Map([ - ['key', 'svelte'], - ['fn', (value) => called.push(value)] - ]) }); + const { html } = Component.render(undefined, { + context: new Map([ + ['key', 'svelte'], + ['fn', (value) => called.push(value)] + ]) + }); assert.htmlEqual(html, '
svelte
'); } }; diff --git a/test/runtime/samples/context-api/_config.js b/test/runtime/samples/context-api/_config.js index 3856aa5424..c1f882f316 100644 --- a/test/runtime/samples/context-api/_config.js +++ b/test/runtime/samples/context-api/_config.js @@ -16,7 +16,9 @@ export default { await buttons[1].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
@@ -25,11 +27,14 @@ export default {

Large panel

- `); + ` + ); component.show_medium = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
@@ -39,13 +44,16 @@ export default {

Large panel

- `); + ` + ); buttons = target.querySelectorAll('button'); await buttons[1].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
@@ -55,11 +63,14 @@ export default {

Medium panel

- `); + ` + ); component.show_medium = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
@@ -68,6 +79,7 @@ export default {

Large panel

- `); + ` + ); } }; diff --git a/test/runtime/samples/context-in-await/_config.js b/test/runtime/samples/context-in-await/_config.js index fc498a36c2..15ae20f3a6 100644 --- a/test/runtime/samples/context-in-await/_config.js +++ b/test/runtime/samples/context-in-await/_config.js @@ -6,8 +6,11 @@ export default { async test({ assert, component, target }) { await component.promise; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Context value: 123

- `); + ` + ); } }; diff --git a/test/runtime/samples/css-comments/_config.js b/test/runtime/samples/css-comments/_config.js index baf571fcd1..44218f090e 100644 --- a/test/runtime/samples/css-comments/_config.js +++ b/test/runtime/samples/css-comments/_config.js @@ -1,7 +1,7 @@ // JSDOM makes this test pass when it should fail. weird export default { test({ assert, target, window }) { - const p = target.querySelector( 'p' ); - assert.equal( window.getComputedStyle( p ).color, 'red' ); + const p = target.querySelector('p'); + assert.equal(window.getComputedStyle(p).color, 'red'); } }; diff --git a/test/runtime/samples/css-false/_config.js b/test/runtime/samples/css-false/_config.js index 320efce35b..43aadcf01b 100644 --- a/test/runtime/samples/css-false/_config.js +++ b/test/runtime/samples/css-false/_config.js @@ -4,9 +4,9 @@ export default { }, test({ assert, target, window }) { - const [ control, test ] = target.querySelectorAll( 'p' ); + const [control, test] = target.querySelectorAll('p'); - assert.equal( window.getComputedStyle( control ).color, '' ); - assert.equal( window.getComputedStyle( test ).color, '' ); + assert.equal(window.getComputedStyle(control).color, ''); + assert.equal(window.getComputedStyle(test).color, ''); } }; diff --git a/test/runtime/samples/css-space-in-attribute/_config.js b/test/runtime/samples/css-space-in-attribute/_config.js index c88f72cafa..39c9e66e12 100644 --- a/test/runtime/samples/css-space-in-attribute/_config.js +++ b/test/runtime/samples/css-space-in-attribute/_config.js @@ -1,11 +1,11 @@ export default { test({ assert, target, window }) { - const [ control, test ] = target.querySelectorAll( 'p' ); + const [control, test] = target.querySelectorAll('p'); - assert.equal( window.getComputedStyle( control ).color, '' ); - assert.equal( window.getComputedStyle( control ).backgroundColor, '' ); + assert.equal(window.getComputedStyle(control).color, ''); + assert.equal(window.getComputedStyle(control).backgroundColor, ''); - assert.equal( window.getComputedStyle( test ).color, 'red' ); - assert.equal( window.getComputedStyle( test ).backgroundColor, 'black' ); + assert.equal(window.getComputedStyle(test).color, 'red'); + assert.equal(window.getComputedStyle(test).backgroundColor, 'black'); } }; diff --git a/test/runtime/samples/custom-method/_config.js b/test/runtime/samples/custom-method/_config.js index debaa15a66..b720cd255b 100644 --- a/test/runtime/samples/custom-method/_config.js +++ b/test/runtime/samples/custom-method/_config.js @@ -10,17 +10,23 @@ export default { await button.dispatchEvent(event); assert.equal(component.counter, 1); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

1

- `); + ` + ); await button.dispatchEvent(event); assert.equal(component.counter, 2); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2

- `); + ` + ); assert.equal(component.foo(), 42); } diff --git a/test/runtime/samples/deconflict-builtins/get.js b/test/runtime/samples/deconflict-builtins/get.js index 78477cc40f..3ecd58d92f 100644 --- a/test/runtime/samples/deconflict-builtins/get.js +++ b/test/runtime/samples/deconflict-builtins/get.js @@ -1,3 +1,3 @@ -export function get () { +export function get() { return 'got'; } diff --git a/test/runtime/samples/deconflict-contexts/_config.js b/test/runtime/samples/deconflict-contexts/_config.js index 5254655d89..1f07392500 100644 --- a/test/runtime/samples/deconflict-contexts/_config.js +++ b/test/runtime/samples/deconflict-contexts/_config.js @@ -4,6 +4,6 @@ export default { `, props: { - components: [ 'foo', 'bar', 'baz' ] + components: ['foo', 'bar', 'baz'] } }; diff --git a/test/runtime/samples/deconflict-elements-indexes/_config.js b/test/runtime/samples/deconflict-elements-indexes/_config.js index cb102638f2..ec75d222aa 100644 --- a/test/runtime/samples/deconflict-elements-indexes/_config.js +++ b/test/runtime/samples/deconflict-elements-indexes/_config.js @@ -12,11 +12,14 @@ export default { tagList.push('two'); component.tagList = tagList; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
one two
- `); + ` + ); } }; diff --git a/test/runtime/samples/default-data-function/_config.js b/test/runtime/samples/default-data-function/_config.js index 3f091e438c..88f135d119 100644 --- a/test/runtime/samples/default-data-function/_config.js +++ b/test/runtime/samples/default-data-function/_config.js @@ -3,6 +3,6 @@ export default { test({ assert, component, target }) { component.name = () => 'everybody'; - assert.htmlEqual( target.innerHTML, '

Hello everybody!

' ); + assert.htmlEqual(target.innerHTML, '

Hello everybody!

'); } }; diff --git a/test/runtime/samples/destructured-props-2/_config.js b/test/runtime/samples/destructured-props-2/_config.js index c647f31be1..973746a633 100644 --- a/test/runtime/samples/destructured-props-2/_config.js +++ b/test/runtime/samples/destructured-props-2/_config.js @@ -9,11 +9,14 @@ export default { async test({ component, assert, target }) { await component.update(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
x: 1, list_two_a: 2, list_two_b: 5, y: 4, m: 1, n: 2, o: 5, p: 3, q: 4
[1,{"a":2},[3,{}]]

x: 1, list_two_a: 2, list_two_b: 5, y: 4, m: MM, n: NN, o: OO, p: PP, q: QQ
[1,{"a":2},[3,{}]]
- `); + ` + ); } }; diff --git a/test/runtime/samples/destructured-props-3/_config.js b/test/runtime/samples/destructured-props-3/_config.js index 6d2e516e0e..ff721e78d6 100644 --- a/test/runtime/samples/destructured-props-3/_config.js +++ b/test/runtime/samples/destructured-props-3/_config.js @@ -6,10 +6,13 @@ export default { `, async test({ component, target, assert }) { await component.update(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
i: 9, j: 10, k: 11, l: 12, m: 13, n: 14, a: 9, b: 10, c: 11, d: 12, e: 13, f: 14

i: 9, j: 10, k: 11, l: 12, m: 13, n: 14, a: aa, b: 10, c: cc, d: dd, e: 13, f: ff
- `); + ` + ); } }; diff --git a/test/runtime/samples/destructured-props-5/_config.js b/test/runtime/samples/destructured-props-5/_config.js index 6c8ca89216..c55f6c397a 100644 --- a/test/runtime/samples/destructured-props-5/_config.js +++ b/test/runtime/samples/destructured-props-5/_config.js @@ -9,11 +9,14 @@ export default { async test({ component, assert, target }) { await component.update(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
x: 1, list_two_a: 4, list_two_b: 5, y: 3, l: 1, m: 2, n: 4, o: 5, p: 5, q: 6, r: 7, s: 1
[1,2,3,{"a":4},[5,{},{},8]]

x: 1, list_two_a: 4, list_two_b: 5, y: 3, l: LL, m: MM, n: NN, o: OO, p: PP, q: QQ, r: RR, s: SS
[1,2,3,{"a":4},[5,{},{},8]]
- `); + ` + ); } }; diff --git a/test/runtime/samples/destructuring-assignment-array/_config.js b/test/runtime/samples/destructuring-assignment-array/_config.js index 5b39a0b86e..878e3d5e5f 100644 --- a/test/runtime/samples/destructuring-assignment-array/_config.js +++ b/test/runtime/samples/destructuring-assignment-array/_config.js @@ -11,13 +11,16 @@ export default { async test({ assert, component, target }) { await component.swap(0, 1); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
  • Compté
  • Gruyere
  • Beaufort
  • Abondance
- `); + ` + ); } }; diff --git a/test/runtime/samples/destructuring/_config.js b/test/runtime/samples/destructuring/_config.js index 93e4ed3936..3a64342e70 100644 --- a/test/runtime/samples/destructuring/_config.js +++ b/test/runtime/samples/destructuring/_config.js @@ -12,7 +12,7 @@ export default { let count = 0; let number = null; - component.$on('foo', event => { + component.$on('foo', (event) => { count++; number = event.detail.foo; }); diff --git a/test/runtime/samples/dev-warning-destroy-twice/_config.js b/test/runtime/samples/dev-warning-destroy-twice/_config.js index 69ef5b1713..b700d8d92d 100644 --- a/test/runtime/samples/dev-warning-destroy-twice/_config.js +++ b/test/runtime/samples/dev-warning-destroy-twice/_config.js @@ -7,16 +7,15 @@ export default { const warn = console.warn; // eslint-disable-line no-console const warnings = []; - console.warn = warning => { // eslint-disable-line no-console + console.warn = (warning) => { + // eslint-disable-line no-console warnings.push(warning); }; component.$destroy(); component.$destroy(); - assert.deepEqual(warnings, [ - 'Component was already destroyed' - ]); + assert.deepEqual(warnings, ['Component was already destroyed']); console.warn = warn; // eslint-disable-line no-console } diff --git a/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js b/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js index 036130c4e0..3d6c119932 100644 --- a/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js +++ b/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js @@ -2,5 +2,6 @@ export default { compileOptions: { dev: true }, - error: '{#each} only iterates over array-like objects. You can use a spread to convert this iterable into an array.' + error: + '{#each} only iterates over array-like objects. You can use a spread to convert this iterable into an array.' }; diff --git a/test/runtime/samples/dev-warning-missing-data-binding/_config.js b/test/runtime/samples/dev-warning-missing-data-binding/_config.js index 1ba0dfc8ff..d6cb8aaaae 100644 --- a/test/runtime/samples/dev-warning-missing-data-binding/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-binding/_config.js @@ -3,7 +3,5 @@ export default { dev: true }, - warnings: [ - "
was created without expected prop 'value'" - ] + warnings: ["
was created without expected prop 'value'"] }; diff --git a/test/runtime/samples/dev-warning-missing-data-component-bind/_config.js b/test/runtime/samples/dev-warning-missing-data-component-bind/_config.js index ececa00a8c..37400c3e60 100644 --- a/test/runtime/samples/dev-warning-missing-data-component-bind/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-component-bind/_config.js @@ -3,7 +3,5 @@ export default { dev: true }, - warnings: [ - " was created without expected prop 'y'" - ] + warnings: [" was created without expected prop 'y'"] }; diff --git a/test/runtime/samples/dev-warning-missing-data-component/_config.js b/test/runtime/samples/dev-warning-missing-data-component/_config.js index ececa00a8c..37400c3e60 100644 --- a/test/runtime/samples/dev-warning-missing-data-component/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-component/_config.js @@ -3,7 +3,5 @@ export default { dev: true }, - warnings: [ - " was created without expected prop 'y'" - ] + warnings: [" was created without expected prop 'y'"] }; diff --git a/test/runtime/samples/dev-warning-readonly-computed/_config.js b/test/runtime/samples/dev-warning-readonly-computed/_config.js index 86037d7e1f..68288955e2 100644 --- a/test/runtime/samples/dev-warning-readonly-computed/_config.js +++ b/test/runtime/samples/dev-warning-readonly-computed/_config.js @@ -10,9 +10,9 @@ export default { test({ assert, component }) { try { component.foo = 1; - throw new Error( 'Expected an error' ); - } catch ( err ) { - assert.equal( err.message, "
: Cannot set read-only property 'foo'" ); + throw new Error('Expected an error'); + } catch (err) { + assert.equal(err.message, "
: Cannot set read-only property 'foo'"); } } }; diff --git a/test/runtime/samples/dev-warning-unknown-props-2/_config.js b/test/runtime/samples/dev-warning-unknown-props-2/_config.js index b28724d719..6033f45636 100644 --- a/test/runtime/samples/dev-warning-unknown-props-2/_config.js +++ b/test/runtime/samples/dev-warning-unknown-props-2/_config.js @@ -3,7 +3,5 @@ export default { dev: true }, - warnings: [ - " was created with unknown prop 'fo'" - ] + warnings: [" was created with unknown prop 'fo'"] }; diff --git a/test/runtime/samples/dev-warning-unknown-props/_config.js b/test/runtime/samples/dev-warning-unknown-props/_config.js index b28724d719..6033f45636 100644 --- a/test/runtime/samples/dev-warning-unknown-props/_config.js +++ b/test/runtime/samples/dev-warning-unknown-props/_config.js @@ -3,7 +3,5 @@ export default { dev: true }, - warnings: [ - " was created with unknown prop 'fo'" - ] + warnings: [" was created with unknown prop 'fo'"] }; diff --git a/test/runtime/samples/document-binding-fullscreen/_config.js b/test/runtime/samples/document-binding-fullscreen/_config.js index 154ec0445a..da2af40fea 100644 --- a/test/runtime/samples/document-binding-fullscreen/_config.js +++ b/test/runtime/samples/document-binding-fullscreen/_config.js @@ -8,14 +8,14 @@ export default { }); }, - // copied from window-binding - // there's some kind of weird bug with this test... it compiles with the wrong require.extensions hook for some bizarre reason - skip_if_ssr: true, + // copied from window-binding + // there's some kind of weird bug with this test... it compiles with the wrong require.extensions hook for some bizarre reason + skip_if_ssr: true, async test({ assert, target, window, component }) { const event = new window.Event('fullscreenchange'); - const div = target.querySelector('div'); + const div = target.querySelector('div'); Object.defineProperties(window.document, { fullscreenElement: { diff --git a/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js b/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js index 2f73514e67..1b2d955d44 100644 --- a/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js +++ b/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js @@ -12,17 +12,23 @@ export default { component.foo = undefined; component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

parent red

red red

- `); + ` + ); component.foo = undefined; component.x = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

parent green

green green

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-component-bindings-recreated/_config.js b/test/runtime/samples/dynamic-component-bindings-recreated/_config.js index 7882996a8b..070b2b07fd 100644 --- a/test/runtime/samples/dynamic-component-bindings-recreated/_config.js +++ b/test/runtime/samples/dynamic-component-bindings-recreated/_config.js @@ -11,15 +11,21 @@ export default { test({ assert, component, target }) { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

red one

- `); + ` + ); component.foo = 'two'; component.x = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

green two

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-component-bindings/_config.js b/test/runtime/samples/dynamic-component-bindings/_config.js index 4b76c89237..d7a049801e 100644 --- a/test/runtime/samples/dynamic-component-bindings/_config.js +++ b/test/runtime/samples/dynamic-component-bindings/_config.js @@ -17,10 +17,13 @@ export default { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

bar

- `); + ` + ); input = target.querySelector('input'); input.checked = true; diff --git a/test/runtime/samples/dynamic-component-events/_config.js b/test/runtime/samples/dynamic-component-events/_config.js index cc54bef4e5..0a1711c8d3 100644 --- a/test/runtime/samples/dynamic-component-events/_config.js +++ b/test/runtime/samples/dynamic-component-events/_config.js @@ -15,9 +15,12 @@ export default { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); target.querySelector('button').dispatchEvent(click); assert.equal(component.selected, 'bar'); diff --git a/test/runtime/samples/dynamic-component-in-if/_config.js b/test/runtime/samples/dynamic-component-in-if/_config.js index 0c6829dbcd..d43351d4c3 100644 --- a/test/runtime/samples/dynamic-component-in-if/_config.js +++ b/test/runtime/samples/dynamic-component-in-if/_config.js @@ -6,8 +6,11 @@ export default { test({ assert, component, target }) { component.x = component.Bar; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-component-inside-element/_config.js b/test/runtime/samples/dynamic-component-inside-element/_config.js index ba144c96a6..c00f546721 100644 --- a/test/runtime/samples/dynamic-component-inside-element/_config.js +++ b/test/runtime/samples/dynamic-component-inside-element/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

false, therefore Bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-component-nulled-out/_config.js b/test/runtime/samples/dynamic-component-nulled-out/_config.js index 7e928aba86..8e66905185 100644 --- a/test/runtime/samples/dynamic-component-nulled-out/_config.js +++ b/test/runtime/samples/dynamic-component-nulled-out/_config.js @@ -12,8 +12,11 @@ export default { component.Bar = Bar; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Foo

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-component-slot/_config.js b/test/runtime/samples/dynamic-component-slot/_config.js index aedf8bbb5b..16ca9d7e4d 100644 --- a/test/runtime/samples/dynamic-component-slot/_config.js +++ b/test/runtime/samples/dynamic-component-slot/_config.js @@ -19,7 +19,9 @@ export default { test({ assert, component, target }) { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Bar

element

you're it @@ -30,6 +32,7 @@ export default { c
baz
what goes up must come down
- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-component-update-existing-instance/_config.js b/test/runtime/samples/dynamic-component-update-existing-instance/_config.js index adca76f5a7..3a1177aab8 100644 --- a/test/runtime/samples/dynamic-component-update-existing-instance/_config.js +++ b/test/runtime/samples/dynamic-component-update-existing-instance/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.x = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Foo 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-component/_config.js b/test/runtime/samples/dynamic-component/_config.js index 64abb9bd96..2276e0b0cb 100644 --- a/test/runtime/samples/dynamic-component/_config.js +++ b/test/runtime/samples/dynamic-component/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

false, therefore Bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-element-action-update/_config.js b/test/runtime/samples/dynamic-element-action-update/_config.js index e1e0bc7ed1..1ccea7270b 100644 --- a/test/runtime/samples/dynamic-element-action-update/_config.js +++ b/test/runtime/samples/dynamic-element-action-update/_config.js @@ -25,12 +25,7 @@ export default { component.tag = 'h2'; assert.equal(component.tag, 'h2'); - assert.deepEqual(logs, [ - 'create: h1,opt1', - 'update: h1,opt2', - 'destroy', - 'create: h2,opt2' - ]); + assert.deepEqual(logs, ['create: h1,opt1', 'update: h1,opt2', 'destroy', 'create: h2,opt2']); assert.htmlEqual(target.innerHTML, '

tag is h2.

'); component.tag = false; diff --git a/test/runtime/samples/dynamic-element-animation-2/_config.js b/test/runtime/samples/dynamic-element-animation-2/_config.js index d7dec05009..975d478623 100644 --- a/test/runtime/samples/dynamic-element-animation-2/_config.js +++ b/test/runtime/samples/dynamic-element-animation-2/_config.js @@ -24,19 +24,14 @@ export default { `, before_test() { - originalDivGetBoundingClientRect = - window.HTMLDivElement.prototype.getBoundingClientRect; - originalSpanGetBoundingClientRect = - window.HTMLSpanElement.prototype.getBoundingClientRect; + originalDivGetBoundingClientRect = window.HTMLDivElement.prototype.getBoundingClientRect; + originalSpanGetBoundingClientRect = window.HTMLSpanElement.prototype.getBoundingClientRect; originalParagraphGetBoundingClientRect = window.HTMLParagraphElement.prototype.getBoundingClientRect; - window.HTMLDivElement.prototype.getBoundingClientRect = - fakeGetBoundingClientRect; - window.HTMLSpanElement.prototype.getBoundingClientRect = - fakeGetBoundingClientRect; - window.HTMLParagraphElement.prototype.getBoundingClientRect = - fakeGetBoundingClientRect; + window.HTMLDivElement.prototype.getBoundingClientRect = fakeGetBoundingClientRect; + window.HTMLSpanElement.prototype.getBoundingClientRect = fakeGetBoundingClientRect; + window.HTMLParagraphElement.prototype.getBoundingClientRect = fakeGetBoundingClientRect; function fakeGetBoundingClientRect() { const index = [...this.parentNode.children].indexOf(this); @@ -51,10 +46,8 @@ export default { } }, after_test() { - window.HTMLDivElement.prototype.getBoundingClientRect = - originalDivGetBoundingClientRect; - window.HTMLSpanElement.prototype.getBoundingClientRect = - originalSpanGetBoundingClientRect; + window.HTMLDivElement.prototype.getBoundingClientRect = originalDivGetBoundingClientRect; + window.HTMLSpanElement.prototype.getBoundingClientRect = originalSpanGetBoundingClientRect; window.HTMLParagraphElement.prototype.getBoundingClientRect = originalParagraphGetBoundingClientRect; }, diff --git a/test/runtime/samples/dynamic-element-animation/_config.js b/test/runtime/samples/dynamic-element-animation/_config.js index e3c57a868e..378a0ece9f 100644 --- a/test/runtime/samples/dynamic-element-animation/_config.js +++ b/test/runtime/samples/dynamic-element-animation/_config.js @@ -24,8 +24,8 @@ export default { component.tag = 'div'; let divs = target.querySelectorAll('div'); - divs.forEach(div => { - div.getBoundingClientRect = function() { + divs.forEach((div) => { + div.getBoundingClientRect = function () { const index = [...this.parentNode.children].indexOf(this); const top = index * 30; @@ -54,9 +54,6 @@ export default { assert.ok(~divs[4].style.animation.indexOf('__svelte')); raf.tick(100); - assert.deepEqual([ - divs[0].style.animation, - divs[4].style.animation - ], ['', '']); + assert.deepEqual([divs[0].style.animation, divs[4].style.animation], ['', '']); } }; diff --git a/test/runtime/samples/dynamic-element-event-handler1/_config.js b/test/runtime/samples/dynamic-element-event-handler1/_config.js index 03b8f7879d..277ced1b21 100644 --- a/test/runtime/samples/dynamic-element-event-handler1/_config.js +++ b/test/runtime/samples/dynamic-element-event-handler1/_config.js @@ -1,6 +1,6 @@ let clicked = false; function handler() { - clicked = true; + clicked = true; } export default { diff --git a/test/runtime/samples/dynamic-element-event-handler2/_config.js b/test/runtime/samples/dynamic-element-event-handler2/_config.js index 22cbe735a7..776081e703 100644 --- a/test/runtime/samples/dynamic-element-event-handler2/_config.js +++ b/test/runtime/samples/dynamic-element-event-handler2/_config.js @@ -1,6 +1,6 @@ let clicked = false; function handler() { - clicked = true; + clicked = true; } export default { diff --git a/test/runtime/samples/dynamic-element-pass-props/_config.js b/test/runtime/samples/dynamic-element-pass-props/_config.js index 35f8b7abdf..527955ebc0 100644 --- a/test/runtime/samples/dynamic-element-pass-props/_config.js +++ b/test/runtime/samples/dynamic-element-pass-props/_config.js @@ -3,7 +3,7 @@ let clicked = false; export default { props: { tag: 'div', - onClick: () => clicked = true + onClick: () => (clicked = true) }, html: '
Foo
', diff --git a/test/runtime/samples/dynamic-element-slot/_config.js b/test/runtime/samples/dynamic-element-slot/_config.js index aa9da522a3..2e4069ed09 100644 --- a/test/runtime/samples/dynamic-element-slot/_config.js +++ b/test/runtime/samples/dynamic-element-slot/_config.js @@ -16,7 +16,9 @@ export default { test({ assert, component, target }) { component.tag = 'h2'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Foo

This is default slot

@@ -24,6 +26,7 @@ export default {

This is other slot

- `); + ` + ); } }; diff --git a/test/runtime/samples/dynamic-element-variable/_config.js b/test/runtime/samples/dynamic-element-variable/_config.js index 20e0fa9418..ccfe26732c 100644 --- a/test/runtime/samples/dynamic-element-variable/_config.js +++ b/test/runtime/samples/dynamic-element-variable/_config.js @@ -10,9 +10,12 @@ export default { component.tag = 'nav'; component.text = 'Bar'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); const h1 = target.firstChild; assert.notEqual(div, h1); diff --git a/test/runtime/samples/each-block-array-literal/_config.js b/test/runtime/samples/each-block-array-literal/_config.js index 164e4730bc..f3bbee8d79 100644 --- a/test/runtime/samples/each-block-array-literal/_config.js +++ b/test/runtime/samples/each-block-array-literal/_config.js @@ -5,10 +5,13 @@ export default { `, test({ assert, component, target }) { - assert.htmlEqual(target.innerHTML,` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); const button = target.querySelector('button'); const event = new window.MouseEvent('click'); diff --git a/test/runtime/samples/each-block-containing-component-in-if/_config.js b/test/runtime/samples/each-block-containing-component-in-if/_config.js index d617d23cd3..225890e2ce 100644 --- a/test/runtime/samples/each-block-containing-component-in-if/_config.js +++ b/test/runtime/samples/each-block-containing-component-in-if/_config.js @@ -10,23 +10,29 @@ export default { component.show = true; component.fields = [1, 2, 3]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3
- ` ); + ` + ); component.fields = [1, 2, 3, 4]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1 2 3 4
- ` ); + ` + ); } }; diff --git a/test/runtime/samples/each-block-containing-if/_config.js b/test/runtime/samples/each-block-containing-if/_config.js index 51284e060b..6162db8132 100644 --- a/test/runtime/samples/each-block-containing-if/_config.js +++ b/test/runtime/samples/each-block-containing-if/_config.js @@ -1,12 +1,15 @@ export default { test({ assert, component, target }) { const items = component.items; - items.forEach(item => item.completed = false); + items.forEach((item) => (item.completed = false)); component.currentFilter = 'all'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
  • one
  • two
  • three
- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-array-as-object/_config.js b/test/runtime/samples/each-block-destructured-array-as-object/_config.js index ff341ce033..b90f1a81ca 100644 --- a/test/runtime/samples/each-block-destructured-array-as-object/_config.js +++ b/test/runtime/samples/each-block-destructured-array-as-object/_config.js @@ -1,9 +1,9 @@ export default { props: { array: [ - [1, 2, 3, 4, 5], - [6, 7, 8], - [9, 10, 11, 12] + [1, 2, 3, 4, 5], + [6, 7, 8], + [9, 10, 11, 12] ] }, @@ -15,8 +15,11 @@ export default { test({ assert, component, target }) { component.array = [[12, 13]]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

First: 12, Third: undefined, Length: 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-array-computed-props/_config.js b/test/runtime/samples/each-block-destructured-array-computed-props/_config.js index e400e2f280..ffb5d615e4 100644 --- a/test/runtime/samples/each-block-destructured-array-computed-props/_config.js +++ b/test/runtime/samples/each-block-destructured-array-computed-props/_config.js @@ -17,8 +17,11 @@ export default { test({ assert, component, target }) { component.array = [[23, 24, 25, 26, 27, 28, 29]]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

First: 23, Half: 26, Last: 29, Length: 7

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-array-nested-rest/_config.js b/test/runtime/samples/each-block-destructured-array-nested-rest/_config.js index 5922925956..7888d9d303 100644 --- a/test/runtime/samples/each-block-destructured-array-nested-rest/_config.js +++ b/test/runtime/samples/each-block-destructured-array-nested-rest/_config.js @@ -1,10 +1,10 @@ export default { props: { array: [ - [1, 2, 3, 4, 5], - [6, 7, 8], - [9, 10, 11, 12], - [13, 14, 15, 16, 17, 18, 19, 20, 21, 22] + [1, 2, 3, 4, 5], + [6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16, 17, 18, 19, 20, 21, 22] ] }, @@ -17,8 +17,11 @@ export default { test({ assert, component, target }) { component.array = [[23, 24, 25, 26, 27, 28, 29]]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

First: 23, Second: 24, Third: 25, Elements remaining: 4

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-array-sparse/_config.js b/test/runtime/samples/each-block-destructured-array-sparse/_config.js index 331c3aec1b..8e1e75dd55 100644 --- a/test/runtime/samples/each-block-destructured-array-sparse/_config.js +++ b/test/runtime/samples/each-block-destructured-array-sparse/_config.js @@ -13,8 +13,11 @@ export default { test({ assert, component, target }) { component.animalPawsEntries = [['foo', 'bar']]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-array/_config.js b/test/runtime/samples/each-block-destructured-array/_config.js index e2924c8656..a8bce1bca3 100644 --- a/test/runtime/samples/each-block-destructured-array/_config.js +++ b/test/runtime/samples/each-block-destructured-array/_config.js @@ -13,8 +13,11 @@ export default { test({ assert, component, target }) { component.animalPawsEntries = [['foo', 'bar']]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo: bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-default-before-initialised/_config.js b/test/runtime/samples/each-block-destructured-default-before-initialised/_config.js index c42261df40..7b51eae2ad 100644 --- a/test/runtime/samples/each-block-destructured-default-before-initialised/_config.js +++ b/test/runtime/samples/each-block-destructured-default-before-initialised/_config.js @@ -1,5 +1,8 @@ export default { error(assert, err) { - assert.ok(err.message === "Cannot access 'c' before initialization" || err.message === 'c is not defined'); + assert.ok( + err.message === "Cannot access 'c' before initialization" || + err.message === 'c is not defined' + ); } }; diff --git a/test/runtime/samples/each-block-destructured-default/_config.js b/test/runtime/samples/each-block-destructured-default/_config.js index 0115c9d1ce..eb33e7e574 100644 --- a/test/runtime/samples/each-block-destructured-default/_config.js +++ b/test/runtime/samples/each-block-destructured-default/_config.js @@ -19,8 +19,11 @@ export default { test({ assert, component, target }) { component.animalEntries = [{ animal: 'cow', class: 'mammal', species: '‎B. taurus' }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

cow - ‎B. taurus - 50kg (110 lb) - 30cm - 0.05555555555555555

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-object-binding/_config.js b/test/runtime/samples/each-block-destructured-object-binding/_config.js index 2ab3e24397..fcf804525f 100644 --- a/test/runtime/samples/each-block-destructured-object-binding/_config.js +++ b/test/runtime/samples/each-block-destructured-object-binding/_config.js @@ -23,23 +23,27 @@ export default { const { people } = component; - assert.deepEqual(people, [ - { name: { first: 'Doctor', last: 'Oz' } } - ]); + assert.deepEqual(people, [{ name: { first: 'Doctor', last: 'Oz' } }]); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Doctor Oz

- `); + ` + ); people[0].name.first = 'Frank'; component.people = people; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Frank Oz

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-object-computed-props/_config.js b/test/runtime/samples/each-block-destructured-object-computed-props/_config.js index 7e98fab913..85e3fdfa1e 100644 --- a/test/runtime/samples/each-block-destructured-object-computed-props/_config.js +++ b/test/runtime/samples/each-block-destructured-object-computed-props/_config.js @@ -4,7 +4,12 @@ export default { secondString: 'dogs', objectsArray: [ { dogs: 'woof', cats: 'meow', stac: 'stack', DOGS: 'WOOF' }, - { dogs: 'A German sheppard', cats: 'A tailless cat', stac: 'A jenga tower', DOGS: 'A GERMAN SHEPPARD' }, + { + dogs: 'A German sheppard', + cats: 'A tailless cat', + stac: 'A jenga tower', + DOGS: 'A GERMAN SHEPPARD' + }, { dogs: 'dogs', cats: 'cats', stac: 'stac', DOGS: 'DOGS' } ] }, diff --git a/test/runtime/samples/each-block-destructured-object-literal-props/_config.js b/test/runtime/samples/each-block-destructured-object-literal-props/_config.js index 0b29c28cd9..0bb18f850f 100644 --- a/test/runtime/samples/each-block-destructured-object-literal-props/_config.js +++ b/test/runtime/samples/each-block-destructured-object-literal-props/_config.js @@ -1,9 +1,9 @@ export default { props: { objectsArray: [ - { 'foo-bar': 'FooBar', 0: 'zero', prop: 'prop' }, - { 'foo-bar': 'foobar', 0: 'null', prop: 'a prop' }, - { 'foo-bar': 'FOO BAR', 0: 'nada', prop: 'the prop' } + { 'foo-bar': 'FooBar', 0: 'zero', prop: 'prop' }, + { 'foo-bar': 'foobar', 0: 'null', prop: 'a prop' }, + { 'foo-bar': 'FOO BAR', 0: 'nada', prop: 'the prop' } ] }, @@ -15,8 +15,11 @@ export default { test({ assert, component, target }) { component.objectsArray = [{ 'foo-bar': 'Fool Ball', 0: 'nil', prop: 'one prop' }]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Fool Ball: one prop nil

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-object-literal-rest/_config.js b/test/runtime/samples/each-block-destructured-object-literal-rest/_config.js index b2f29e28f5..78d4a84ccb 100644 --- a/test/runtime/samples/each-block-destructured-object-literal-rest/_config.js +++ b/test/runtime/samples/each-block-destructured-object-literal-rest/_config.js @@ -14,9 +14,14 @@ export default { `, test({ assert, component, target }) { - component.objectsArray = [{ quote: 'new-quote', 'wrong-quote': 'wq4', 16: 'ten+six', role: 'role' }]; - assert.htmlEqual(target.innerHTML, ` + component.objectsArray = [ + { quote: 'new-quote', 'wrong-quote': 'wq4', 16: 'ten+six', role: 'role' } + ]; + assert.htmlEqual( + target.innerHTML, + `

Quote: new-quote, Wrong Quote: wq4, 16: ten+six

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-object-rest/_config.js b/test/runtime/samples/each-block-destructured-object-rest/_config.js index be5d38b555..d3fe0238b7 100644 --- a/test/runtime/samples/each-block-destructured-object-rest/_config.js +++ b/test/runtime/samples/each-block-destructured-object-rest/_config.js @@ -13,8 +13,11 @@ export default { test({ assert, component, target }) { component.animalEntries = [{ animal: 'cow', class: 'mammal' }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

cow

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-destructured-object/_config.js b/test/runtime/samples/each-block-destructured-object/_config.js index feec72f402..47e16bb9b3 100644 --- a/test/runtime/samples/each-block-destructured-object/_config.js +++ b/test/runtime/samples/each-block-destructured-object/_config.js @@ -13,8 +13,11 @@ export default { test({ assert, component, target }) { component.animalPawsEntries = [{ animal: 'cow', pawType: 'hooves' }]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

cow: hooves

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-dynamic-else-static/_config.js b/test/runtime/samples/each-block-dynamic-else-static/_config.js index adec9625dd..d51834f480 100644 --- a/test/runtime/samples/each-block-dynamic-else-static/_config.js +++ b/test/runtime/samples/each-block-dynamic-else-static/_config.js @@ -1,6 +1,6 @@ export default { props: { - animals: [ 'alpaca', 'baboon', 'capybara' ] + animals: ['alpaca', 'baboon', 'capybara'] }, html: ` @@ -11,22 +11,31 @@ export default { test({ assert, component, target }) { component.animals = []; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

no animals

- ` ); + ` + ); // trigger an 'update' of the else block, to ensure that // nonexistent update method is not called component.animals = []; component.animals = ['wombat']; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

wombat

- ` ); + ` + ); component.animals = ['dinosaur']; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

dinosaur

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/each-block-else-in-if/_config.js b/test/runtime/samples/each-block-else-in-if/_config.js index 24d1e5477a..f6edac9e8f 100644 --- a/test/runtime/samples/each-block-else-in-if/_config.js +++ b/test/runtime/samples/each-block-else-in-if/_config.js @@ -9,9 +9,12 @@ export default { assert.htmlEqual(target.innerHTML, ''); component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

nothing

after

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-else-starts-empty/_config.js b/test/runtime/samples/each-block-else-starts-empty/_config.js index a20cedbbec..a21d738803 100644 --- a/test/runtime/samples/each-block-else-starts-empty/_config.js +++ b/test/runtime/samples/each-block-else-starts-empty/_config.js @@ -12,10 +12,13 @@ export default { test({ assert, component, target }) { component.animals = ['wombat']; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

wombat

after - `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-else/_config.js b/test/runtime/samples/each-block-else/_config.js index a5bf722a80..bcb4b3f9a7 100644 --- a/test/runtime/samples/each-block-else/_config.js +++ b/test/runtime/samples/each-block-else/_config.js @@ -14,24 +14,33 @@ export default { test({ assert, component, target }) { component.animals = []; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

no animals, but rather something else

after - `); + ` + ); component.foo = 'something other'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

no animals, but rather something other

after - `); + ` + ); component.animals = ['wombat']; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

wombat

after - `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-function/_config.js b/test/runtime/samples/each-block-function/_config.js index fd4095690e..36965fc7c8 100644 --- a/test/runtime/samples/each-block-function/_config.js +++ b/test/runtime/samples/each-block-function/_config.js @@ -7,9 +7,12 @@ export default { test({ assert, component, target }) { component.numbers = [4, 5]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

16, 20

20, 25

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/each-block-in-if-block/_config.js b/test/runtime/samples/each-block-in-if-block/_config.js index 082b9b3033..2e547dca86 100644 --- a/test/runtime/samples/each-block-in-if-block/_config.js +++ b/test/runtime/samples/each-block-in-if-block/_config.js @@ -8,6 +8,9 @@ export default { test({ assert, component, target }) { component.dummy = true; - assert.htmlEqual(target.innerHTML, '
Apple
Banana
Tomato
' ); + assert.htmlEqual( + target.innerHTML, + '
Apple
Banana
Tomato
' + ); } }; diff --git a/test/runtime/samples/each-block-index-only/_config.js b/test/runtime/samples/each-block-index-only/_config.js index 80bbd69bd3..8d63ed5788 100644 --- a/test/runtime/samples/each-block-index-only/_config.js +++ b/test/runtime/samples/each-block-index-only/_config.js @@ -14,10 +14,13 @@ export default { test({ assert, component, target }) { component.things = [0, 0, 0]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

0

1

2

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-indexed/_config.js b/test/runtime/samples/each-block-indexed/_config.js index bad727bbf1..4a59995b0d 100644 --- a/test/runtime/samples/each-block-indexed/_config.js +++ b/test/runtime/samples/each-block-indexed/_config.js @@ -1,6 +1,6 @@ export default { props: { - animals: [ 'adder', 'blue whale', 'chameleon' ] + animals: ['adder', 'blue whale', 'chameleon'] }, html: '

0: adder

1: blue whale

2: chameleon

' }; diff --git a/test/runtime/samples/each-block-keyed-bind-group/_config.js b/test/runtime/samples/each-block-keyed-bind-group/_config.js index 0172c2efe7..9cd2274e1f 100644 --- a/test/runtime/samples/each-block-keyed-bind-group/_config.js +++ b/test/runtime/samples/each-block-keyed-bind-group/_config.js @@ -14,13 +14,16 @@ export default { input3.checked = true; await input3.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); assert.equal(input1.checked, false); assert.equal(input2.checked, false); @@ -31,13 +34,16 @@ export default { input4.checked = true; await input4.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); assert.equal(input1.checked, false); assert.equal(input2.checked, false); @@ -48,13 +54,16 @@ export default { input3.checked = false; await input3.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); assert.equal(input1.checked, false); assert.equal(input2.checked, false); diff --git a/test/runtime/samples/each-block-keyed-dynamic-key/_config.js b/test/runtime/samples/each-block-keyed-dynamic-key/_config.js index 949235ee48..848fae800e 100644 --- a/test/runtime/samples/each-block-keyed-dynamic-key/_config.js +++ b/test/runtime/samples/each-block-keyed-dynamic-key/_config.js @@ -23,9 +23,12 @@ export default { component.id = 1; assert.equal(count, 4); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
bar
bar
- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed-dynamic/_config.js b/test/runtime/samples/each-block-keyed-dynamic/_config.js index 9ebf60975c..75150db5fd 100644 --- a/test/runtime/samples/each-block-keyed-dynamic/_config.js +++ b/test/runtime/samples/each-block-keyed-dynamic/_config.js @@ -12,18 +12,21 @@ export default { `, test({ assert, component, target }) { - const [ p1, p2 ] = target.querySelectorAll('p'); + const [p1, p2] = target.querySelectorAll('p'); component.todos = [ { id: 123, description: 'buy beer' }, { id: 234, description: 'drink beer' } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

buy beer

drink beer

- `); + ` + ); - const [ p3, p4 ] = target.querySelectorAll('p'); + const [p3, p4] = target.querySelectorAll('p'); assert.equal(p1, p3); assert.equal(p2, p4); diff --git a/test/runtime/samples/each-block-keyed-else/_config.js b/test/runtime/samples/each-block-keyed-else/_config.js index a5bf722a80..bcb4b3f9a7 100644 --- a/test/runtime/samples/each-block-keyed-else/_config.js +++ b/test/runtime/samples/each-block-keyed-else/_config.js @@ -14,24 +14,33 @@ export default { test({ assert, component, target }) { component.animals = []; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

no animals, but rather something else

after - `); + ` + ); component.foo = 'something other'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

no animals, but rather something other

after - `); + ` + ); component.animals = ['wombat']; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

wombat

after - `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed-html-b/_config.js b/test/runtime/samples/each-block-keyed-html-b/_config.js index 6343a31769..b1c7a78982 100644 --- a/test/runtime/samples/each-block-keyed-html-b/_config.js +++ b/test/runtime/samples/each-block-keyed-html-b/_config.js @@ -6,9 +6,12 @@ export default { test({ assert, component, target }) { component.names = component.names.reverse(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
hello Jill
hello John
- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed-index-in-event-handler/_config.js b/test/runtime/samples/each-block-keyed-index-in-event-handler/_config.js index 6c9d754e57..fa79dfba61 100644 --- a/test/runtime/samples/each-block-keyed-index-in-event-handler/_config.js +++ b/test/runtime/samples/each-block-keyed-index-in-event-handler/_config.js @@ -11,8 +11,11 @@ export default { await target.querySelectorAll('button')[1].dispatchEvent(click); await target.querySelectorAll('button')[1].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed-non-prop/_config.js b/test/runtime/samples/each-block-keyed-non-prop/_config.js index 2cccbedef0..3a0dd81d02 100644 --- a/test/runtime/samples/each-block-keyed-non-prop/_config.js +++ b/test/runtime/samples/each-block-keyed-non-prop/_config.js @@ -14,10 +14,13 @@ export default { component.words = ['foo', 'baz']; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo

baz

- `); + ` + ); const [p4, p5] = target.querySelectorAll('p'); diff --git a/test/runtime/samples/each-block-keyed-random-permute/_config.js b/test/runtime/samples/each-block-keyed-random-permute/_config.js index 88330c4509..56fb75f1e0 100644 --- a/test/runtime/samples/each-block-keyed-random-permute/_config.js +++ b/test/runtime/samples/each-block-keyed-random-permute/_config.js @@ -1,7 +1,7 @@ const VALUES = Array.from('abcdefghijklmnopqrstuvwxyz'); function toObjects(array) { - return array.split('').map(x => ({ id: x })); + return array.split('').map((x) => ({ id: x })); } function permute() { @@ -9,9 +9,7 @@ function permute() { const number = Math.floor(Math.random() * VALUES.length); const permuted = []; for (let i = 0; i < number; i++) { - permuted.push( - ...values.splice(Math.floor(Math.random() * (number - i)), 1) - ); + permuted.push(...values.splice(Math.floor(Math.random() * (number - i)), 1)); } return permuted.join(''); @@ -27,7 +25,10 @@ export default { test({ assert, component, target }) { function test(sequence) { const previous = target.textContent; - const expected = sequence.split('').map(x => `(${x})`).join(''); + const expected = sequence + .split('') + .map((x) => `(${x})`) + .join(''); component.values = toObjects(sequence); assert.htmlEqual( target.innerHTML, diff --git a/test/runtime/samples/each-block-keyed-recursive/_config.js b/test/runtime/samples/each-block-keyed-recursive/_config.js index 7ad044228b..496f1ceb0b 100644 --- a/test/runtime/samples/each-block-keyed-recursive/_config.js +++ b/test/runtime/samples/each-block-keyed-recursive/_config.js @@ -1,8 +1,8 @@ export default { props: { tree: [ - {id: 1, sub: null}, - {id: 2, sub: [{id: 11}]} + { id: 1, sub: null }, + { id: 2, sub: [{ id: 11 }] } ] }, @@ -13,13 +13,16 @@ export default { test({ assert, component, target }) { component.tree = [ - {id: 1, sub: null}, - {id: 2, sub: null} + { id: 1, sub: null }, + { id: 2, sub: null } ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1
2
- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed-shift/_config.js b/test/runtime/samples/each-block-keyed-shift/_config.js index 4e7809445c..e85b7b8b58 100644 --- a/test/runtime/samples/each-block-keyed-shift/_config.js +++ b/test/runtime/samples/each-block-keyed-shift/_config.js @@ -12,16 +12,21 @@ export default { test({ assert, component, target }) { component.titles = [{ name: 'b' }, { name: 'c' }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

b

c

- `); + ` + ); component.titles = [{ name: 'c' }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

c

- `); - + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed-siblings/_config.js b/test/runtime/samples/each-block-keyed-siblings/_config.js index a52b6c404d..24ba7f61df 100644 --- a/test/runtime/samples/each-block-keyed-siblings/_config.js +++ b/test/runtime/samples/each-block-keyed-siblings/_config.js @@ -12,9 +12,12 @@ export default { test({ assert, component, target }) { component.ones = [{ text: '11' }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
11
2
- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed-unshift/_config.js b/test/runtime/samples/each-block-keyed-unshift/_config.js index 1056c90c50..387b3b9083 100644 --- a/test/runtime/samples/each-block-keyed-unshift/_config.js +++ b/test/runtime/samples/each-block-keyed-unshift/_config.js @@ -11,10 +11,13 @@ export default { test({ assert, component, target }) { component.titles = [{ name: 'a' }, { name: 'b' }, { name: 'c' }]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

a

b

c

- `); + ` + ); } }; diff --git a/test/runtime/samples/each-block-keyed/_config.js b/test/runtime/samples/each-block-keyed/_config.js index c756aa453b..90ca905926 100644 --- a/test/runtime/samples/each-block-keyed/_config.js +++ b/test/runtime/samples/each-block-keyed/_config.js @@ -12,14 +12,12 @@ export default { `, test({ assert, component, target }) { - const [ p1, p2 ] = target.querySelectorAll('p'); + const [p1, p2] = target.querySelectorAll('p'); - component.todos = [ - { id: 234, description: 'implement client-side hydration' } - ]; + component.todos = [{ id: 234, description: 'implement client-side hydration' }]; assert.htmlEqual(target.innerHTML, '

1: implement client-side hydration

'); - const [ p3 ] = target.querySelectorAll('p'); + const [p3] = target.querySelectorAll('p'); assert.ok(!target.contains(p1), 'first

element should be removed'); assert.equal(p2, p3, 'second

element should be retained'); diff --git a/test/runtime/samples/each-block-random-permute/_config.js b/test/runtime/samples/each-block-random-permute/_config.js index f81dac2ef4..43e26c015c 100644 --- a/test/runtime/samples/each-block-random-permute/_config.js +++ b/test/runtime/samples/each-block-random-permute/_config.js @@ -1,11 +1,11 @@ -const VALUES = Array.from( 'abcdefghijklmnopqrstuvwxyz' ); +const VALUES = Array.from('abcdefghijklmnopqrstuvwxyz'); -function permute () { +function permute() { const values = VALUES.slice(); const number = Math.floor(Math.random() * VALUES.length); const permuted = []; for (let i = 0; i < number; i++) { - permuted.push( ...values.splice( Math.floor( Math.random() * ( number - i ) ), 1 ) ); + permuted.push(...values.splice(Math.floor(Math.random() * (number - i)), 1)); } return { @@ -27,7 +27,7 @@ export default { for (let i = 0; i < 100; i++) { step = permute(); component.values = step.data; - assert.htmlEqual( target.innerHTML, step.expected ); + assert.htmlEqual(target.innerHTML, step.expected); } } }; diff --git a/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js b/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js index f0570577b2..374ba7affd 100644 --- a/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js +++ b/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js @@ -31,7 +31,6 @@ export default { ` ); - await button.dispatchEvent(new window.MouseEvent('click')); assert.htmlEqual( diff --git a/test/runtime/samples/each-block-text-node/_config.js b/test/runtime/samples/each-block-text-node/_config.js index 4209bb3bfc..544470e939 100644 --- a/test/runtime/samples/each-block-text-node/_config.js +++ b/test/runtime/samples/each-block-text-node/_config.js @@ -1,14 +1,14 @@ export default { props: { - animals: [ 'alpaca', 'baboon', 'capybara' ] + animals: ['alpaca', 'baboon', 'capybara'] }, html: '(alpaca)(baboon)(capybara)', test({ assert, component, target }) { - component.animals = [ 'caribou', 'dogfish' ]; - assert.htmlEqual( target.innerHTML, '(caribou)(dogfish)' ); + component.animals = ['caribou', 'dogfish']; + assert.htmlEqual(target.innerHTML, '(caribou)(dogfish)'); component.animals = []; - assert.htmlEqual( target.innerHTML, '' ); + assert.htmlEqual(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/each-block-unkeyed-else-2/_config.js b/test/runtime/samples/each-block-unkeyed-else-2/_config.js index a5bf722a80..bcb4b3f9a7 100644 --- a/test/runtime/samples/each-block-unkeyed-else-2/_config.js +++ b/test/runtime/samples/each-block-unkeyed-else-2/_config.js @@ -14,24 +14,33 @@ export default { test({ assert, component, target }) { component.animals = []; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

no animals, but rather something else

after - `); + ` + ); component.foo = 'something other'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

no animals, but rather something other

after - `); + ` + ); component.animals = ['wombat']; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

wombat

after - `); + ` + ); } }; diff --git a/test/runtime/samples/each-block/_config.js b/test/runtime/samples/each-block/_config.js index 6018ab67aa..bd9d947cf6 100644 --- a/test/runtime/samples/each-block/_config.js +++ b/test/runtime/samples/each-block/_config.js @@ -1,6 +1,6 @@ export default { props: { - animals: [ 'alpaca', 'baboon', 'capybara' ] + animals: ['alpaca', 'baboon', 'capybara'] }, html: ` @@ -10,15 +10,18 @@ export default { `, test({ assert, component, target }) { - component.animals = [ 'alpaca', 'baboon', 'caribou', 'dogfish' ]; - assert.htmlEqual( target.innerHTML, ` + component.animals = ['alpaca', 'baboon', 'caribou', 'dogfish']; + assert.htmlEqual( + target.innerHTML, + `

alpaca

baboon

caribou

dogfish

- ` ); + ` + ); component.animals = []; - assert.htmlEqual( target.innerHTML, '' ); + assert.htmlEqual(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/each-blocks-nested-b/_config.js b/test/runtime/samples/each-blocks-nested-b/_config.js index ab008b4249..5a255052d7 100644 --- a/test/runtime/samples/each-blocks-nested-b/_config.js +++ b/test/runtime/samples/each-blocks-nested-b/_config.js @@ -3,28 +3,15 @@ export default { categories: [ { name: 'animals', - things: [ - { name: 'aardvark' }, - { name: 'buffalo' }, - { name: 'chinchilla' } - ] + things: [{ name: 'aardvark' }, { name: 'buffalo' }, { name: 'chinchilla' }] }, { name: 'countries', - things: [ - { name: 'albania' }, - { name: 'brazil' }, - { name: 'china' } - ] + things: [{ name: 'albania' }, { name: 'brazil' }, { name: 'china' }] }, { name: 'people', - things: [ - { name: 'alice' }, - { name: 'bob' }, - { name: 'carol' }, - { name: 'dave' } - ] + things: [{ name: 'alice' }, { name: 'bob' }, { name: 'carol' }, { name: 'dave' }] } ] }, diff --git a/test/runtime/samples/each-blocks-nested/_config.js b/test/runtime/samples/each-blocks-nested/_config.js index 04d9bd11c5..4ddc843af3 100644 --- a/test/runtime/samples/each-blocks-nested/_config.js +++ b/test/runtime/samples/each-blocks-nested/_config.js @@ -1,7 +1,7 @@ export default { props: { - columns: [ 'a', 'b', 'c' ], - rows: [ 1, 2, 3 ] + columns: ['a', 'b', 'c'], + rows: [1, 2, 3] }, html: '
a, 1
a, 2
a, 3
b, 1
b, 2
b, 3
c, 1
c, 2
c, 3
', diff --git a/test/runtime/samples/empty-component-destroy/_config.js b/test/runtime/samples/empty-component-destroy/_config.js index 76b9ae4bb8..7a51b21b8b 100644 --- a/test/runtime/samples/empty-component-destroy/_config.js +++ b/test/runtime/samples/empty-component-destroy/_config.js @@ -15,11 +15,14 @@ export default { const button = target.querySelector('button'); const event = new window.MouseEvent('click'); const messages = []; - console.log = msg => messages.push(msg); + console.log = (msg) => messages.push(msg); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); assert.deepEqual(messages, ['destroy']); } }; diff --git a/test/runtime/samples/event-handler-console-log/_config.js b/test/runtime/samples/event-handler-console-log/_config.js index 289a84e44c..9c7a034290 100644 --- a/test/runtime/samples/event-handler-console-log/_config.js +++ b/test/runtime/samples/event-handler-console-log/_config.js @@ -14,7 +14,7 @@ export default { const messages = []; const log = console.log; - console.log = msg => messages.push(msg); + console.log = (msg) => messages.push(msg); button.dispatchEvent(event); console.log = log; diff --git a/test/runtime/samples/event-handler-destructured/_config.js b/test/runtime/samples/event-handler-destructured/_config.js index 2c37a17c75..397db63fe1 100644 --- a/test/runtime/samples/event-handler-destructured/_config.js +++ b/test/runtime/samples/event-handler-destructured/_config.js @@ -8,8 +8,11 @@ export default { const event = new window.MouseEvent('click'); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/event-handler-dynamic-expression/_config.js b/test/runtime/samples/event-handler-dynamic-expression/_config.js index f2c876cdeb..58bf66aac6 100644 --- a/test/runtime/samples/event-handler-dynamic-expression/_config.js +++ b/test/runtime/samples/event-handler-dynamic-expression/_config.js @@ -2,9 +2,7 @@ export default { html: '', async test({ assert, target, window }) { - const [button] = target.querySelectorAll( - 'button' - ); + const [button] = target.querySelectorAll('button'); const event = new window.MouseEvent('click'); diff --git a/test/runtime/samples/event-handler-dynamic-hash/_config.js b/test/runtime/samples/event-handler-dynamic-hash/_config.js index e98d0f6104..44990524fd 100644 --- a/test/runtime/samples/event-handler-dynamic-hash/_config.js +++ b/test/runtime/samples/event-handler-dynamic-hash/_config.js @@ -9,9 +9,7 @@ export default { `, async test({ assert, target, window }) { - const [updateButton1, updateButton2, button] = target.querySelectorAll( - 'button' - ); + const [updateButton1, updateButton2, button] = target.querySelectorAll('button'); const event = new window.MouseEvent('click'); let err = ''; @@ -22,35 +20,44 @@ export default { await button.dispatchEvent(event); assert.equal(err, '', err); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

0

- `); + ` + ); await updateButton1.dispatchEvent(event); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

1

- `); + ` + ); await updateButton2.dispatchEvent(event); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2

- `); + ` + ); } }; diff --git a/test/runtime/samples/event-handler-dynamic-invalid/_config.js b/test/runtime/samples/event-handler-dynamic-invalid/_config.js index beebd4459e..cac6d60f2e 100644 --- a/test/runtime/samples/event-handler-dynamic-invalid/_config.js +++ b/test/runtime/samples/event-handler-dynamic-invalid/_config.js @@ -4,9 +4,7 @@ export default { `, async test({ assert, target, window }) { - const [buttonUndef, buttonNull, buttonInvalid] = target.querySelectorAll( - 'button' - ); + const [buttonUndef, buttonNull, buttonInvalid] = target.querySelectorAll('button'); const event = new window.MouseEvent('click'); let err = ''; diff --git a/test/runtime/samples/event-handler-dynamic/_config.js b/test/runtime/samples/event-handler-dynamic/_config.js index e98d0f6104..44990524fd 100644 --- a/test/runtime/samples/event-handler-dynamic/_config.js +++ b/test/runtime/samples/event-handler-dynamic/_config.js @@ -9,9 +9,7 @@ export default { `, async test({ assert, target, window }) { - const [updateButton1, updateButton2, button] = target.querySelectorAll( - 'button' - ); + const [updateButton1, updateButton2, button] = target.querySelectorAll('button'); const event = new window.MouseEvent('click'); let err = ''; @@ -22,35 +20,44 @@ export default { await button.dispatchEvent(event); assert.equal(err, '', err); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

0

- `); + ` + ); await updateButton1.dispatchEvent(event); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

1

- `); + ` + ); await updateButton2.dispatchEvent(event); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2

- `); + ` + ); } }; diff --git a/test/runtime/samples/event-handler-each-context-invalidation/_config.js b/test/runtime/samples/event-handler-each-context-invalidation/_config.js index 07e7170357..8baa8fd096 100644 --- a/test/runtime/samples/event-handler-each-context-invalidation/_config.js +++ b/test/runtime/samples/event-handler-each-context-invalidation/_config.js @@ -11,25 +11,27 @@ export default { const event = new window.MouseEvent('click'); await buttons[0].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

on: 2

- `); + ` + ); await buttons[2].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

on: 3

- `); + ` + ); - assert.deepEqual(component.switches, [ - { on: true }, - { on: true }, - { on: true } - ]); + assert.deepEqual(component.switches, [{ on: true }, { on: true }, { on: true }]); } }; diff --git a/test/runtime/samples/event-handler-each-context/_config.js b/test/runtime/samples/event-handler-each-context/_config.js index d816b342bd..11732fa65d 100644 --- a/test/runtime/samples/event-handler-each-context/_config.js +++ b/test/runtime/samples/event-handler-each-context/_config.js @@ -1,8 +1,6 @@ export default { props: { - items: [ - 'whatever' - ], + items: ['whatever'], foo: 'wrong', bar: 'right' }, diff --git a/test/runtime/samples/event-handler-each-deconflicted/_config.js b/test/runtime/samples/event-handler-each-deconflicted/_config.js index 6237f39451..be29649671 100644 --- a/test/runtime/samples/event-handler-each-deconflicted/_config.js +++ b/test/runtime/samples/event-handler-each-deconflicted/_config.js @@ -17,18 +17,24 @@ export default { await buttons[0].dispatchEvent(event); assert.equal(component.clicked, 'foo'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

clicked: foo

- `); + ` + ); await buttons[1].dispatchEvent(event); assert.equal(component.clicked, 'bar'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

clicked: bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/event-handler-each-modifier/_config.js b/test/runtime/samples/event-handler-each-modifier/_config.js index 8274e22eec..e96cd1a987 100644 --- a/test/runtime/samples/event-handler-each-modifier/_config.js +++ b/test/runtime/samples/event-handler-each-modifier/_config.js @@ -1,23 +1,11 @@ export default { async test({ assert, component, target, window }) { // set first - await component.lists.update(() => [ - { text: 'item1' }, - { text: 'item2' }, - { text: 'item3' } - ]); - - await component.lists.update(() => [ - { text: 'item3' }, - { text: 'item2' }, - { text: 'item1' } - ]); - - await component.lists.update(() => [ - { text: 'item1' }, - { text: 'item2' }, - { text: 'item3' } - ]); + await component.lists.update(() => [{ text: 'item1' }, { text: 'item2' }, { text: 'item3' }]); + + await component.lists.update(() => [{ text: 'item3' }, { text: 'item2' }, { text: 'item1' }]); + + await component.lists.update(() => [{ text: 'item1' }, { text: 'item2' }, { text: 'item3' }]); assert.equal(component.updated, 4); @@ -26,16 +14,16 @@ export default { const [item2Btn1, item2Btn2] = item2.querySelectorAll('button'); const clickEvent = new window.MouseEvent('click'); - + await item1Btn1.dispatchEvent(clickEvent); assert.equal(component.getNormalCount(), 1); - + await item1Btn2.dispatchEvent(clickEvent); assert.equal(component.getModifierCount(), 1); await item2Btn1.dispatchEvent(clickEvent); assert.equal(component.getNormalCount(), 2); - + await item2Btn2.dispatchEvent(clickEvent); assert.equal(component.getModifierCount(), 2); } diff --git a/test/runtime/samples/event-handler-each-this/_config.js b/test/runtime/samples/event-handler-each-this/_config.js index 7f6528977c..df6349e0ab 100644 --- a/test/runtime/samples/event-handler-each-this/_config.js +++ b/test/runtime/samples/event-handler-each-this/_config.js @@ -15,7 +15,7 @@ export default { const clicked = []; - component.$on('clicked', event => { + component.$on('clicked', (event) => { clicked.push(event.detail.node); }); diff --git a/test/runtime/samples/event-handler-each/_config.js b/test/runtime/samples/event-handler-each/_config.js index 9c0407860e..48d03cf085 100644 --- a/test/runtime/samples/event-handler-each/_config.js +++ b/test/runtime/samples/event-handler-each/_config.js @@ -1,10 +1,6 @@ export default { props: { - items: [ - 'foo', - 'bar', - 'baz' - ], + items: ['foo', 'bar', 'baz'], selected: 'foo' }, @@ -20,11 +16,14 @@ export default { const event = new window.MouseEvent('click'); await buttons[1].dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

selected: bar

- `); + ` + ); } }; diff --git a/test/runtime/samples/event-handler-modifier-stop-immediate-propagation/_config.js b/test/runtime/samples/event-handler-modifier-stop-immediate-propagation/_config.js index 3ea00c8493..23d50e9ee8 100644 --- a/test/runtime/samples/event-handler-modifier-stop-immediate-propagation/_config.js +++ b/test/runtime/samples/event-handler-modifier-stop-immediate-propagation/_config.js @@ -5,11 +5,11 @@ export default { await button.dispatchEvent(event); assert.deepEqual(component.logs, ['click_1', 'click_2']); - + component.click_2 = () => component.logs.push('22'); await button.dispatchEvent(event); assert.deepEqual(component.logs, ['click_1', 'click_2', 'click_1', '22']); - + component.click_1 = () => component.logs.push('11'); await button.dispatchEvent(event); assert.deepEqual(component.logs, ['click_1', 'click_2', 'click_1', '22', '11', '22']); diff --git a/test/runtime/samples/event-handler-sanitize/_config.js b/test/runtime/samples/event-handler-sanitize/_config.js index ddc15724a3..7a750f4b8d 100644 --- a/test/runtime/samples/event-handler-sanitize/_config.js +++ b/test/runtime/samples/event-handler-sanitize/_config.js @@ -8,14 +8,20 @@ export default { const event = new window.MouseEvent('some-event'); await div.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
toggle

hello!

- `); + ` + ); await div.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
toggle
- `); + ` + ); } }; diff --git a/test/runtime/samples/event-handler-shorthand-component/_config.js b/test/runtime/samples/event-handler-shorthand-component/_config.js index 22704cf1c3..4ee17468e6 100644 --- a/test/runtime/samples/event-handler-shorthand-component/_config.js +++ b/test/runtime/samples/event-handler-shorthand-component/_config.js @@ -8,7 +8,7 @@ export default { const event = new window.MouseEvent('click'); let answer; - component.$on('foo', event => { + component.$on('foo', (event) => { answer = event.detail.answer; }); diff --git a/test/runtime/samples/event-handler-shorthand-dynamic-component/_config.js b/test/runtime/samples/event-handler-shorthand-dynamic-component/_config.js index 22704cf1c3..4ee17468e6 100644 --- a/test/runtime/samples/event-handler-shorthand-dynamic-component/_config.js +++ b/test/runtime/samples/event-handler-shorthand-dynamic-component/_config.js @@ -8,7 +8,7 @@ export default { const event = new window.MouseEvent('click'); let answer; - component.$on('foo', event => { + component.$on('foo', (event) => { answer = event.detail.answer; }); diff --git a/test/runtime/samples/event-handler/_config.js b/test/runtime/samples/event-handler/_config.js index f142fc9daa..058a22b1d7 100644 --- a/test/runtime/samples/event-handler/_config.js +++ b/test/runtime/samples/event-handler/_config.js @@ -8,14 +8,20 @@ export default { const event = new window.MouseEvent('click'); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

hello!

- `); + ` + ); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/fragment-trailing-whitespace/_config.js b/test/runtime/samples/fragment-trailing-whitespace/_config.js index f9ba16207c..fbc8221a1e 100644 --- a/test/runtime/samples/fragment-trailing-whitespace/_config.js +++ b/test/runtime/samples/fragment-trailing-whitespace/_config.js @@ -1,5 +1,5 @@ const message = 'the quick brown fox jumps over the lazy dog'; -const expected = [...message].map(c => `${c + ' '}`).join(''); +const expected = [...message].map((c) => `${c + ' '}`).join(''); export default { props: { diff --git a/test/runtime/samples/function-expression-inline/_config.js b/test/runtime/samples/function-expression-inline/_config.js index a5dc3f7080..16ef33d02b 100644 --- a/test/runtime/samples/function-expression-inline/_config.js +++ b/test/runtime/samples/function-expression-inline/_config.js @@ -12,11 +12,14 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

2

4

6

- `); + ` + ); } }; diff --git a/test/runtime/samples/globals-not-dereferenced/_config.js b/test/runtime/samples/globals-not-dereferenced/_config.js index f10f44253b..ab1eba2715 100644 --- a/test/runtime/samples/globals-not-dereferenced/_config.js +++ b/test/runtime/samples/globals-not-dereferenced/_config.js @@ -7,6 +7,6 @@ export default { test({ assert, component, target }) { component.x = 3; - assert.htmlEqual( target.innerHTML, '3' ); + assert.htmlEqual(target.innerHTML, '3'); } }; diff --git a/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js b/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js index 34cee8157c..e410f61586 100644 --- a/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js +++ b/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js @@ -58,7 +58,9 @@ export default { await input.dispatchEvent(change); assert.ok(component.todos.third.done); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
@@ -73,6 +75,7 @@ export default {
- `); + ` + ); } }; diff --git a/test/runtime/samples/globals-shadowed-by-data/_config.js b/test/runtime/samples/globals-shadowed-by-data/_config.js index 1f268bdd80..09e0157aac 100644 --- a/test/runtime/samples/globals-shadowed-by-data/_config.js +++ b/test/runtime/samples/globals-shadowed-by-data/_config.js @@ -7,6 +7,6 @@ export default { test({ assert, component, target }) { component.x = 3; - assert.htmlEqual( target.innerHTML, 'potato' ); + assert.htmlEqual(target.innerHTML, 'potato'); } }; diff --git a/test/runtime/samples/globals-shadowed-by-helpers/_config.js b/test/runtime/samples/globals-shadowed-by-helpers/_config.js index 1f268bdd80..09e0157aac 100644 --- a/test/runtime/samples/globals-shadowed-by-helpers/_config.js +++ b/test/runtime/samples/globals-shadowed-by-helpers/_config.js @@ -7,6 +7,6 @@ export default { test({ assert, component, target }) { component.x = 3; - assert.htmlEqual( target.innerHTML, 'potato' ); + assert.htmlEqual(target.innerHTML, 'potato'); } }; diff --git a/test/runtime/samples/hash-in-attribute/_config.js b/test/runtime/samples/hash-in-attribute/_config.js index a6fe8eb909..a03134b83a 100644 --- a/test/runtime/samples/hash-in-attribute/_config.js +++ b/test/runtime/samples/hash-in-attribute/_config.js @@ -15,12 +15,18 @@ export default { component.links = ['d', 'e', 'f']; const links = [...target.querySelectorAll('a')]; - assert.deepEqual(links.map(l => l.href), ['x#d', 'x#e', 'x#f']); + assert.deepEqual( + links.map((l) => l.href), + ['x#d', 'x#e', 'x#f'] + ); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` x#d x#e x#f - `); + ` + ); } }; diff --git a/test/runtime/samples/if-block-else-partial-outro/_config.js b/test/runtime/samples/if-block-else-partial-outro/_config.js index ae58d25c23..22b2d99c9d 100644 --- a/test/runtime/samples/if-block-else-partial-outro/_config.js +++ b/test/runtime/samples/if-block-else-partial-outro/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.x = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` 2 - `); + ` + ); } }; diff --git a/test/runtime/samples/if-block-else-update/_config.js b/test/runtime/samples/if-block-else-update/_config.js index c653b6bbd1..3ba36906ad 100644 --- a/test/runtime/samples/if-block-else-update/_config.js +++ b/test/runtime/samples/if-block-else-update/_config.js @@ -5,42 +5,54 @@ export default { const clickEvent = new window.MouseEvent('click'); await btn2.dispatchEvent(clickEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
foo: false, bar: true
bar! - `); + ` + ); await btn1.dispatchEvent(clickEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
foo: true, bar: true
foo! - `); + ` + ); await btn2.dispatchEvent(clickEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
foo: true, bar: false
foo! - `); + ` + ); await btn1.dispatchEvent(clickEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
foo: false, bar: false
- `); + ` + ); } }; diff --git a/test/runtime/samples/if-block-else/_config.js b/test/runtime/samples/if-block-else/_config.js index 5a60973e0d..9752480205 100644 --- a/test/runtime/samples/if-block-else/_config.js +++ b/test/runtime/samples/if-block-else/_config.js @@ -11,21 +11,30 @@ export default { test({ assert, component, target }) { component.foo = false; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

not foo

not bar

- ` ); + ` + ); component.bar = true; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

not foo

bar

- ` ); + ` + ); component.foo = true; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo

bar

- ` ); + ` + ); } }; diff --git a/test/runtime/samples/if-block-elseif-no-else/_config.js b/test/runtime/samples/if-block-elseif-no-else/_config.js index e9696e513c..80f2304bde 100644 --- a/test/runtime/samples/if-block-elseif-no-else/_config.js +++ b/test/runtime/samples/if-block-elseif-no-else/_config.js @@ -9,9 +9,12 @@ export default { test({ assert, component, target }) { component.x = 4; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x is less than 5

- `); + ` + ); component.x = 6; assert.htmlEqual(target.innerHTML, ''); diff --git a/test/runtime/samples/if-block-elseif-text/_config.js b/test/runtime/samples/if-block-elseif-text/_config.js index d5031ffcf4..44beed5f93 100644 --- a/test/runtime/samples/if-block-elseif-text/_config.js +++ b/test/runtime/samples/if-block-elseif-text/_config.js @@ -9,13 +9,19 @@ export default { test({ assert, component, target }) { component.x = 4; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before-elseif-after - `); + ` + ); component.x = 6; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before-else-after - `); + ` + ); } }; diff --git a/test/runtime/samples/if-block-elseif/_config.js b/test/runtime/samples/if-block-elseif/_config.js index d09e88a2ef..1592120e72 100644 --- a/test/runtime/samples/if-block-elseif/_config.js +++ b/test/runtime/samples/if-block-elseif/_config.js @@ -9,13 +9,19 @@ export default { test({ assert, component, target }) { component.x = 4; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x is less than 5

- `); + ` + ); component.x = 6; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x is between 5 and 10

- `); + ` + ); } }; diff --git a/test/runtime/samples/if-block-first/_config.js b/test/runtime/samples/if-block-first/_config.js index 01cf37dfb3..b2c8c235fd 100644 --- a/test/runtime/samples/if-block-first/_config.js +++ b/test/runtime/samples/if-block-first/_config.js @@ -7,6 +7,6 @@ export default { test({ assert, component, target }) { component.visible = true; - assert.htmlEqual(target.innerHTML, '
i am visible
before me
' ); + assert.htmlEqual(target.innerHTML, '
i am visible
before me
'); } }; diff --git a/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js b/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js index da80f5be12..5149fe9ee5 100644 --- a/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js +++ b/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js @@ -13,10 +13,13 @@ export default { test({ assert, component, target }) { component.x = 'y'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
A wild component appears

y

- `); + ` + ); } }; diff --git a/test/runtime/samples/if-block-or/_config.js b/test/runtime/samples/if-block-or/_config.js index bd1b7df4f4..521a450c29 100644 --- a/test/runtime/samples/if-block-or/_config.js +++ b/test/runtime/samples/if-block-or/_config.js @@ -8,8 +8,8 @@ export default { test({ assert, component, target }) { component.a = false; - assert.htmlEqual( target.innerHTML, '' ); + assert.htmlEqual(target.innerHTML, ''); component.b = true; - assert.htmlEqual( target.innerHTML, '

i am visible

' ); + assert.htmlEqual(target.innerHTML, '

i am visible

'); } }; diff --git a/test/runtime/samples/if-block-widget/_config.js b/test/runtime/samples/if-block-widget/_config.js index 44dc32a91c..b0916439b6 100644 --- a/test/runtime/samples/if-block-widget/_config.js +++ b/test/runtime/samples/if-block-widget/_config.js @@ -11,17 +11,23 @@ export default { test({ assert, component, target }) { component.visible = false; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before after - ` ); + ` + ); component.visible = true; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` before

Widget

after - ` ); + ` + ); } }; diff --git a/test/runtime/samples/if-block/_config.js b/test/runtime/samples/if-block/_config.js index a94d9aa35a..d4b646f9fc 100644 --- a/test/runtime/samples/if-block/_config.js +++ b/test/runtime/samples/if-block/_config.js @@ -7,8 +7,8 @@ export default { test({ assert, component, target }) { component.visible = false; - assert.htmlEqual( target.innerHTML, '' ); + assert.htmlEqual(target.innerHTML, ''); component.visible = true; - assert.htmlEqual( target.innerHTML, '

i am visible

' ); + assert.htmlEqual(target.innerHTML, '

i am visible

'); } }; diff --git a/test/runtime/samples/immutable-nested/_config.js b/test/runtime/samples/immutable-nested/_config.js index 8b1dd7e68a..a71c144db4 100644 --- a/test/runtime/samples/immutable-nested/_config.js +++ b/test/runtime/samples/immutable-nested/_config.js @@ -17,20 +17,26 @@ export default { test({ assert, component, target }) { const nested = component.nested; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Called 1 times.

baz true

- `); + ` + ); // eslint-disable-next-line no-self-assign nested.foo = nested.foo; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

Called 1 times.

baz true

- `); + ` + ); } }; diff --git a/test/runtime/samples/inline-expressions/_config.js b/test/runtime/samples/inline-expressions/_config.js index 50cec30468..334e2c5d14 100644 --- a/test/runtime/samples/inline-expressions/_config.js +++ b/test/runtime/samples/inline-expressions/_config.js @@ -7,6 +7,6 @@ export default { test({ assert, component, target }) { component.a = 3; component.b = 4; - assert.equal( target.innerHTML, '

3 + 4 = 7

' ); + assert.equal(target.innerHTML, '

3 + 4 = 7

'); } }; diff --git a/test/runtime/samples/inline-style-directive-escape/_config.js b/test/runtime/samples/inline-style-directive-escape/_config.js index 31666815d9..069f06b7b5 100644 --- a/test/runtime/samples/inline-style-directive-escape/_config.js +++ b/test/runtime/samples/inline-style-directive-escape/_config.js @@ -5,8 +5,11 @@ export default { test({ assert, component, target }) { component.attack = '" onload="alert(\'uhoh2\')" data-nothing="not important'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
- `); + ` + ); } }; diff --git a/test/runtime/samples/inline-style-directive-spread-and-attr/_config.js b/test/runtime/samples/inline-style-directive-spread-and-attr/_config.js index b3660bd5ca..eab5b5bef2 100644 --- a/test/runtime/samples/inline-style-directive-spread-and-attr/_config.js +++ b/test/runtime/samples/inline-style-directive-spread-and-attr/_config.js @@ -23,19 +23,13 @@ export default { component.spread = {}; component.style = 'color: blue; background-color: green;'; - assert.htmlEqual( - target.innerHTML, - '

' - ); + assert.htmlEqual(target.innerHTML, '

'); styles = window.getComputedStyle(p); assert.equal(styles.color, ''); assert.equal(styles.backgroundColor, 'green'); component.color = 'purple'; - assert.htmlEqual( - target.innerHTML, - '

' - ); + assert.htmlEqual(target.innerHTML, '

'); styles = window.getComputedStyle(p); assert.equal(styles.color, 'purple'); assert.equal(styles.backgroundColor, 'green'); diff --git a/test/runtime/samples/inline-style-directive-spread-dynamic/_config.js b/test/runtime/samples/inline-style-directive-spread-dynamic/_config.js index 152e4036a0..a37b99530c 100644 --- a/test/runtime/samples/inline-style-directive-spread-dynamic/_config.js +++ b/test/runtime/samples/inline-style-directive-spread-dynamic/_config.js @@ -13,24 +13,15 @@ export default { component.color = 'red'; - assert.htmlEqual( - target.innerHTML, - '

' - ); + assert.htmlEqual(target.innerHTML, '

'); component.obj = { style: 'height: 72px;' }; - assert.htmlEqual( - target.innerHTML, - '

' - ); + assert.htmlEqual(target.innerHTML, '

'); component.obj = { style: 'border-radius: 2px; color: orange' }; - assert.htmlEqual( - target.innerHTML, - '

' - ); + assert.htmlEqual(target.innerHTML, '

'); component.obj = {}; diff --git a/test/runtime/samples/inline-style-directive-string-variable-kebab-case/_config.js b/test/runtime/samples/inline-style-directive-string-variable-kebab-case/_config.js index 3bd6d38ea5..8d1984191a 100644 --- a/test/runtime/samples/inline-style-directive-string-variable-kebab-case/_config.js +++ b/test/runtime/samples/inline-style-directive-string-variable-kebab-case/_config.js @@ -7,7 +7,10 @@ export default { const div = target.querySelector('div'); const styles = window.getComputedStyle(div); - assert.equal(styles['background-image'], 'url(https://raw.githubusercontent.com/sveltejs/branding/master/svelte-vertical.png)'); + assert.equal( + styles['background-image'], + 'url(https://raw.githubusercontent.com/sveltejs/branding/master/svelte-vertical.png)' + ); assert.equal(styles.getPropertyValue('--css-variable'), 'rgba(0, 0, 0, 1)'); assert.htmlEqual( diff --git a/test/runtime/samples/instrumentation-script-destructuring/_config.js b/test/runtime/samples/instrumentation-script-destructuring/_config.js index b8ccf586ae..eeb584dc18 100644 --- a/test/runtime/samples/instrumentation-script-destructuring/_config.js +++ b/test/runtime/samples/instrumentation-script-destructuring/_config.js @@ -11,19 +11,25 @@ export default { const click = new window.MouseEvent('click'); await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 1

- `); + ` + ); await buttons[1].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/instrumentation-script-loop-scope/_config.js b/test/runtime/samples/instrumentation-script-loop-scope/_config.js index 1b57ed1e72..963d01f936 100644 --- a/test/runtime/samples/instrumentation-script-loop-scope/_config.js +++ b/test/runtime/samples/instrumentation-script-loop-scope/_config.js @@ -9,9 +9,12 @@ export default { const click = new window.MouseEvent('click'); await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 42

- `); + ` + ); } }; diff --git a/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js b/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js index 1c4663938f..e729926aeb 100644 --- a/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js +++ b/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js @@ -19,10 +19,13 @@ export default { assert.equal(component.foo, 4); assert.equal(component.bar, 2); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo: 4

bar: 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/instrumentation-script-update/_config.js b/test/runtime/samples/instrumentation-script-update/_config.js index d662856a7b..abca3bb0cd 100644 --- a/test/runtime/samples/instrumentation-script-update/_config.js +++ b/test/runtime/samples/instrumentation-script-update/_config.js @@ -9,9 +9,12 @@ export default { const click = new window.MouseEvent('click'); await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 1

- `); + ` + ); } }; diff --git a/test/runtime/samples/instrumentation-template-destructuring/_config.js b/test/runtime/samples/instrumentation-template-destructuring/_config.js index b8ccf586ae..eeb584dc18 100644 --- a/test/runtime/samples/instrumentation-template-destructuring/_config.js +++ b/test/runtime/samples/instrumentation-template-destructuring/_config.js @@ -11,19 +11,25 @@ export default { const click = new window.MouseEvent('click'); await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 1

- `); + ` + ); await buttons[1].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/instrumentation-template-loop-scope/_config.js b/test/runtime/samples/instrumentation-template-loop-scope/_config.js index 1b57ed1e72..963d01f936 100644 --- a/test/runtime/samples/instrumentation-template-loop-scope/_config.js +++ b/test/runtime/samples/instrumentation-template-loop-scope/_config.js @@ -9,9 +9,12 @@ export default { const click = new window.MouseEvent('click'); await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 42

- `); + ` + ); } }; diff --git a/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js b/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js index 1c4663938f..e729926aeb 100644 --- a/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js +++ b/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js @@ -19,10 +19,13 @@ export default { assert.equal(component.foo, 4); assert.equal(component.bar, 2); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

foo: 4

bar: 2

- `); + ` + ); } }; diff --git a/test/runtime/samples/instrumentation-template-update/_config.js b/test/runtime/samples/instrumentation-template-update/_config.js index d662856a7b..abca3bb0cd 100644 --- a/test/runtime/samples/instrumentation-template-update/_config.js +++ b/test/runtime/samples/instrumentation-template-update/_config.js @@ -9,9 +9,12 @@ export default { const click = new window.MouseEvent('click'); await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

x: 1

- `); + ` + ); } }; diff --git a/test/runtime/samples/internal-state/_config.js b/test/runtime/samples/internal-state/_config.js index 6b8440aaf3..245397df24 100644 --- a/test/runtime/samples/internal-state/_config.js +++ b/test/runtime/samples/internal-state/_config.js @@ -10,9 +10,12 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

internal: 1

- `); + ` + ); } }; diff --git a/test/runtime/samples/key-block-post-hydrate/_config.js b/test/runtime/samples/key-block-post-hydrate/_config.js index e989d678e9..5c5472a376 100644 --- a/test/runtime/samples/key-block-post-hydrate/_config.js +++ b/test/runtime/samples/key-block-post-hydrate/_config.js @@ -8,12 +8,15 @@ export default { `, test({ assert, component, target }) { component.sortById = false; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
item 3something
item 2something
item 1something
- `); + ` + ); } }; diff --git a/test/runtime/samples/key-block-static-if/_config.js b/test/runtime/samples/key-block-static-if/_config.js index 2dfca9d8b6..3c6435e59a 100644 --- a/test/runtime/samples/key-block-static-if/_config.js +++ b/test/runtime/samples/key-block-static-if/_config.js @@ -10,12 +10,15 @@ export default { await button.dispatchEvent(new window.Event('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
First
Second
- `); + ` + ); } }; diff --git a/test/runtime/samples/keyed-each-dev-unique/_config.js b/test/runtime/samples/keyed-each-dev-unique/_config.js index d8a6745e16..9d1c5e2ac8 100644 --- a/test/runtime/samples/keyed-each-dev-unique/_config.js +++ b/test/runtime/samples/keyed-each-dev-unique/_config.js @@ -3,5 +3,6 @@ export default { dev: true }, - error: 'Cannot have duplicate keys in a keyed each: Keys at index 0 and 3 with value \'1\' are duplicates' + error: + "Cannot have duplicate keys in a keyed each: Keys at index 0 and 3 with value '1' are duplicates" }; diff --git a/test/runtime/samples/lifecycle-next-tick/_config.js b/test/runtime/samples/lifecycle-next-tick/_config.js index 35a66f7a09..e5e16b8adf 100644 --- a/test/runtime/samples/lifecycle-next-tick/_config.js +++ b/test/runtime/samples/lifecycle-next-tick/_config.js @@ -4,18 +4,10 @@ export default { const click = new window.MouseEvent('click'); await buttons[0].dispatchEvent(click); - assert.deepEqual(component.snapshots, [ - 'before 0', - 'after 1' - ]); + assert.deepEqual(component.snapshots, ['before 0', 'after 1']); await buttons[0].dispatchEvent(click); - assert.deepEqual(component.snapshots, [ - 'before 0', - 'after 1', - 'before 1', - 'after 2' - ]); + assert.deepEqual(component.snapshots, ['before 0', 'after 1', 'before 1', 'after 2']); await buttons[1].dispatchEvent(click); assert.deepEqual(component.snapshots, [ diff --git a/test/runtime/samples/lifecycle-render-order/_config.js b/test/runtime/samples/lifecycle-render-order/_config.js index 2bbab7a838..612b739207 100644 --- a/test/runtime/samples/lifecycle-render-order/_config.js +++ b/test/runtime/samples/lifecycle-render-order/_config.js @@ -7,11 +7,6 @@ export default { order.length = 0; }, test({ assert }) { - assert.deepEqual(order, [ - 'beforeUpdate', - 'render', - 'onMount', - 'afterUpdate' - ]); + assert.deepEqual(order, ['beforeUpdate', 'render', 'onMount', 'afterUpdate']); } }; diff --git a/test/runtime/samples/names-deconflicted-nested/_config.js b/test/runtime/samples/names-deconflicted-nested/_config.js index ec35d3e4e0..22793f9032 100644 --- a/test/runtime/samples/names-deconflicted-nested/_config.js +++ b/test/runtime/samples/names-deconflicted-nested/_config.js @@ -1,6 +1,10 @@ export default { props: { - array: [ [0,0,0], [0,0,0], [0,0,0] ] + array: [ + [0, 0, 0], + [0, 0, 0], + [0, 0, 0] + ] }, html: ` diff --git a/test/runtime/samples/names-deconflicted/_config.js b/test/runtime/samples/names-deconflicted/_config.js index 9ce1010690..54a6fa1337 100644 --- a/test/runtime/samples/names-deconflicted/_config.js +++ b/test/runtime/samples/names-deconflicted/_config.js @@ -2,11 +2,8 @@ export default { html: '

1: foo

2: bar

3: baz

', test({ assert, component, target }) { - component.widgets = [ - { name: 'bish' }, - { name: 'bosh' } - ]; + component.widgets = [{ name: 'bish' }, { name: 'bosh' }]; - assert.htmlEqual( target.innerHTML, '

1: bish

2: bosh

' ); + assert.htmlEqual(target.innerHTML, '

1: bish

2: bosh

'); } }; diff --git a/test/runtime/samples/nbsp-div/_config.js b/test/runtime/samples/nbsp-div/_config.js index 0d3264b720..5489360934 100644 --- a/test/runtime/samples/nbsp-div/_config.js +++ b/test/runtime/samples/nbsp-div/_config.js @@ -5,13 +5,13 @@ export default { test({ assert, target }) { const divList = target.querySelectorAll('div'); - assert.equal( divList[0].textContent.charCodeAt( 0 ), 160 ); - assert.equal( divList[1].textContent.charCodeAt( 0 ), 160 ); - assert.equal( divList[1].textContent.charCodeAt( 6 ), 160 ); - assert.equal( divList[1].textContent.charCodeAt( 7 ), 160 ); - assert.equal( divList[2].textContent.charCodeAt( 0 ), 160 ); - assert.equal( divList[2].textContent.charCodeAt( 6 ), 160 ); - assert.equal( divList[2].textContent.charCodeAt( 7 ), 32 ); //normal space - assert.equal( divList[2].textContent.charCodeAt( 8 ), 160 ); + assert.equal(divList[0].textContent.charCodeAt(0), 160); + assert.equal(divList[1].textContent.charCodeAt(0), 160); + assert.equal(divList[1].textContent.charCodeAt(6), 160); + assert.equal(divList[1].textContent.charCodeAt(7), 160); + assert.equal(divList[2].textContent.charCodeAt(0), 160); + assert.equal(divList[2].textContent.charCodeAt(6), 160); + assert.equal(divList[2].textContent.charCodeAt(7), 32); //normal space + assert.equal(divList[2].textContent.charCodeAt(8), 160); } }; diff --git a/test/runtime/samples/nbsp/_config.js b/test/runtime/samples/nbsp/_config.js index 89fea253d2..712de8b127 100644 --- a/test/runtime/samples/nbsp/_config.js +++ b/test/runtime/samples/nbsp/_config.js @@ -2,7 +2,7 @@ export default { html: ' ', test({ assert, target }) { - const text = target.querySelector( 'span' ).textContent; - assert.equal( text.charCodeAt( 0 ), 160 ); + const text = target.querySelector('span').textContent; + assert.equal(text.charCodeAt(0), 160); } }; diff --git a/test/runtime/samples/nested-transition-detach-each/_config.js b/test/runtime/samples/nested-transition-detach-each/_config.js index 8737cfa0fa..a7dafd16e1 100644 --- a/test/runtime/samples/nested-transition-detach-each/_config.js +++ b/test/runtime/samples/nested-transition-detach-each/_config.js @@ -13,7 +13,9 @@ export default { test({ assert, component, target, raf }) { component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
1, a
1, b
@@ -29,7 +31,8 @@ export default {
3, b
3, c
- `); + ` + ); component.visible = false; raf.tick(0); diff --git a/test/runtime/samples/nested-transition-detach-if-false/_config.js b/test/runtime/samples/nested-transition-detach-if-false/_config.js index 1d42094192..85de817a2b 100644 --- a/test/runtime/samples/nested-transition-detach-if-false/_config.js +++ b/test/runtime/samples/nested-transition-detach-if-false/_config.js @@ -15,10 +15,13 @@ export default { test({ assert, component, target }) { component.folder.open = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
  • a
  • - `); + ` + ); } }; diff --git a/test/runtime/samples/noscript-removal/_config.js b/test/runtime/samples/noscript-removal/_config.js index 0fd03ea223..a60a4f87b0 100644 --- a/test/runtime/samples/noscript-removal/_config.js +++ b/test/runtime/samples/noscript-removal/_config.js @@ -27,7 +27,7 @@ export default { }; function removeNoScript(target) { - target.querySelectorAll('noscript').forEach(elem => { + target.querySelectorAll('noscript').forEach((elem) => { elem.parentNode.removeChild(elem); }); } diff --git a/test/runtime/samples/observable-auto-subscribe/_config.js b/test/runtime/samples/observable-auto-subscribe/_config.js index 5570413395..2bee7c9c9e 100644 --- a/test/runtime/samples/observable-auto-subscribe/_config.js +++ b/test/runtime/samples/observable-auto-subscribe/_config.js @@ -3,7 +3,7 @@ const subscribers = []; let value = 'initial'; const observable = { - subscribe: fn => { + subscribe: (fn) => { subscribers.push(fn); fn(value); @@ -31,16 +31,22 @@ export default { component.visible = true; assert.equal(subscribers.length, 1); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    value: initial

    - `); + ` + ); value = 42; - await subscribers.forEach(fn => fn(value)); + await subscribers.forEach((fn) => fn(value)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    value: 42

    - `); + ` + ); component.visible = false; diff --git a/test/runtime/samples/ondestroy-deep/destroyed.js b/test/runtime/samples/ondestroy-deep/destroyed.js index 45845cbd83..7bfde507e9 100644 --- a/test/runtime/samples/ondestroy-deep/destroyed.js +++ b/test/runtime/samples/ondestroy-deep/destroyed.js @@ -1,3 +1,3 @@ export const destroyed = []; -export const reset = () => destroyed.length = 0; +export const reset = () => (destroyed.length = 0); diff --git a/test/runtime/samples/onmount-async/_config.js b/test/runtime/samples/onmount-async/_config.js index f1dcc36d41..ff85896d2e 100644 --- a/test/runtime/samples/onmount-async/_config.js +++ b/test/runtime/samples/onmount-async/_config.js @@ -1,3 +1,3 @@ export default { - skip: +(/^v(\d+)/.exec(process.version)[1]) < 8 + skip: +/^v(\d+)/.exec(process.version)[1] < 8 }; diff --git a/test/runtime/samples/onmount-sibling-order/_config.js b/test/runtime/samples/onmount-sibling-order/_config.js index bf8a52b2f6..eac73d1fb1 100644 --- a/test/runtime/samples/onmount-sibling-order/_config.js +++ b/test/runtime/samples/onmount-sibling-order/_config.js @@ -5,10 +5,7 @@ export default { skip: true, test({ assert }) { - assert.deepEqual(result, [ - 'onMount foo', - 'onMount bar' - ]); + assert.deepEqual(result, ['onMount foo', 'onMount bar']); result.pop(); result.pop(); diff --git a/test/runtime/samples/option-without-select/_config.js b/test/runtime/samples/option-without-select/_config.js index 9925069bb1..b1dcf33344 100644 --- a/test/runtime/samples/option-without-select/_config.js +++ b/test/runtime/samples/option-without-select/_config.js @@ -7,8 +7,11 @@ export default { test({ assert, component, target }) { component.foo = 'goodbye'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/paren-wrapped-expressions/_config.js b/test/runtime/samples/paren-wrapped-expressions/_config.js index 972dc51cb0..8cebf560d1 100644 --- a/test/runtime/samples/paren-wrapped-expressions/_config.js +++ b/test/runtime/samples/paren-wrapped-expressions/_config.js @@ -2,7 +2,7 @@ export default { props: { a: 'foo', b: true, - c: [ 1, 2, 3 ] + c: [1, 2, 3] }, html: ` diff --git a/test/runtime/samples/pre-tag/_config.js b/test/runtime/samples/pre-tag/_config.js index 56becee95d..7560441dc0 100644 --- a/test/runtime/samples/pre-tag/_config.js +++ b/test/runtime/samples/pre-tag/_config.js @@ -29,9 +29,13 @@ function get_html(ssr) { E F -
    leading newline
      leading newline and spaces
    ${ssr ? '\n' : ''}
    +  
    leading newline
      leading newline and spaces
    ${
    +		ssr ? '\n' : ''
    +	}
     leading newlines
    without spaces
      with spaces  
     
    -newline after leading space
    ${ssr ? '\n' : ''}
    +newline after leading space
    ${
    +		ssr ? '\n' : ''
    +	}
     
     multiple leading newlines
    `; } diff --git a/test/runtime/samples/preserve-whitespaces/_config.js b/test/runtime/samples/preserve-whitespaces/_config.js index 24cfb952f3..ed08764e13 100644 --- a/test/runtime/samples/preserve-whitespaces/_config.js +++ b/test/runtime/samples/preserve-whitespaces/_config.js @@ -1,9 +1,9 @@ export default { compileOptions: { preserveWhitespace: true - }, + }, - html: `
      A
    +	html: `
      A
       B
       
         C
    diff --git a/test/runtime/samples/prop-const/_config.js b/test/runtime/samples/prop-const/_config.js
    index 991063a754..f489a74d68 100644
    --- a/test/runtime/samples/prop-const/_config.js
    +++ b/test/runtime/samples/prop-const/_config.js
    @@ -15,9 +15,12 @@ export default {
     			b: 6
     		});
     
    -		assert.htmlEqual(target.innerHTML, `
    +		assert.htmlEqual(
    +			target.innerHTML,
    +			`
     			

    a: 5

    b: 2

    - `); + ` + ); } }; diff --git a/test/runtime/samples/props-reactive-b/_config.js b/test/runtime/samples/props-reactive-b/_config.js index 541fd26e02..93cad93d22 100644 --- a/test/runtime/samples/props-reactive-b/_config.js +++ b/test/runtime/samples/props-reactive-b/_config.js @@ -13,18 +13,24 @@ export default { async test({ assert, component, target }) { await component.$set({ a: 4 }); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    a: 4

    b: 2

    c: 6

    - `); + ` + ); await component.$set({ b: 5 }); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    a: 4

    b: 5

    c: 9

    - `); + ` + ); } }; diff --git a/test/runtime/samples/props-reactive/_config.js b/test/runtime/samples/props-reactive/_config.js index 4c27ac0618..2be0b59822 100644 --- a/test/runtime/samples/props-reactive/_config.js +++ b/test/runtime/samples/props-reactive/_config.js @@ -13,8 +13,11 @@ export default { test({ assert, component, target }) { component.d = 5; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    5

    - `); + ` + ); } }; diff --git a/test/runtime/samples/props/_config.js b/test/runtime/samples/props/_config.js index 64015cdc6b..55df3f9f2b 100644 --- a/test/runtime/samples/props/_config.js +++ b/test/runtime/samples/props/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.x = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    {"x":2}

    - `); + ` + ); } }; diff --git a/test/runtime/samples/raw-mustache-inside-head/_config.js b/test/runtime/samples/raw-mustache-inside-head/_config.js index 6d28a6e8c4..f478d186be 100644 --- a/test/runtime/samples/raw-mustache-inside-head/_config.js +++ b/test/runtime/samples/raw-mustache-inside-head/_config.js @@ -3,14 +3,29 @@ export default { const btn = target.querySelector('button'); const clickEvent = new window.MouseEvent('click'); - assert.equal(window.document.head.innerHTML.includes(''), true); + assert.equal( + window.document.head.innerHTML.includes( + '' + ), + true + ); await btn.dispatchEvent(clickEvent); - assert.equal(window.document.head.innerHTML.includes(''), true); + assert.equal( + window.document.head.innerHTML.includes( + '' + ), + true + ); await btn.dispatchEvent(clickEvent); - assert.equal(window.document.head.innerHTML.includes(''), true); + assert.equal( + window.document.head.innerHTML.includes( + '' + ), + true + ); } }; diff --git a/test/runtime/samples/raw-mustaches-preserved/_config.js b/test/runtime/samples/raw-mustaches-preserved/_config.js index 3bb61208b9..9bd0afbb6b 100644 --- a/test/runtime/samples/raw-mustaches-preserved/_config.js +++ b/test/runtime/samples/raw-mustaches-preserved/_config.js @@ -11,7 +11,9 @@ export default { const p = target.querySelector('p'); component.raw = '

    does not change

    '; - assert.htmlEqualWithOptions(target.innerHTML, '

    does not change

    ', { withoutNormalizeHtml: true }); + assert.htmlEqualWithOptions(target.innerHTML, '

    does not change

    ', { + withoutNormalizeHtml: true + }); assert.strictEqual(target.querySelector('p'), p); } }; diff --git a/test/runtime/samples/raw-mustaches/_config.js b/test/runtime/samples/raw-mustaches/_config.js index a69b91d2d8..44087edcd8 100644 --- a/test/runtime/samples/raw-mustaches/_config.js +++ b/test/runtime/samples/raw-mustaches/_config.js @@ -1,5 +1,4 @@ export default { - props: { raw: 'raw html!!!\\o/' }, diff --git a/test/runtime/samples/reactive-compound-operator/_config.js b/test/runtime/samples/reactive-compound-operator/_config.js index dd59fbbf0a..692400b9dc 100644 --- a/test/runtime/samples/reactive-compound-operator/_config.js +++ b/test/runtime/samples/reactive-compound-operator/_config.js @@ -11,17 +11,23 @@ export default { await button.dispatchEvent(click); assert.equal(component.x, 2); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    count: 2

    - `); + ` + ); await button.dispatchEvent(click); assert.equal(component.x, 6); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    count: 6

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-function-called-reassigned/_config.js b/test/runtime/samples/reactive-function-called-reassigned/_config.js index 3469c285af..3d0a241c4c 100644 --- a/test/runtime/samples/reactive-function-called-reassigned/_config.js +++ b/test/runtime/samples/reactive-function-called-reassigned/_config.js @@ -1,7 +1,7 @@ let value; let called = 0; function callback(_value) { - called ++; + called++; value = _value; } diff --git a/test/runtime/samples/reactive-import-statement/_config.js b/test/runtime/samples/reactive-import-statement/_config.js index 45a844afa0..4635104464 100644 --- a/test/runtime/samples/reactive-import-statement/_config.js +++ b/test/runtime/samples/reactive-import-statement/_config.js @@ -16,23 +16,29 @@ export default { const clickEvent = new window.MouseEvent('click'); await btn.dispatchEvent(clickEvent); - - assert.htmlEqual(target.innerHTML, ` + + assert.htmlEqual( + target.innerHTML, + ` import

    1 + 2 + 3 + 4 + 5 = 15

    local

    1 + 2 + 3 + 4 + 5 = 15

    - `); + ` + ); await btn.dispatchEvent(clickEvent); - - assert.htmlEqual(target.innerHTML, ` + + assert.htmlEqual( + target.innerHTML, + ` import

    1 + 2 + 3 + 4 + 5 + 6 = 21

    local

    1 + 2 + 3 + 4 + 5 + 6 = 21

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-statement-indirect/_config.js b/test/runtime/samples/reactive-statement-indirect/_config.js index 9265ded073..ff41a7eb34 100644 --- a/test/runtime/samples/reactive-statement-indirect/_config.js +++ b/test/runtime/samples/reactive-statement-indirect/_config.js @@ -6,9 +6,12 @@ export default { async test({ assert, target }) { await target.querySelector('button').dispatchEvent(new window.MouseEvent('click')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    4

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-statement-module-vars/_config.js b/test/runtime/samples/reactive-statement-module-vars/_config.js index 63b89cd164..67f13af3e2 100644 --- a/test/runtime/samples/reactive-statement-module-vars/_config.js +++ b/test/runtime/samples/reactive-statement-module-vars/_config.js @@ -8,11 +8,14 @@ export default { async test({ assert, target, component }) { await component.updateModuleA(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` a: moduleA b: moduleB moduleA: moduleA moduleB: moduleB - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-update-expression/_config.js b/test/runtime/samples/reactive-update-expression/_config.js index 111460f7dd..8e973fb5ec 100644 --- a/test/runtime/samples/reactive-update-expression/_config.js +++ b/test/runtime/samples/reactive-update-expression/_config.js @@ -13,17 +13,23 @@ export default { await button.dispatchEvent(click); assert.equal(component.x, 3); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    count: 3

    - `); + ` + ); await button.dispatchEvent(click); assert.equal(component.x, 5); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    count: 5

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-value-function-hoist-b/_config.js b/test/runtime/samples/reactive-value-function-hoist-b/_config.js index 04c4fd3f11..112fa2a954 100644 --- a/test/runtime/samples/reactive-value-function-hoist-b/_config.js +++ b/test/runtime/samples/reactive-value-function-hoist-b/_config.js @@ -8,8 +8,11 @@ export default { const button = target.querySelector('button'); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-value-function-hoist/_config.js b/test/runtime/samples/reactive-value-function-hoist/_config.js index 6198a57ef6..3d0e7f1e41 100644 --- a/test/runtime/samples/reactive-value-function-hoist/_config.js +++ b/test/runtime/samples/reactive-value-function-hoist/_config.js @@ -8,8 +8,11 @@ export default { const button = target.querySelector('button'); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-value-mutate-const/_config.js b/test/runtime/samples/reactive-value-mutate-const/_config.js index da0a19dd28..efe1eba6df 100644 --- a/test/runtime/samples/reactive-value-mutate-const/_config.js +++ b/test/runtime/samples/reactive-value-mutate-const/_config.js @@ -9,9 +9,12 @@ export default { const click = new window.MouseEvent('click'); await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    {"foo":42}
    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-deconflicted/_config.js b/test/runtime/samples/reactive-values-deconflicted/_config.js index c9ab700bd8..57ffcb20e9 100644 --- a/test/runtime/samples/reactive-values-deconflicted/_config.js +++ b/test/runtime/samples/reactive-values-deconflicted/_config.js @@ -3,8 +3,11 @@ export default { test({ assert, component, target }) { component.x = 'ready'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` ready - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-fixed/_config.js b/test/runtime/samples/reactive-values-fixed/_config.js index 9f25b3e24e..7eb2d4a648 100644 --- a/test/runtime/samples/reactive-values-fixed/_config.js +++ b/test/runtime/samples/reactive-values-fixed/_config.js @@ -4,8 +4,11 @@ export default { `, test({ assert, target }) { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    4

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-implicit-destructured/_config.js b/test/runtime/samples/reactive-values-implicit-destructured/_config.js index 80e4b8ea44..45a5a8108b 100644 --- a/test/runtime/samples/reactive-values-implicit-destructured/_config.js +++ b/test/runtime/samples/reactive-values-implicit-destructured/_config.js @@ -11,15 +11,21 @@ export default { test({ assert, component, target }) { component.coords = [1, 2]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    1,2

    42

    - `); + ` + ); component.numbers = { answer: 43 }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    1,2

    43

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-implicit-self-dependency/_config.js b/test/runtime/samples/reactive-values-implicit-self-dependency/_config.js index f215de098e..bbf6723ece 100644 --- a/test/runtime/samples/reactive-values-implicit-self-dependency/_config.js +++ b/test/runtime/samples/reactive-values-implicit-self-dependency/_config.js @@ -6,14 +6,20 @@ export default { test({ assert, component, target }) { component.num = 3; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    3 / 3

    - `); + ` + ); component.num = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    2 / 3

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-implicit/_config.js b/test/runtime/samples/reactive-values-implicit/_config.js index fae6f9e701..e0f10f8935 100644 --- a/test/runtime/samples/reactive-values-implicit/_config.js +++ b/test/runtime/samples/reactive-values-implicit/_config.js @@ -6,9 +6,12 @@ export default { test({ assert, component, target }) { component.a = 3; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    3 + 2 = 5

    5 * 5 = 25

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-no-dependencies/_config.js b/test/runtime/samples/reactive-values-no-dependencies/_config.js index 71a63c9189..5e18619a3a 100644 --- a/test/runtime/samples/reactive-values-no-dependencies/_config.js +++ b/test/runtime/samples/reactive-values-no-dependencies/_config.js @@ -5,8 +5,11 @@ export default { test({ assert, component, target }) { component.width = 50; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    10 - 40

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-non-cyclical-declaration-order-independent/_config.js b/test/runtime/samples/reactive-values-non-cyclical-declaration-order-independent/_config.js index 989e6d458c..8aca87dc17 100644 --- a/test/runtime/samples/reactive-values-non-cyclical-declaration-order-independent/_config.js +++ b/test/runtime/samples/reactive-values-non-cyclical-declaration-order-independent/_config.js @@ -4,8 +4,11 @@ export default { `, test({ assert, target }) { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    2+2=4

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-non-cyclical/_config.js b/test/runtime/samples/reactive-values-non-cyclical/_config.js index e134a669ee..24b47df6d4 100644 --- a/test/runtime/samples/reactive-values-non-cyclical/_config.js +++ b/test/runtime/samples/reactive-values-non-cyclical/_config.js @@ -10,8 +10,11 @@ export default { test({ assert, component, target }) { component.x = 43; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    43 43

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-overwrite/_config.js b/test/runtime/samples/reactive-values-overwrite/_config.js index 644a49ec0d..4b4dc35372 100644 --- a/test/runtime/samples/reactive-values-overwrite/_config.js +++ b/test/runtime/samples/reactive-values-overwrite/_config.js @@ -7,15 +7,21 @@ export default { component.a = 2; assert.equal(component.doubled, 4); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    doubled: 4

    - `); + ` + ); component.doubled = 3; assert.equal(component.doubled, 3); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    doubled: 3

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-self-dependency-b/_config.js b/test/runtime/samples/reactive-values-self-dependency-b/_config.js index 9b2b5a2dd6..0f71ee6058 100644 --- a/test/runtime/samples/reactive-values-self-dependency-b/_config.js +++ b/test/runtime/samples/reactive-values-self-dependency-b/_config.js @@ -6,14 +6,20 @@ export default { test({ assert, component, target }) { component.count = 5; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    count: 5

    - `); + ` + ); component.count = 50; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    count: 9

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-self-dependency/_config.js b/test/runtime/samples/reactive-values-self-dependency/_config.js index 5a3d1978fb..7670be4502 100644 --- a/test/runtime/samples/reactive-values-self-dependency/_config.js +++ b/test/runtime/samples/reactive-values-self-dependency/_config.js @@ -7,9 +7,12 @@ export default { test({ assert, component, target }) { component.a = 3; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    3 + 2 = 5

    Times calculated: 2

    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values-text-node/_config.js b/test/runtime/samples/reactive-values-text-node/_config.js index fb859285dd..990e116166 100644 --- a/test/runtime/samples/reactive-values-text-node/_config.js +++ b/test/runtime/samples/reactive-values-text-node/_config.js @@ -1,9 +1,12 @@ export default { - html:'
    same text
    ', + html: '
    same text
    ', async test({ assert, target }) { - await new Promise(f => setTimeout(f, 10)); - assert.htmlEqual(target.innerHTML, ` + await new Promise((f) => setTimeout(f, 10)); + assert.htmlEqual( + target.innerHTML, + `
    same text text
    - `); + ` + ); } }; diff --git a/test/runtime/samples/reactive-values/_config.js b/test/runtime/samples/reactive-values/_config.js index 345166046a..1d12395c05 100644 --- a/test/runtime/samples/reactive-values/_config.js +++ b/test/runtime/samples/reactive-values/_config.js @@ -8,9 +8,12 @@ export default { component.a = 3; assert.equal(component.c, 5); assert.equal(component.cSquared, 25); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    3 + 2 = 5

    5 * 5 = 25

    - `); + ` + ); } }; diff --git a/test/runtime/samples/select-bind-array/_config.js b/test/runtime/samples/select-bind-array/_config.js index 317196e8c3..983b7c9f77 100644 --- a/test/runtime/samples/select-bind-array/_config.js +++ b/test/runtime/samples/select-bind-array/_config.js @@ -1,4 +1,4 @@ -const items = [ { id: 'a' }, { id: 'b' } ]; +const items = [{ id: 'a' }, { id: 'b' }]; export default { skip_if_ssr: true, @@ -9,14 +9,14 @@ export default { }, test({ assert, component, target }) { - const options = target.querySelectorAll( 'option' ); + const options = target.querySelectorAll('option'); - assert.equal( options[0].selected, false ); - assert.equal( options[1].selected, true ); + assert.equal(options[0].selected, false); + assert.equal(options[1].selected, true); component.foo = items[0].id; - assert.equal( options[0].selected, true ); - assert.equal( options[1].selected, false ); + assert.equal(options[0].selected, true); + assert.equal(options[1].selected, false); } }; diff --git a/test/runtime/samples/select-bind-in-array/_config.js b/test/runtime/samples/select-bind-in-array/_config.js index 79c5641324..5f4507899c 100644 --- a/test/runtime/samples/select-bind-in-array/_config.js +++ b/test/runtime/samples/select-bind-in-array/_config.js @@ -1,4 +1,4 @@ -const items = [ { id: 'a' }, { id: 'b' } ]; +const items = [{ id: 'a' }, { id: 'b' }]; export default { skip_if_ssr: true, @@ -10,7 +10,7 @@ export default { test({ assert, component }) { const items = component.items; - assert.equal( items[0].id, 'a' ); - assert.equal( items[1].id, 'b' ); + assert.equal(items[0].id, 'a'); + assert.equal(items[1].id, 'b'); } }; diff --git a/test/runtime/samples/select-change-handler/_config.js b/test/runtime/samples/select-change-handler/_config.js index 9620ca5aba..3e5afdbf69 100644 --- a/test/runtime/samples/select-change-handler/_config.js +++ b/test/runtime/samples/select-change-handler/_config.js @@ -1,6 +1,6 @@ export default { props: { - options: [ { id: 'a' }, { id: 'b' }, { id: 'c' } ], + options: [{ id: 'a' }, { id: 'b' }, { id: 'c' }], selected: 'b' }, diff --git a/test/runtime/samples/select-no-whitespace/_config.js b/test/runtime/samples/select-no-whitespace/_config.js index b00b800033..7e9238fc28 100644 --- a/test/runtime/samples/select-no-whitespace/_config.js +++ b/test/runtime/samples/select-no-whitespace/_config.js @@ -1,6 +1,6 @@ export default { test({ assert, target }) { - const select = target.querySelector( 'select' ); - assert.equal( select.childNodes.length, 3 ); + const select = target.querySelector('select'); + assert.equal(select.childNodes.length, 3); } }; diff --git a/test/runtime/samples/select-one-way-bind-object/_config.js b/test/runtime/samples/select-one-way-bind-object/_config.js index bc6ab286b3..f789b0d0ff 100644 --- a/test/runtime/samples/select-one-way-bind-object/_config.js +++ b/test/runtime/samples/select-one-way-bind-object/_config.js @@ -1,4 +1,4 @@ -const items = [ {}, {} ]; +const items = [{}, {}]; export default { skip_if_ssr: true, @@ -9,14 +9,14 @@ export default { }, test({ assert, component, target }) { - const options = target.querySelectorAll( 'option' ); + const options = target.querySelectorAll('option'); - assert.equal( options[0].selected, true ); - assert.equal( options[1].selected, false ); + assert.equal(options[0].selected, true); + assert.equal(options[1].selected, false); component.foo = items[1]; - assert.equal( options[0].selected, false ); - assert.equal( options[1].selected, true ); + assert.equal(options[0].selected, false); + assert.equal(options[1].selected, true); } }; diff --git a/test/runtime/samples/select-one-way-bind/_config.js b/test/runtime/samples/select-one-way-bind/_config.js index 94288e5e60..5304e99dd6 100644 --- a/test/runtime/samples/select-one-way-bind/_config.js +++ b/test/runtime/samples/select-one-way-bind/_config.js @@ -6,14 +6,14 @@ export default { }, test({ assert, component, target }) { - const options = target.querySelectorAll( 'option' ); + const options = target.querySelectorAll('option'); - assert.equal( options[0].selected, true ); - assert.equal( options[1].selected, false ); + assert.equal(options[0].selected, true); + assert.equal(options[1].selected, false); component.foo = 'b'; - assert.equal( options[0].selected, false ); - assert.equal( options[1].selected, true ); + assert.equal(options[0].selected, false); + assert.equal(options[1].selected, true); } }; diff --git a/test/runtime/samples/select/_config.js b/test/runtime/samples/select/_config.js index eb400a3cab..ccda56dab6 100644 --- a/test/runtime/samples/select/_config.js +++ b/test/runtime/samples/select/_config.js @@ -15,13 +15,16 @@ export default { `, test({ assert, component, target }) { - assert.htmlEqual(target.innerHTML,` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); assert.equal(target.querySelector('select').value, 'a'); diff --git a/test/runtime/samples/set-in-onstate/_config.js b/test/runtime/samples/set-in-onstate/_config.js index f54527f3c2..012a2aafb3 100644 --- a/test/runtime/samples/set-in-onstate/_config.js +++ b/test/runtime/samples/set-in-onstate/_config.js @@ -8,9 +8,12 @@ export default { test({ assert, component, target }) { component.foo = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    2

    4

    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-component-2/_config.js b/test/runtime/samples/spread-component-2/_config.js index e5441bc4b9..ed961f8fc5 100644 --- a/test/runtime/samples/spread-component-2/_config.js +++ b/test/runtime/samples/spread-component-2/_config.js @@ -1,16 +1,19 @@ export default { props: { - list: [{ - foo: 'lol', - baz: 40 + 2, - qux: 5, - quux: 'core' - }, { - foo: 'lolzz', - baz: 50 + 2, - qux: 1, - quux: 'quuxx' - }] + list: [ + { + foo: 'lol', + baz: 40 + 2, + qux: 5, + quux: 'core' + }, + { + foo: 'lolzz', + baz: 50 + 2, + qux: 1, + quux: 'quuxx' + } + ] }, html: ` @@ -29,19 +32,24 @@ export default { `, test({ assert, component, target }) { - component.list = [{ - foo: 'lol', - baz: 40 + 3, - qux: 8, - quux: 'heart' - }, { - foo: 'lolzz', - baz: 50 + 3, - qux: 8, - quux: 'heartxx' - }]; + component.list = [ + { + foo: 'lol', + baz: 40 + 3, + qux: 8, + quux: 'heart' + }, + { + foo: 'lolzz', + baz: 50 + 3, + qux: 8, + quux: 'heartxx' + } + ]; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    foo: lol

    baz: 43 (number)

    @@ -54,11 +62,14 @@ export default {

    quux: heartxx

    selected: false

    - `); + ` + ); component.qux = 1; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    foo: lol

    baz: 43 (number)

    @@ -71,6 +82,7 @@ export default {

    quux: heartxx

    selected: true

    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js b/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js index d7ad47b01f..465376f901 100644 --- a/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js +++ b/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js @@ -48,6 +48,5 @@ export default { // test number component.props = 123; assert.htmlEqual(target.innerHTML, html); - } }; diff --git a/test/runtime/samples/spread-component-dynamic-non-object/_config.js b/test/runtime/samples/spread-component-dynamic-non-object/_config.js index fa8de8ad94..45aa610de2 100644 --- a/test/runtime/samples/spread-component-dynamic-non-object/_config.js +++ b/test/runtime/samples/spread-component-dynamic-non-object/_config.js @@ -46,6 +46,5 @@ export default { // test number component.props = 123; assert.htmlEqual(target.innerHTML, html); - } }; diff --git a/test/runtime/samples/spread-component-multiple-dependencies/_config.js b/test/runtime/samples/spread-component-multiple-dependencies/_config.js index ee2c0feda8..72bb9ea651 100644 --- a/test/runtime/samples/spread-component-multiple-dependencies/_config.js +++ b/test/runtime/samples/spread-component-multiple-dependencies/_config.js @@ -2,9 +2,6 @@ export default { html: 'b baz', test({ assert, component, target }) { component.foo = true; - assert.htmlEqual( - target.innerHTML, - 'a baz' - ); + assert.htmlEqual(target.innerHTML, 'a baz'); } }; diff --git a/test/runtime/samples/spread-component-side-effects/_config.js b/test/runtime/samples/spread-component-side-effects/_config.js index 35c4fb7474..3c1c607c91 100644 --- a/test/runtime/samples/spread-component-side-effects/_config.js +++ b/test/runtime/samples/spread-component-side-effects/_config.js @@ -10,10 +10,13 @@ export default { test({ assert, component, target }) { component.foo = 'lol'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    i: 2

    foo: lol

    qux: named

    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-component-with-bind/_config.js b/test/runtime/samples/spread-component-with-bind/_config.js index 5394fa80e0..478cc02d45 100644 --- a/test/runtime/samples/spread-component-with-bind/_config.js +++ b/test/runtime/samples/spread-component-with-bind/_config.js @@ -15,9 +15,12 @@ export default { input.value = 'bar'; await input.dispatchEvent(new window.Event('input')); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    bar

    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-component/_config.js b/test/runtime/samples/spread-component/_config.js index b2cf9d704f..537860f72c 100644 --- a/test/runtime/samples/spread-component/_config.js +++ b/test/runtime/samples/spread-component/_config.js @@ -23,11 +23,14 @@ export default { quux: 'heart' }; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    foo: wut

    baz: 43 (number)

    qux: named

    quux: heart

    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-each-component/_config.js b/test/runtime/samples/spread-each-component/_config.js index 66d2381875..8a484699d0 100644 --- a/test/runtime/samples/spread-each-component/_config.js +++ b/test/runtime/samples/spread-each-component/_config.js @@ -16,9 +16,12 @@ export default { component.things = things.reverse(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-each-element/_config.js b/test/runtime/samples/spread-each-element/_config.js index 579f840099..ccc7a58114 100644 --- a/test/runtime/samples/spread-each-element/_config.js +++ b/test/runtime/samples/spread-each-element/_config.js @@ -16,9 +16,12 @@ export default { component.things = things.reverse(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-element-boolean/_config.js b/test/runtime/samples/spread-element-boolean/_config.js index 3ceeb3f677..ce1849be3f 100644 --- a/test/runtime/samples/spread-element-boolean/_config.js +++ b/test/runtime/samples/spread-element-boolean/_config.js @@ -16,10 +16,7 @@ export default { component.props = { disabled: false }; - assert.htmlEqual( - target.innerHTML, - '' - ); + assert.htmlEqual(target.innerHTML, ''); assert.ok(!button.disabled); } }; diff --git a/test/runtime/samples/spread-element-input-value/_config.js b/test/runtime/samples/spread-element-input-value/_config.js index e8672e8365..64ae0fe469 100644 --- a/test/runtime/samples/spread-element-input-value/_config.js +++ b/test/runtime/samples/spread-element-input-value/_config.js @@ -13,15 +13,15 @@ export default { const spy1 = spyOnValueSetter(input1, input1.value); const spy2 = spyOnValueSetter(input2, input2.value); - + const event = new window.Event('input'); - + input1.value = '12345'; spy1.reset(); await input1.dispatchEvent(event); assert.ok(!spy1.isSetCalled()); - + input2.value = '12345'; spy2.reset(); await input2.dispatchEvent(event); diff --git a/test/runtime/samples/spread-element-multiple-dependencies/_config.js b/test/runtime/samples/spread-element-multiple-dependencies/_config.js index 6183e6bf6e..5078df6b58 100644 --- a/test/runtime/samples/spread-element-multiple-dependencies/_config.js +++ b/test/runtime/samples/spread-element-multiple-dependencies/_config.js @@ -2,9 +2,6 @@ export default { html: "
    ", test({ assert, component, target }) { component.foo = true; - assert.htmlEqual( - target.innerHTML, - "
    " - ); + assert.htmlEqual(target.innerHTML, "
    "); } }; diff --git a/test/runtime/samples/spread-element/_config.js b/test/runtime/samples/spread-element/_config.js index 2332891b67..215e4a56f4 100644 --- a/test/runtime/samples/spread-element/_config.js +++ b/test/runtime/samples/spread-element/_config.js @@ -2,20 +2,20 @@ export default { html: '
    red
    ', test({ assert, component, target }) { - const div = target.querySelector( 'div' ); + const div = target.querySelector('div'); - assert.equal( div.dataset.foo, 'bar' ); - assert.equal( div.dataset.named, 'value' ); + assert.equal(div.dataset.foo, 'bar'); + assert.equal(div.dataset.named, 'value'); component.color = 'blue'; component.props = { 'data-foo': 'baz', 'data-named': 'qux' }; - assert.htmlEqual( target.innerHTML, '
    blue
    ' ); - assert.equal( div.dataset.foo, 'baz' ); - assert.equal( div.dataset.named, 'value' ); + assert.htmlEqual(target.innerHTML, '
    blue
    '); + assert.equal(div.dataset.foo, 'baz'); + assert.equal(div.dataset.named, 'value'); component.color = 'blue'; component.props = {}; - assert.htmlEqual( target.innerHTML, '
    blue
    ' ); - assert.equal( div.dataset.foo, undefined ); + assert.htmlEqual(target.innerHTML, '
    blue
    '); + assert.equal(div.dataset.foo, undefined); } }; diff --git a/test/runtime/samples/spread-own-props/_config.js b/test/runtime/samples/spread-own-props/_config.js index e834cc95f1..17ddec6546 100644 --- a/test/runtime/samples/spread-own-props/_config.js +++ b/test/runtime/samples/spread-own-props/_config.js @@ -21,11 +21,14 @@ export default { quux: 'heart' }); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    foo: wut

    baz: 43 (number)

    qux: named

    quux: heart

    - `); + ` + ); } }; diff --git a/test/runtime/samples/spread-reuse-levels/_config.js b/test/runtime/samples/spread-reuse-levels/_config.js index 5acd36bdf8..0b19296c40 100644 --- a/test/runtime/samples/spread-reuse-levels/_config.js +++ b/test/runtime/samples/spread-reuse-levels/_config.js @@ -12,9 +12,12 @@ export default { test({ assert, component, target }) { component.a = 2; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    {"a":2,"b":[1],"c":42}
    {"a":true,"b":false,"c":false}
    - `); + ` + ); } }; diff --git a/test/runtime/samples/state-deconflicted/_config.js b/test/runtime/samples/state-deconflicted/_config.js index ff1b10b481..1064b8811e 100644 --- a/test/runtime/samples/state-deconflicted/_config.js +++ b/test/runtime/samples/state-deconflicted/_config.js @@ -1,13 +1,7 @@ export default { props: { state: 'deconflicted', - states: [ - 'Alabama', - 'Alaska', - 'Arizona', - 'Arkansas', - '...and some others' - ] + states: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', '...and some others'] }, html: ` @@ -34,7 +28,9 @@ export default { 'Montana' ]; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    Current state: deconflicted

      @@ -47,6 +43,7 @@ export default {
    • Missouri
    • Montana
    - ` ); + ` + ); } }; diff --git a/test/runtime/samples/store-assignment-updates-property/_config.js b/test/runtime/samples/store-assignment-updates-property/_config.js index 467e7782d6..7a963dd553 100644 --- a/test/runtime/samples/store-assignment-updates-property/_config.js +++ b/test/runtime/samples/store-assignment-updates-property/_config.js @@ -12,20 +12,26 @@ export default { await btn1.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    a: {"foo":4,"bar":2}

    b: {"foo":4,"baz":0}

    - `); + ` + ); await btn2.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    a: {"foo":5,"bar":2}

    b: {"foo":5,"qux":0}

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-assignment-updates-reactive/_config.js b/test/runtime/samples/store-assignment-updates-reactive/_config.js index a9606d9d68..4282809c80 100644 --- a/test/runtime/samples/store-assignment-updates-reactive/_config.js +++ b/test/runtime/samples/store-assignment-updates-reactive/_config.js @@ -21,22 +21,28 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    a: 1

    b: 1

    c: 1

    - `); + ` + ); await component.c.set(42); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    a: 42

    b: 42

    c: 42

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-assignment-updates/_config.js b/test/runtime/samples/store-assignment-updates/_config.js index c4a09a978e..e33908e793 100644 --- a/test/runtime/samples/store-assignment-updates/_config.js +++ b/test/runtime/samples/store-assignment-updates/_config.js @@ -16,16 +16,22 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    doubled: 2

    - `); + ` + ); await component.count.set(42); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    doubled: 84

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe-event-callback/_config.js b/test/runtime/samples/store-auto-subscribe-event-callback/_config.js index 7897036809..58b1740f0f 100644 --- a/test/runtime/samples/store-auto-subscribe-event-callback/_config.js +++ b/test/runtime/samples/store-auto-subscribe-event-callback/_config.js @@ -13,10 +13,13 @@ export default { await input.dispatchEvent(inputEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` Dirty: true Valid: true - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe-implicit/_config.js b/test/runtime/samples/store-auto-subscribe-implicit/_config.js index f132901bf0..1aaec13214 100644 --- a/test/runtime/samples/store-auto-subscribe-implicit/_config.js +++ b/test/runtime/samples/store-auto-subscribe-implicit/_config.js @@ -15,14 +15,20 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); await component.count.set(42); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe-in-each/_config.js b/test/runtime/samples/store-auto-subscribe-in-each/_config.js index 8c8fa001d8..b28bd23579 100644 --- a/test/runtime/samples/store-auto-subscribe-in-each/_config.js +++ b/test/runtime/samples/store-auto-subscribe-in-each/_config.js @@ -4,11 +4,7 @@ export default { skip: true, props: { - things: [ - writable('a'), - writable('b'), - writable('c') - ] + things: [writable('a'), writable('b'), writable('c')] }, html: ` @@ -23,18 +19,24 @@ export default { await buttons[1].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); await component.things[1].set('d'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe-in-reactive-declaration-2/_config.js b/test/runtime/samples/store-auto-subscribe-in-reactive-declaration-2/_config.js index 560eb44a9a..10aa438d7c 100644 --- a/test/runtime/samples/store-auto-subscribe-in-reactive-declaration-2/_config.js +++ b/test/runtime/samples/store-auto-subscribe-in-reactive-declaration-2/_config.js @@ -7,9 +7,12 @@ export default { async test({ assert, component, target }) { await component.update_value('Hi Svelte'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    Hi Svelte
    Hi Svelte
    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js b/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js index cf1bdce68a..3f0a12e390 100644 --- a/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js +++ b/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js @@ -15,14 +15,20 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); await component.count.set(42); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe-nullish/_config.js b/test/runtime/samples/store-auto-subscribe-nullish/_config.js index 52e21cef05..00e7b39e19 100644 --- a/test/runtime/samples/store-auto-subscribe-nullish/_config.js +++ b/test/runtime/samples/store-auto-subscribe-nullish/_config.js @@ -6,8 +6,11 @@ export default { `, async test({ assert, component, target }) { component.store = writable('foo'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    foo

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe-removed-store/_config.js b/test/runtime/samples/store-auto-subscribe-removed-store/_config.js index 12297a3b8a..6e5ec49e06 100644 --- a/test/runtime/samples/store-auto-subscribe-removed-store/_config.js +++ b/test/runtime/samples/store-auto-subscribe-removed-store/_config.js @@ -6,16 +6,25 @@ export default { `, async test({ assert, component, target }) { component.store = writable('foo'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    foo

    - `); + ` + ); component.store = undefined; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    undefined

    - `); + ` + ); component.store = writable('bar'); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    bar

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-auto-subscribe/_config.js b/test/runtime/samples/store-auto-subscribe/_config.js index f132901bf0..1aaec13214 100644 --- a/test/runtime/samples/store-auto-subscribe/_config.js +++ b/test/runtime/samples/store-auto-subscribe/_config.js @@ -15,14 +15,20 @@ export default { await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); await component.count.set(42); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/store-contextual/_config.js b/test/runtime/samples/store-contextual/_config.js index 0b7aa6cf33..073cd62a78 100644 --- a/test/runtime/samples/store-contextual/_config.js +++ b/test/runtime/samples/store-contextual/_config.js @@ -7,7 +7,8 @@ const todos = [ ]; export default { - error: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)', + error: + 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)', props: { todos @@ -37,7 +38,9 @@ export default { inputs[1].checked = true; await inputs[1].dispatchEvent(change); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); - await todos[0].update(todo => ({ done: !todo.done, text: todo.text })); + await todos[0].update((todo) => ({ done: !todo.done, text: todo.text })); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - `); + ` + ); } }; diff --git a/test/runtime/samples/store-each-binding-deep/_config.js b/test/runtime/samples/store-each-binding-deep/_config.js index c5f2402ae2..b3de6fad7d 100644 --- a/test/runtime/samples/store-each-binding-deep/_config.js +++ b/test/runtime/samples/store-each-binding-deep/_config.js @@ -6,9 +6,12 @@ export default { input.value = 'changed'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    changed

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-each-binding-destructuring/_config.js b/test/runtime/samples/store-each-binding-destructuring/_config.js index c5f2402ae2..b3de6fad7d 100644 --- a/test/runtime/samples/store-each-binding-destructuring/_config.js +++ b/test/runtime/samples/store-each-binding-destructuring/_config.js @@ -6,9 +6,12 @@ export default { input.value = 'changed'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    changed

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-each-binding/_config.js b/test/runtime/samples/store-each-binding/_config.js index c5f2402ae2..b3de6fad7d 100644 --- a/test/runtime/samples/store-each-binding/_config.js +++ b/test/runtime/samples/store-each-binding/_config.js @@ -6,9 +6,12 @@ export default { input.value = 'changed'; await input.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    changed

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-invalidation-while-update-1/_config.js b/test/runtime/samples/store-invalidation-while-update-1/_config.js index bc78193ae7..eaa5b3c92b 100644 --- a/test/runtime/samples/store-invalidation-while-update-1/_config.js +++ b/test/runtime/samples/store-invalidation-while-update-1/_config.js @@ -22,29 +22,38 @@ export default { input.value = 'foo'; await input.dispatchEvent(inputEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    foo
    foo
    - `); + ` + ); await button.dispatchEvent(clickEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    foo
    clicked
    - `); + ` + ); input.value = 'bar'; await input.dispatchEvent(inputEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    bar
    bar
    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-invalidation-while-update-2/_config.js b/test/runtime/samples/store-invalidation-while-update-2/_config.js index 78104ef293..8c318b0faf 100644 --- a/test/runtime/samples/store-invalidation-while-update-2/_config.js +++ b/test/runtime/samples/store-invalidation-while-update-2/_config.js @@ -22,29 +22,38 @@ export default { input.value = 'foo'; await input.dispatchEvent(inputEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    foo
    foo
    - `); + ` + ); await button.dispatchEvent(clickEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    foo
    clicked
    - `); + ` + ); input.value = 'bar'; await input.dispatchEvent(inputEvent); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    bar
    bar
    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-resubscribe-export/_config.js b/test/runtime/samples/store-resubscribe-export/_config.js index f6630aa045..e13b917cc8 100644 --- a/test/runtime/samples/store-resubscribe-export/_config.js +++ b/test/runtime/samples/store-resubscribe-export/_config.js @@ -1,7 +1,7 @@ let unsubscribeCalled = false; -const fakeStore = val => ({ - subscribe: cb => { +const fakeStore = (val) => ({ + subscribe: (cb) => { cb(val); return { unsubscribe: () => { diff --git a/test/runtime/samples/store-resubscribe/_config.js b/test/runtime/samples/store-resubscribe/_config.js index 82d40f9add..fed2e1a204 100644 --- a/test/runtime/samples/store-resubscribe/_config.js +++ b/test/runtime/samples/store-resubscribe/_config.js @@ -11,26 +11,35 @@ export default { await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    1

    - `); + ` + ); await buttons[1].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    0

    - `); + ` + ); await buttons[0].dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    1

    - `); + ` + ); } }; diff --git a/test/runtime/samples/store-shadow-scope/_config.js b/test/runtime/samples/store-shadow-scope/_config.js index a197325a2d..1d5873d07b 100644 --- a/test/runtime/samples/store-shadow-scope/_config.js +++ b/test/runtime/samples/store-shadow-scope/_config.js @@ -1,3 +1,4 @@ export default { - error: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)' + error: + 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)' }; diff --git a/test/runtime/samples/store-template-expression-scope/_config.js b/test/runtime/samples/store-template-expression-scope/_config.js index a197325a2d..1d5873d07b 100644 --- a/test/runtime/samples/store-template-expression-scope/_config.js +++ b/test/runtime/samples/store-template-expression-scope/_config.js @@ -1,3 +1,4 @@ export default { - error: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)' + error: + 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)' }; diff --git a/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js b/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js index a3676db286..9a7baa8a8e 100644 --- a/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js +++ b/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js @@ -9,14 +9,14 @@ export default { html: '', test({ assert, component, target }) { - const svg = target.querySelector( 'svg' ); - const rect = target.querySelector( 'rect' ); + const svg = target.querySelector('svg'); + const rect = target.querySelector('rect'); - assert.equal( svg.namespaceURI, 'http://www.w3.org/2000/svg' ); - assert.equal( rect.namespaceURI, 'http://www.w3.org/2000/svg' ); + assert.equal(svg.namespaceURI, 'http://www.w3.org/2000/svg'); + assert.equal(rect.namespaceURI, 'http://www.w3.org/2000/svg'); component.width = 150; component.height = 50; - assert.equal( target.innerHTML, '' ); + assert.equal(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/svg-child-component-declared-namespace/_config.js b/test/runtime/samples/svg-child-component-declared-namespace/_config.js index a3676db286..9a7baa8a8e 100644 --- a/test/runtime/samples/svg-child-component-declared-namespace/_config.js +++ b/test/runtime/samples/svg-child-component-declared-namespace/_config.js @@ -9,14 +9,14 @@ export default { html: '', test({ assert, component, target }) { - const svg = target.querySelector( 'svg' ); - const rect = target.querySelector( 'rect' ); + const svg = target.querySelector('svg'); + const rect = target.querySelector('rect'); - assert.equal( svg.namespaceURI, 'http://www.w3.org/2000/svg' ); - assert.equal( rect.namespaceURI, 'http://www.w3.org/2000/svg' ); + assert.equal(svg.namespaceURI, 'http://www.w3.org/2000/svg'); + assert.equal(rect.namespaceURI, 'http://www.w3.org/2000/svg'); component.width = 150; component.height = 50; - assert.equal( target.innerHTML, '' ); + assert.equal(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/svg-each-block-anchor/_config.js b/test/runtime/samples/svg-each-block-anchor/_config.js index a4e6f9e042..8fa695eea2 100644 --- a/test/runtime/samples/svg-each-block-anchor/_config.js +++ b/test/runtime/samples/svg-each-block-anchor/_config.js @@ -14,12 +14,15 @@ export default { test({ assert, component, target }) { component.foo = ['a', 'b']; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` a b c - `); + ` + ); } }; diff --git a/test/runtime/samples/svg-html-tag/_config.js b/test/runtime/samples/svg-html-tag/_config.js index f35bfc21d5..caabe034bf 100644 --- a/test/runtime/samples/svg-html-tag/_config.js +++ b/test/runtime/samples/svg-html-tag/_config.js @@ -6,7 +6,6 @@ export default { `, test({ assert, target, component }) { - let svg = target.querySelector('svg'); let circles = target.querySelectorAll('circle'); assert.equal(svg.namespaceURI, 'http://www.w3.org/2000/svg'); diff --git a/test/runtime/samples/svg-html-tag2/_config.js b/test/runtime/samples/svg-html-tag2/_config.js index 3c07cd7499..73f5e4e774 100644 --- a/test/runtime/samples/svg-html-tag2/_config.js +++ b/test/runtime/samples/svg-html-tag2/_config.js @@ -8,7 +8,6 @@ export default { `, test({ assert, target, component }) { - let svg = target.querySelector('svg'); let circles = target.querySelectorAll('circle'); assert.equal(svg.namespaceURI, 'http://www.w3.org/2000/svg'); diff --git a/test/runtime/samples/svg-html-tag3/_config.js b/test/runtime/samples/svg-html-tag3/_config.js index 1209d298fe..782ae7d85f 100644 --- a/test/runtime/samples/svg-html-tag3/_config.js +++ b/test/runtime/samples/svg-html-tag3/_config.js @@ -7,7 +7,6 @@ export default { `, test({ assert, target, component }) { - let svg = target.querySelector('svg'); let circle = target.querySelector('circle'); assert.equal(svg.namespaceURI, 'http://www.w3.org/2000/svg'); diff --git a/test/runtime/samples/svg-multiple/_config.js b/test/runtime/samples/svg-multiple/_config.js index 4f002d302c..ac3618b884 100644 --- a/test/runtime/samples/svg-multiple/_config.js +++ b/test/runtime/samples/svg-multiple/_config.js @@ -12,19 +12,22 @@ export default { `, test({ assert, component, target }) { - const svgs = target.querySelectorAll( 'svg' ); - const rects = target.querySelectorAll( 'rect' ); + const svgs = target.querySelectorAll('svg'); + const rects = target.querySelectorAll('rect'); - assert.equal( svgs[0].namespaceURI, 'http://www.w3.org/2000/svg' ); - assert.equal( svgs[0].namespaceURI, 'http://www.w3.org/2000/svg' ); - assert.equal( rects[1].namespaceURI, 'http://www.w3.org/2000/svg' ); - assert.equal( rects[1].namespaceURI, 'http://www.w3.org/2000/svg' ); + assert.equal(svgs[0].namespaceURI, 'http://www.w3.org/2000/svg'); + assert.equal(svgs[0].namespaceURI, 'http://www.w3.org/2000/svg'); + assert.equal(rects[1].namespaceURI, 'http://www.w3.org/2000/svg'); + assert.equal(rects[1].namespaceURI, 'http://www.w3.org/2000/svg'); component.width = 150; component.height = 50; - assert.htmlEqual( target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` - ` ); + ` + ); } }; diff --git a/test/runtime/samples/svg-no-whitespace/_config.js b/test/runtime/samples/svg-no-whitespace/_config.js index 2f7a917f16..6bd242d96a 100644 --- a/test/runtime/samples/svg-no-whitespace/_config.js +++ b/test/runtime/samples/svg-no-whitespace/_config.js @@ -1,9 +1,9 @@ export default { test({ assert, target }) { - const svg = target.querySelector( 'svg' ); + const svg = target.querySelector('svg'); - assert.equal( svg.childNodes.length, 2 ); - assert.equal( svg.childNodes[0].nodeName, 'rect' ); - assert.equal( svg.childNodes[1].nodeName, 'rect' ); + assert.equal(svg.childNodes.length, 2); + assert.equal(svg.childNodes[0].nodeName, 'rect'); + assert.equal(svg.childNodes[1].nodeName, 'rect'); } }; diff --git a/test/runtime/samples/svg-xlink/_config.js b/test/runtime/samples/svg-xlink/_config.js index d3018b3698..c4eb917500 100644 --- a/test/runtime/samples/svg-xlink/_config.js +++ b/test/runtime/samples/svg-xlink/_config.js @@ -10,7 +10,7 @@ export default { `, test({ assert, target }) { const use = target.querySelector('use'); - const href = use.attributes[ 'xlink:href' ]; + const href = use.attributes['xlink:href']; assert.equal(href.namespaceURI, 'http://www.w3.org/1999/xlink'); } diff --git a/test/runtime/samples/svg-xmlns/_config.js b/test/runtime/samples/svg-xmlns/_config.js index 5cec8da04a..c6c9978e25 100644 --- a/test/runtime/samples/svg-xmlns/_config.js +++ b/test/runtime/samples/svg-xmlns/_config.js @@ -11,14 +11,17 @@ export default { html: '', test({ assert, component, target }) { - const svg = target.querySelector( 'svg' ); - const rect = target.querySelector( 'rect' ); + const svg = target.querySelector('svg'); + const rect = target.querySelector('rect'); - assert.equal( svg.namespaceURI, 'http://www.w3.org/2000/svg' ); - assert.equal( rect.namespaceURI, 'http://www.w3.org/2000/svg' ); + assert.equal(svg.namespaceURI, 'http://www.w3.org/2000/svg'); + assert.equal(rect.namespaceURI, 'http://www.w3.org/2000/svg'); component.width = 150; component.height = 50; - assert.equal( target.innerHTML, '' ); + assert.equal( + target.innerHTML, + '' + ); } }; diff --git a/test/runtime/samples/svg/_config.js b/test/runtime/samples/svg/_config.js index a3676db286..9a7baa8a8e 100644 --- a/test/runtime/samples/svg/_config.js +++ b/test/runtime/samples/svg/_config.js @@ -9,14 +9,14 @@ export default { html: '', test({ assert, component, target }) { - const svg = target.querySelector( 'svg' ); - const rect = target.querySelector( 'rect' ); + const svg = target.querySelector('svg'); + const rect = target.querySelector('rect'); - assert.equal( svg.namespaceURI, 'http://www.w3.org/2000/svg' ); - assert.equal( rect.namespaceURI, 'http://www.w3.org/2000/svg' ); + assert.equal(svg.namespaceURI, 'http://www.w3.org/2000/svg'); + assert.equal(rect.namespaceURI, 'http://www.w3.org/2000/svg'); component.width = 150; component.height = 50; - assert.equal( target.innerHTML, '' ); + assert.equal(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/target-dom-detached/_config.js b/test/runtime/samples/target-dom-detached/_config.js index 055d1868eb..d8f18f14e0 100644 --- a/test/runtime/samples/target-dom-detached/_config.js +++ b/test/runtime/samples/target-dom-detached/_config.js @@ -8,9 +8,6 @@ export default { window.document.head.innerHTML, '' ); - assert.htmlEqual( - component.div.innerHTML, - '
    Hello World
    ' - ); + assert.htmlEqual(component.div.innerHTML, '
    Hello World
    '); } }; diff --git a/test/runtime/samples/target-dom/_config.js b/test/runtime/samples/target-dom/_config.js index 055d1868eb..d8f18f14e0 100644 --- a/test/runtime/samples/target-dom/_config.js +++ b/test/runtime/samples/target-dom/_config.js @@ -8,9 +8,6 @@ export default { window.document.head.innerHTML, '' ); - assert.htmlEqual( - component.div.innerHTML, - '
    Hello World
    ' - ); + assert.htmlEqual(component.div.innerHTML, '
    Hello World
    '); } }; diff --git a/test/runtime/samples/target-shadow-dom/_config.js b/test/runtime/samples/target-shadow-dom/_config.js index ff775d15fd..4b6ab30a48 100644 --- a/test/runtime/samples/target-shadow-dom/_config.js +++ b/test/runtime/samples/target-shadow-dom/_config.js @@ -5,9 +5,12 @@ export default { }, async test({ assert, component, window }) { assert.htmlEqual(window.document.head.innerHTML, ''); - assert.htmlEqual(component.div.shadowRoot.innerHTML, ` + assert.htmlEqual( + component.div.shadowRoot.innerHTML, + `
    Hello World
    - `); + ` + ); } }; diff --git a/test/runtime/samples/template/_config.js b/test/runtime/samples/template/_config.js index 2a65b78716..daf63da5ba 100644 --- a/test/runtime/samples/template/_config.js +++ b/test/runtime/samples/template/_config.js @@ -10,26 +10,30 @@ export default { `, test({ assert, target }) { - const template = target.querySelector('#t1'); - assert.htmlEqual(template.innerHTML, ` + assert.htmlEqual( + template.innerHTML, + `
    foo
    - `); + ` + ); const content = template.content.cloneNode(true); const div = content.children[0]; - assert.htmlEqual(div.outerHTML, ` + assert.htmlEqual( + div.outerHTML, + `
    foo
    - `); - + ` + ); const template2 = target.querySelector('#t2'); - assert.equal(template2.childNodes.length, 0); + assert.equal(template2.childNodes.length, 0); assert.equal(template2.content.childNodes.length, 1); assert.equal(template2.content.firstChild.textContent, '123'); assert.htmlEqual(template2.innerHTML, '123'); const template3 = target.querySelector('#t3'); - assert.equal(template3.childNodes.length, 0); + assert.equal(template3.childNodes.length, 0); assert.equal(template3.content.childNodes.length, 3); // test: (with hydration from ssr rendered html) // out of order render. @@ -38,6 +42,5 @@ export default { assert.equal(template3.content.childNodes[0].textContent, '1'); assert.equal(template3.content.childNodes[1].outerHTML, 'B'); assert.equal(template3.content.childNodes[2].textContent, '1'); - } }; diff --git a/test/runtime/samples/textarea-children/_config.js b/test/runtime/samples/textarea-children/_config.js index 5aeba13493..dcb9547427 100644 --- a/test/runtime/samples/textarea-children/_config.js +++ b/test/runtime/samples/textarea-children/_config.js @@ -8,10 +8,10 @@ export default { html: '', test({ assert, component, target }) { - const textarea = target.querySelector( 'textarea' ); - assert.strictEqual( textarea.value, '\t

    not actually an element. 42

    \n' ); + const textarea = target.querySelector('textarea'); + assert.strictEqual(textarea.value, '\t

    not actually an element. 42

    \n'); component.foo = 43; - assert.strictEqual( textarea.value, '\t

    not actually an element. 43

    \n' ); + assert.strictEqual(textarea.value, '\t

    not actually an element. 43

    \n'); } }; diff --git a/test/runtime/samples/textarea-content/_config.js b/test/runtime/samples/textarea-content/_config.js index 2698934099..7d4f8f9493 100644 --- a/test/runtime/samples/textarea-content/_config.js +++ b/test/runtime/samples/textarea-content/_config.js @@ -22,10 +22,18 @@ multiple leading newlines
    `, // Test for
    `, ` ); assert.equal(elementTextareaWithLeadingNewline.children[0].value, 'leading newline'); - assert.equal(elementTextareaWithLeadingNewline.children[1].value, ' leading newline and spaces'); + assert.equal( + elementTextareaWithLeadingNewline.children[1].value, + ' leading newline and spaces' + ); assert.equal(elementTextareaWithLeadingNewline.children[2].value, '\nleading newlines'); assert.equal(elementTextareaWithoutLeadingNewline.children[0].value, 'without spaces'); assert.equal(elementTextareaWithoutLeadingNewline.children[1].value, ' with spaces '); - assert.equal(elementTextareaWithoutLeadingNewline.children[2].value, ' \nnewline after leading space'); + assert.equal( + elementTextareaWithoutLeadingNewline.children[2].value, + ' \nnewline after leading space' + ); assert.equal(elementTextareaWithMultipleLeadingNewline.value, '\n\nmultiple leading newlines'); - assert.equal(elementDivWithTextareaWithMultipleLeadingNewline.children[0].value, '\n\nmultiple leading newlines'); + assert.equal( + elementDivWithTextareaWithMultipleLeadingNewline.children[0].value, + '\n\nmultiple leading newlines' + ); } }; diff --git a/test/runtime/samples/textarea-value/_config.js b/test/runtime/samples/textarea-value/_config.js index 93079e5928..cf32ebc69b 100644 --- a/test/runtime/samples/textarea-value/_config.js +++ b/test/runtime/samples/textarea-value/_config.js @@ -8,10 +8,10 @@ export default { html: '', test({ assert, component, target }) { - const textarea = target.querySelector( 'textarea' ); - assert.strictEqual( textarea.value, '42' ); + const textarea = target.querySelector('textarea'); + assert.strictEqual(textarea.value, '42'); component.foo = 43; - assert.strictEqual( textarea.value, '43' ); + assert.strictEqual(textarea.value, '43'); } }; diff --git a/test/runtime/samples/transition-abort/_config.js b/test/runtime/samples/transition-abort/_config.js index c0f702cb76..b0e9c1130e 100644 --- a/test/runtime/samples/transition-abort/_config.js +++ b/test/runtime/samples/transition-abort/_config.js @@ -18,7 +18,9 @@ export default { array: ['a', 'b', 'c'] }); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    a
    b
    c
    @@ -26,6 +28,7 @@ export default {
    a
    b
    c
    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-css-deferred-removal/_config.js b/test/runtime/samples/transition-css-deferred-removal/_config.js index 9bf429cd9e..0886d20c09 100644 --- a/test/runtime/samples/transition-css-deferred-removal/_config.js +++ b/test/runtime/samples/transition-css-deferred-removal/_config.js @@ -9,16 +9,10 @@ export default { const outer = target.querySelector('.outer'); const inner = target.querySelector('.inner'); - const animations = [ - outer.style.animation, - inner.style.animation - ]; + const animations = [outer.style.animation, inner.style.animation]; raf.tick(150); - assert.deepEqual([ - outer.style.animation, - inner.style.animation - ], animations); + assert.deepEqual([outer.style.animation, inner.style.animation], animations); } }; diff --git a/test/runtime/samples/transition-css-in-out-in-with-param/_config.js b/test/runtime/samples/transition-css-in-out-in-with-param/_config.js index 7d0dfa9a07..a49ea17bac 100644 --- a/test/runtime/samples/transition-css-in-out-in-with-param/_config.js +++ b/test/runtime/samples/transition-css-in-out-in-with-param/_config.js @@ -8,7 +8,10 @@ export default { // animation duration of `out` should be 5ms. component.visible = false; - assert.equal(div.style.animation, '__svelte_1670736059_0 10ms linear 0ms 1 both, __svelte_1998461463_0 5ms linear 0ms 1 both'); + assert.equal( + div.style.animation, + '__svelte_1670736059_0 10ms linear 0ms 1 both, __svelte_1998461463_0 5ms linear 0ms 1 both' + ); // change param raf.tick(1); diff --git a/test/runtime/samples/transition-css-in-out-in/_config.js b/test/runtime/samples/transition-css-in-out-in/_config.js index 5debe6abd6..a359aa36d2 100644 --- a/test/runtime/samples/transition-css-in-out-in/_config.js +++ b/test/runtime/samples/transition-css-in-out-in/_config.js @@ -9,7 +9,10 @@ export default { component.visible = false; // both in and out styles - assert.equal(div.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both, __svelte_3750847757_0 100ms linear 0ms 1 both'); + assert.equal( + div.style.animation, + '__svelte_3809512021_0 100ms linear 0ms 1 both, __svelte_3750847757_0 100ms linear 0ms 1 both' + ); raf.tick(75); component.visible = true; diff --git a/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js b/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js index 75843d624e..e6f833b396 100644 --- a/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js +++ b/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js @@ -1,10 +1,6 @@ export default { props: { - things: [ - 'one', - 'two', - 'three' - ] + things: ['one', 'two', 'three'] }, test({ assert, component, target, raf }) { @@ -26,11 +22,14 @@ export default { component.things = things; raf.tick(225); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` one two three - `); + ` + ); assert.equal(spans[0].foo, 1); assert.equal(spans[1].foo, 1); diff --git a/test/runtime/samples/transition-js-aborted-outro/_config.js b/test/runtime/samples/transition-js-aborted-outro/_config.js index 7ecc212739..dd14fe8b53 100644 --- a/test/runtime/samples/transition-js-aborted-outro/_config.js +++ b/test/runtime/samples/transition-js-aborted-outro/_config.js @@ -17,8 +17,11 @@ export default { assert.equal(span.foo, 1); raf.tick(100); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + ` hello - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-await-block-outros/_config.js b/test/runtime/samples/transition-js-await-block-outros/_config.js index 7233e3f67f..aa40d6c59f 100644 --- a/test/runtime/samples/transition-js-await-block-outros/_config.js +++ b/test/runtime/samples/transition-js-await-block-outros/_config.js @@ -13,28 +13,37 @@ export default { let time = 0; - raf.tick(time += 50); + raf.tick((time += 50)); assert.htmlEqual(target.innerHTML, '

    loading...

    '); await fulfil(42); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    42

    loading...

    - `); + ` + ); // see the transition 30% complete - raf.tick(time += 30); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 30)); + assert.htmlEqual( + target.innerHTML, + `

    42

    loading...

    - `); + ` + ); // completely transition in the {:then} block - raf.tick(time += 70); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 70)); + assert.htmlEqual( + target.innerHTML, + `

    42

    - `); + ` + ); // update promise #1 component.promise = new Promise((f) => { @@ -42,27 +51,39 @@ export default { }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    42

    loading...

    - `); + ` + ); - raf.tick(time += 100); + raf.tick((time += 100)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    loading...

    - `); + ` + ); await fulfil(43); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    loading...

    43

    - `); + ` + ); - raf.tick(time += 100); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 100)); + assert.htmlEqual( + target.innerHTML, + `

    43

    - `); + ` + ); // update promise #2 component.promise = new Promise((f) => { @@ -70,105 +91,147 @@ export default { }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    43

    loading...

    - `); + ` + ); - raf.tick(time += 50); + raf.tick((time += 50)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    43

    loading...

    - `); + ` + ); await fulfil(44); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    43

    loading...

    44

    - `); + ` + ); - raf.tick(time += 100); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 100)); + assert.htmlEqual( + target.innerHTML, + `

    44

    - `); + ` + ); // update promise #3 - quick succession component.promise = new Promise((f) => { fulfil = f; }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    44

    loading...

    - `); + ` + ); - raf.tick(time += 40); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 40)); + assert.htmlEqual( + target.innerHTML, + `

    44

    loading...

    - `); + ` + ); await fulfil(45); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    44

    loading...

    45

    - `); + ` + ); - raf.tick(time += 20); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 20)); + assert.htmlEqual( + target.innerHTML, + `

    44

    loading...

    45

    - `); + ` + ); component.promise = new Promise((f) => { fulfil = f; }); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    44

    loading...

    45

    loading...

    - `); + ` + ); - raf.tick(time += 10); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 10)); + assert.htmlEqual( + target.innerHTML, + `

    44

    loading...

    45

    loading...

    - `); + ` + ); await fulfil(46); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    44

    loading...

    45

    loading...

    46

    - `); + ` + ); - raf.tick(time += 10); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 10)); + assert.htmlEqual( + target.innerHTML, + `

    44

    46

    - `); + ` + ); - raf.tick(time += 20); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 20)); + assert.htmlEqual( + target.innerHTML, + `

    46

    - `); + ` + ); - raf.tick(time += 70); - assert.htmlEqual(target.innerHTML, ` + raf.tick((time += 70)); + assert.htmlEqual( + target.innerHTML, + `

    46

    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-dynamic-component/_config.js b/test/runtime/samples/transition-js-dynamic-component/_config.js index b59bd41af8..87bc8e9204 100644 --- a/test/runtime/samples/transition-js-dynamic-component/_config.js +++ b/test/runtime/samples/transition-js-dynamic-component/_config.js @@ -10,10 +10,13 @@ export default { test({ assert, component, target, raf }) { component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    a
    b
    - `); + ` + ); const [a, b] = target.querySelectorAll('div'); @@ -27,8 +30,11 @@ export default { assert.equal(a.a, 0); assert.equal(b.b, 1); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    b
    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-each-block-intro-outro/_config.js b/test/runtime/samples/transition-js-each-block-intro-outro/_config.js index 9a0326fbb0..41d1b3ea90 100644 --- a/test/runtime/samples/transition-js-each-block-intro-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-intro-outro/_config.js @@ -1,7 +1,7 @@ export default { props: { visible: false, - things: [ 'a', 'b', 'c' ] + things: ['a', 'b', 'c'] }, test({ assert, component, target, raf }) { diff --git a/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js index 5d1ae5d3e9..eb59d0742b 100644 --- a/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js @@ -1,10 +1,6 @@ export default { props: { - things: [ - { name: 'a' }, - { name: 'b' }, - { name: 'c' } - ] + things: [{ name: 'a' }, { name: 'b' }, { name: 'c' }] }, intro: true, @@ -24,10 +20,7 @@ export default { assert.equal(divs[1].foo, 1); assert.equal(divs[2].foo, 1); - component.things = [ - { name: 'a' }, - { name: 'c' } - ]; + component.things = [{ name: 'a' }, { name: 'c' }]; const divs2 = target.querySelectorAll('div'); assert.strictEqual(divs[0], divs2[0]); @@ -39,11 +32,7 @@ export default { assert.equal(divs[1].foo, 0.5); assert.equal(divs[2].foo, 1); - component.things = [ - { name: 'a' }, - { name: 'b' }, - { name: 'c' } - ]; + component.things = [{ name: 'a' }, { name: 'b' }, { name: 'c' }]; raf.tick(175); assert.equal(divs[0].foo, 1); diff --git a/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js index f6b1416789..b5823f29fc 100644 --- a/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js +++ b/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js @@ -1,10 +1,6 @@ export default { props: { - things: [ - { name: 'a' }, - { name: 'b' }, - { name: 'c' } - ] + things: [{ name: 'a' }, { name: 'b' }, { name: 'c' }] }, intro: true, @@ -20,18 +16,16 @@ export default { assert.equal(divs[1].foo, 0.5); assert.equal(divs[2].foo, 0.5); - component.things = [ - { name: 'a' }, - { name: 'woo!' }, - { name: 'b' }, - { name: 'c' } - ]; - assert.htmlEqual(target.innerHTML, ` + component.things = [{ name: 'a' }, { name: 'woo!' }, { name: 'b' }, { name: 'c' }]; + assert.htmlEqual( + target.innerHTML, + `
    a
    woo!
    b
    c
    - `); + ` + ); divs = target.querySelectorAll('div'); assert.equal(divs[0].foo, 0.5); assert.equal(divs[1].foo, 0); diff --git a/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js index f3677ef89a..65f6d18d8d 100644 --- a/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js @@ -1,28 +1,21 @@ export default { props: { - things: [ - { name: 'a' }, - { name: 'b' }, - { name: 'c' } - ] + things: [{ name: 'a' }, { name: 'b' }, { name: 'c' }] }, test({ assert, component, target, raf }) { - const divs = target.querySelectorAll( 'div' ); + const divs = target.querySelectorAll('div'); - component.things = [ - { name: 'a' }, - { name: 'c' } - ]; + component.things = [{ name: 'a' }, { name: 'c' }]; - const divs2 = target.querySelectorAll( 'div' ); - assert.strictEqual( divs[0], divs2[0] ); - assert.strictEqual( divs[1], divs2[1] ); - assert.strictEqual( divs[2], divs2[2] ); + const divs2 = target.querySelectorAll('div'); + assert.strictEqual(divs[0], divs2[0]); + assert.strictEqual(divs[1], divs2[1]); + assert.strictEqual(divs[2], divs2[2]); - raf.tick( 50 ); - assert.equal( divs[0].foo, undefined ); - assert.equal( divs[1].foo, 0.5 ); - assert.equal( divs[2].foo, undefined ); + raf.tick(50); + assert.equal(divs[0].foo, undefined); + assert.equal(divs[1].foo, 0.5); + assert.equal(divs[2].foo, undefined); } }; diff --git a/test/runtime/samples/transition-js-each-block-outro/_config.js b/test/runtime/samples/transition-js-each-block-outro/_config.js index b36a3d93eb..b544b7b466 100644 --- a/test/runtime/samples/transition-js-each-block-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-outro/_config.js @@ -1,19 +1,19 @@ export default { props: { - things: [ 'a', 'b', 'c' ] + things: ['a', 'b', 'c'] }, test({ assert, component, target, raf }) { - const divs = target.querySelectorAll( 'div' ); + const divs = target.querySelectorAll('div'); - component.things = [ 'a' ]; + component.things = ['a']; - raf.tick( 50 ); - assert.equal( divs[0].foo, undefined ); - assert.equal( divs[1].foo, 0.5 ); - assert.equal( divs[2].foo, 0.5 ); + raf.tick(50); + assert.equal(divs[0].foo, undefined); + assert.equal(divs[1].foo, 0.5); + assert.equal(divs[2].foo, 0.5); - raf.tick( 100 ); + raf.tick(100); assert.htmlEqual(target.innerHTML, '
    a
    '); } }; diff --git a/test/runtime/samples/transition-js-each-outro-cancelled/_config.js b/test/runtime/samples/transition-js-each-outro-cancelled/_config.js index 9f9bd35f05..2030832d3e 100644 --- a/test/runtime/samples/transition-js-each-outro-cancelled/_config.js +++ b/test/runtime/samples/transition-js-each-outro-cancelled/_config.js @@ -6,52 +6,67 @@ export default { let time = 0; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    Thing 1
    Thing 2
    - `); + ` + ); - raf.tick(time += 400); + raf.tick((time += 400)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    Thing 1
    Thing 2
    - `); + ` + ); await component.toggle(); // transition halfway - raf.tick(time += 200); + raf.tick((time += 200)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    Thing 1
    Thing 2
    - `); + ` + ); await component.toggle(); // transition back - raf.tick(time += 200); + raf.tick((time += 200)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    Thing 1
    Thing 2
    - `); + ` + ); await component.remove(1); - raf.tick(time += 400); + raf.tick((time += 400)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    Thing 2
    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-events-in-out/_config.js b/test/runtime/samples/transition-js-events-in-out/_config.js index 588a4edbd7..8d04459454 100644 --- a/test/runtime/samples/transition-js-events-in-out/_config.js +++ b/test/runtime/samples/transition-js-events-in-out/_config.js @@ -13,13 +13,16 @@ export default { async test({ assert, component, target, raf }) { component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    introstart

    a

    b

    c

    d

    - `); + ` + ); await raf.tick(50); @@ -29,23 +32,29 @@ export default { await raf.tick(100); assert.equal(component.intro_count, 0); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    introend

    a

    b

    c

    d

    - `); + ` + ); component.visible = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    outrostart

    a

    b

    c

    d

    - `); + ` + ); await raf.tick(150); assert.deepEqual(component.outros.sort(), ['a', 'b', 'c', 'd']); @@ -60,12 +69,15 @@ export default { assert.deepEqual(component.intros.sort(), ['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd']); assert.equal(component.intro_count, 4); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    introstart

    a

    b

    c

    d

    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-events/_config.js b/test/runtime/samples/transition-js-events/_config.js index 54b068dace..9880274e74 100644 --- a/test/runtime/samples/transition-js-events/_config.js +++ b/test/runtime/samples/transition-js-events/_config.js @@ -13,13 +13,16 @@ export default { async test({ assert, component, target, raf }) { component.visible = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    introstart

    a

    b

    c

    d

    - `); + ` + ); raf.tick(50); assert.deepEqual(component.intros.sort(), ['a', 'b', 'c', 'd']); @@ -28,23 +31,29 @@ export default { await raf.tick(100); assert.equal(component.intro_count, 0); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    introend

    a

    b

    c

    d

    - `); + ` + ); component.visible = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    outrostart

    a

    b

    c

    d

    - `); + ` + ); raf.tick(150); assert.deepEqual(component.outros.sort(), ['a', 'b', 'c', 'd']); @@ -59,12 +68,15 @@ export default { assert.deepEqual(component.intros.sort(), ['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd']); assert.equal(component.intro_count, 4); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    introstart

    a

    b

    c

    d

    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js index ed88103f2c..fd11566d9d 100644 --- a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js @@ -18,11 +18,14 @@ export default { component.threshold = 4; raf.tick(200); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    1
    2
    3
    4
    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js index 09511fe976..9048b8b827 100644 --- a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js @@ -22,12 +22,15 @@ export default { component.threshold = 5.5; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    1
    2
    3
    4
    5
    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js index b02ccffc81..0d677db990 100644 --- a/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js @@ -25,21 +25,27 @@ export default { assert.equal(divs[4].foo, 1); raf.tick(200); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    1
    2
    3
    4
    - `); + ` + ); component.threshold = 3; assert.equal(divs[3].foo, 1); raf.tick(300); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    1
    2
    3
    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-if-else-block-not-dynamic-outro/_config.js b/test/runtime/samples/transition-js-if-else-block-not-dynamic-outro/_config.js index 9bd793c3ad..6735d9f06f 100644 --- a/test/runtime/samples/transition-js-if-else-block-not-dynamic-outro/_config.js +++ b/test/runtime/samples/transition-js-if-else-block-not-dynamic-outro/_config.js @@ -5,34 +5,46 @@ export default { await (component.condition = false); let time = 0; - raf.tick(time += 25); + raf.tick((time += 25)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    TRUE
    FALSE
    - `); + ` + ); // toggling back in the middle of the out transition // will reuse the previous element await (component.condition = true); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    FALSE
    TRUE
    - `); + ` + ); assert.equal(target.querySelector('#t'), t); - raf.tick(time += 25); + raf.tick((time += 25)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    FALSE
    TRUE
    - `); + ` + ); - raf.tick(time += 75); + raf.tick((time += 75)); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    TRUE
    - `); + ` + ); } }; diff --git a/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js b/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js index 3f1b714a7c..ebacdf4495 100644 --- a/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js +++ b/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js @@ -1,9 +1,9 @@ -export default { - async test({ assert, target, window, raf }) { - const button = target.querySelector('button'); - const event = new window.MouseEvent('click'); - await button.dispatchEvent(event); - raf.tick(500); - assert.htmlEqual(target.innerHTML, ''); - } -}; +export default { + async test({ assert, target, window, raf }) { + const button = target.querySelector('button'); + const event = new window.MouseEvent('click'); + await button.dispatchEvent(event); + raf.tick(500); + assert.htmlEqual(target.innerHTML, ''); + } +}; diff --git a/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js b/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js index beea5d4a77..7bbc99a7cf 100644 --- a/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js +++ b/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js @@ -1,7 +1,7 @@ -export default { - async test({ assert, target, component, raf }) { - await component.condition.set(false); - raf.tick(500); - assert.htmlEqual(target.innerHTML, ''); - } -}; +export default { + async test({ assert, target, component, raf }) { + await component.condition.set(false); + raf.tick(500); + assert.htmlEqual(target.innerHTML, ''); + } +}; diff --git a/test/runtime/samples/transition-js-local-and-global/_config.js b/test/runtime/samples/transition-js-local-and-global/_config.js index 09aefb6913..03bd60ea7e 100644 --- a/test/runtime/samples/transition-js-local-and-global/_config.js +++ b/test/runtime/samples/transition-js-local-and-global/_config.js @@ -20,10 +20,13 @@ export default { raf.tick(100); component.x = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    snaps if x changes
    transitions if x changes
    - `); + ` + ); raf.tick(150); assert.equal(divs[0].foo, undefined); @@ -37,10 +40,13 @@ export default { component.x = true; component.y = true; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    snaps if x changes
    transitions if x changes
    - `); + ` + ); divs = target.querySelectorAll('div'); raf.tick(250); @@ -52,10 +58,13 @@ export default { assert.equal(divs[1].foo, 1); component.y = false; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    snaps if x changes
    transitions if x changes
    - `); + ` + ); raf.tick(320); assert.equal(divs[0].foo, 0.8); diff --git a/test/runtime/samples/transition-js-local-nested-await/_config.js b/test/runtime/samples/transition-js-local-nested-await/_config.js index b07d88741f..8066e28d1b 100644 --- a/test/runtime/samples/transition-js-local-nested-await/_config.js +++ b/test/runtime/samples/transition-js-local-nested-await/_config.js @@ -1,6 +1,6 @@ let fulfil; -const promise = new Promise(f => { +const promise = new Promise((f) => { fulfil = f; }); diff --git a/test/runtime/samples/transition-js-nested-await/_config.js b/test/runtime/samples/transition-js-nested-await/_config.js index e0f26580cc..2d8e2a8b8b 100644 --- a/test/runtime/samples/transition-js-nested-await/_config.js +++ b/test/runtime/samples/transition-js-nested-await/_config.js @@ -1,6 +1,6 @@ let fulfil; -const promise = new Promise(f => { +const promise = new Promise((f) => { fulfil = f; }); diff --git a/test/runtime/samples/transition-js-nested-each-delete/_config.js b/test/runtime/samples/transition-js-nested-each-delete/_config.js index 041cbebc66..5916f2bc3c 100644 --- a/test/runtime/samples/transition-js-nested-each-delete/_config.js +++ b/test/runtime/samples/transition-js-nested-each-delete/_config.js @@ -5,18 +5,24 @@ export default { }, test({ assert, component, target, raf }) { - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    a
    b
    c
    - `); + ` + ); component.things = ['a']; raf.tick(100); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    a
    - `); + ` + ); component.visible = false; diff --git a/test/runtime/samples/transition-js-slot-4-cancelled/_config.js b/test/runtime/samples/transition-js-slot-4-cancelled/_config.js index 8be95f0150..cfc395466a 100644 --- a/test/runtime/samples/transition-js-slot-4-cancelled/_config.js +++ b/test/runtime/samples/transition-js-slot-4-cancelled/_config.js @@ -17,17 +17,23 @@ export default { assert.equal(div.foo, 0.5); component.props = 'Bar'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Foo Foo Foo
    - `); + ` + ); await component.show(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Bar Bar Bar
    - `); + ` + ); raf.tick(100); assert.equal(div.foo, 1); diff --git a/test/runtime/samples/transition-js-slot-5-cancelled-overflow/_config.js b/test/runtime/samples/transition-js-slot-5-cancelled-overflow/_config.js index 556f75eccd..a1169b718b 100644 --- a/test/runtime/samples/transition-js-slot-5-cancelled-overflow/_config.js +++ b/test/runtime/samples/transition-js-slot-5-cancelled-overflow/_config.js @@ -20,19 +20,25 @@ export default { assert.equal(div.foo, 0.5); component.props = 'Bar'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Foo Foo Foo
    0 - `); + ` + ); await component.show(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Bar Bar Bar
    0 - `); + ` + ); raf.tick(100); assert.equal(div.foo, 1); diff --git a/test/runtime/samples/transition-js-slot-6-spread-cancelled/_config.js b/test/runtime/samples/transition-js-slot-6-spread-cancelled/_config.js index 960e02a8f6..6b9c378fd5 100644 --- a/test/runtime/samples/transition-js-slot-6-spread-cancelled/_config.js +++ b/test/runtime/samples/transition-js-slot-6-spread-cancelled/_config.js @@ -20,19 +20,25 @@ export default { assert.equal(div.foo, 0.5); component.props = 'Bar'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Foo Foo Foo
    inside Foo Foo XXX
    - `); + ` + ); await component.show(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Bar Bar Bar
    inside Bar Bar XXX
    - `); + ` + ); raf.tick(100); assert.equal(div.foo, 1); diff --git a/test/runtime/samples/transition-js-slot-7-spread-cancelled-overflow/_config.js b/test/runtime/samples/transition-js-slot-7-spread-cancelled-overflow/_config.js index 556f75eccd..a1169b718b 100644 --- a/test/runtime/samples/transition-js-slot-7-spread-cancelled-overflow/_config.js +++ b/test/runtime/samples/transition-js-slot-7-spread-cancelled-overflow/_config.js @@ -20,19 +20,25 @@ export default { assert.equal(div.foo, 0.5); component.props = 'Bar'; - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Foo Foo Foo
    0 - `); + ` + ); await component.show(); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    outside Bar Bar Bar
    inside Bar Bar Bar
    0 - `); + ` + ); raf.tick(100); assert.equal(div.foo, 1); diff --git a/test/runtime/samples/whitespace-each-block/_config.js b/test/runtime/samples/whitespace-each-block/_config.js index 9f3f5735ed..26d5ee9bee 100644 --- a/test/runtime/samples/whitespace-each-block/_config.js +++ b/test/runtime/samples/whitespace-each-block/_config.js @@ -4,9 +4,6 @@ export default { }, test({ assert, target }) { - assert.equal( - target.textContent, - 'a b c ' - ); + assert.equal(target.textContent, 'a b c '); } }; diff --git a/test/runtime/samples/whitespace-normal/_config.js b/test/runtime/samples/whitespace-normal/_config.js index 90ca0b42c0..7546be0a89 100644 --- a/test/runtime/samples/whitespace-normal/_config.js +++ b/test/runtime/samples/whitespace-normal/_config.js @@ -4,9 +4,6 @@ export default { }, test({ assert, target }) { - assert.equal( - target.textContent, - 'Hello world! How are you?' - ); + assert.equal(target.textContent, 'Hello world! How are you?'); } }; diff --git a/test/runtime/samples/window-bind-scroll-update/_config.js b/test/runtime/samples/window-bind-scroll-update/_config.js index 60bdb4b7f6..e20b435248 100644 --- a/test/runtime/samples/window-bind-scroll-update/_config.js +++ b/test/runtime/samples/window-bind-scroll-update/_config.js @@ -3,7 +3,7 @@ import { env, useFakeTimers } from '../../../helpers'; let clock; export default { - before_test() { + before_test() { clock = useFakeTimers(); const window = env(); diff --git a/test/runtime/samples/window-binding-resize/_config.js b/test/runtime/samples/window-binding-resize/_config.js index d7f0282147..1b56ed2a67 100644 --- a/test/runtime/samples/window-binding-resize/_config.js +++ b/test/runtime/samples/window-binding-resize/_config.js @@ -40,8 +40,11 @@ export default { await window.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    567x456
    2
    - `); + ` + ); } }; diff --git a/test/runtime/samples/window-event-custom/_config.js b/test/runtime/samples/window-event-custom/_config.js index 2e3b577b86..bce4c20548 100644 --- a/test/runtime/samples/window-event-custom/_config.js +++ b/test/runtime/samples/window-event-custom/_config.js @@ -8,8 +8,11 @@ export default { await window.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `

    escaped: true

    - `); + ` + ); } }; diff --git a/test/runtime/samples/window-event/_config.js b/test/runtime/samples/window-event/_config.js index 9abde274e9..028be05f14 100644 --- a/test/runtime/samples/window-event/_config.js +++ b/test/runtime/samples/window-event/_config.js @@ -19,8 +19,11 @@ export default { await window.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ` + assert.htmlEqual( + target.innerHTML, + `
    567x456
    - `); + ` + ); } }; diff --git a/test/server-side-rendering/index.js b/test/server-side-rendering/index.js index 84decea88c..6bc8660e59 100644 --- a/test/server-side-rendering/index.js +++ b/test/server-side-rendering/index.js @@ -35,10 +35,10 @@ describe('ssr', () => { }); let saved_window; - before(() => saved_window = global.window); - after(() => global.window = saved_window); + before(() => (saved_window = global.window)); + after(() => (global.window = saved_window)); - fs.readdirSync(`${__dirname}/samples`).forEach(dir => { + fs.readdirSync(`${__dirname}/samples`).forEach((dir) => { if (dir[0] === '.') return; const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); @@ -53,9 +53,7 @@ describe('ssr', () => { } (solo ? it.only : it)(dir, (done) => { - try { - dir = path.resolve(`${__dirname}/samples`, dir); cleanRequireCache(); @@ -83,7 +81,10 @@ describe('ssr', () => { if (css.code) fs.writeFileSync(`${dir}/_actual.css`, css.code); try { - assert.htmlEqualWithOptions(html, expectedHtml, { preserveComments: compileOptions.preserveComments, withoutNormalizeHtml: config.withoutNormalizeHtml }); + assert.htmlEqualWithOptions(html, expectedHtml, { + preserveComments: compileOptions.preserveComments, + withoutNormalizeHtml: config.withoutNormalizeHtml + }); } catch (error) { if (shouldUpdateExpected()) { fs.writeFileSync(`${dir}/_expected.html`, html); @@ -143,7 +144,7 @@ describe('ssr', () => { runRuntimeSamples('runtime-puppeteer'); function runRuntimeSamples(suite) { - fs.readdirSync(`test/${suite}/samples`).forEach(dir => { + fs.readdirSync(`test/${suite}/samples`).forEach((dir) => { if (dir[0] === '.') return; const config = loadConfig(`./${suite}/samples/${dir}/_config.js`); @@ -171,7 +172,7 @@ describe('ssr', () => { require('../../register')(compileOptions); - glob('**/*.svelte', { cwd }).forEach(file => { + glob('**/*.svelte', { cwd }).forEach((file) => { if (file[0] === '_') return; const dir = `${cwd}/_output/ssr`; @@ -184,13 +185,10 @@ describe('ssr', () => { mkdirp(dir); try { - const { js } = compile( - fs.readFileSync(`${cwd}/${file}`, 'utf-8'), - { - ...compileOptions, - filename: file - } - ); + const { js } = compile(fs.readFileSync(`${cwd}/${file}`, 'utf-8'), { + ...compileOptions, + filename: file + }); fs.writeFileSync(out, js.code); } catch (err) { @@ -203,7 +201,7 @@ describe('ssr', () => { const Component = require(`../${suite}/samples/${dir}/main.svelte`).default; const { html } = Component.render(config.props, { - store: (config.store !== true) && config.store + store: config.store !== true && config.store }); if (config.ssrHtml) { diff --git a/test/server-side-rendering/samples/each-block/data.json b/test/server-side-rendering/samples/each-block/data.json index febcba093c..610bca74d3 100644 --- a/test/server-side-rendering/samples/each-block/data.json +++ b/test/server-side-rendering/samples/each-block/data.json @@ -1,7 +1,3 @@ { - "animals": [ - "alligator", - "beetle", - "cuckoo" - ] + "animals": ["alligator", "beetle", "cuckoo"] } diff --git a/test/server-side-rendering/samples/head-multiple-title/data.json b/test/server-side-rendering/samples/head-multiple-title/data.json index eab238e816..22cf62dd2e 100644 --- a/test/server-side-rendering/samples/head-multiple-title/data.json +++ b/test/server-side-rendering/samples/head-multiple-title/data.json @@ -1,3 +1,3 @@ { "adjective": "custom" -} \ No newline at end of file +} diff --git a/test/server-side-rendering/samples/head-title/data.json b/test/server-side-rendering/samples/head-title/data.json index eab238e816..22cf62dd2e 100644 --- a/test/server-side-rendering/samples/head-title/data.json +++ b/test/server-side-rendering/samples/head-title/data.json @@ -1,3 +1,3 @@ { "adjective": "custom" -} \ No newline at end of file +} diff --git a/test/setup.js b/test/setup.js index 9a2ecb9b3f..b36153c159 100644 --- a/test/setup.js +++ b/test/setup.js @@ -7,27 +7,37 @@ process.env.TEST = 'true'; require.extensions['.js'] = function (module, filename) { const exports = []; - let code = fs.readFileSync(filename, 'utf-8') + let code = fs + .readFileSync(filename, 'utf-8') .replace(/^import \* as (\S+) from ['"]([^'"]+)['"];?/gm, 'var $1 = require("$2");') .replace(/^import {([^}]+)} from ['"](.+)['"];?/gm, 'var {$1} = require("$2");') - .replace(/^import (\S+),\s+?{([^}]+)} from ['"](.+)['"];?/gm, 'var {default: $1, $2} = require("$3");') + .replace( + /^import (\S+),\s+?{([^}]+)} from ['"](.+)['"];?/gm, + 'var {default: $1, $2} = require("$3");' + ) .replace(/^import (\S+) from ['"]([./][^'"]+)['"];?/gm, 'var {default: $1} = require("$2");') .replace(/^import (\S+) from ['"]([^'"]+)['"];?/gm, 'var $1 = require("$2");') .replace(/^export default /gm, 'exports.default = ') - .replace(/^export (const|let|var|class|function|async\s+function) (\w+)/gm, (match, type, name) => { - exports.push(name); - return `${type} ${name}`; - }) - .replace(/^export \{([^}]+)\}(?: from ['"]([^'"]+)['"];?)?/gm, (match, names, source) => { - names.split(',').filter(Boolean).forEach(name => { + .replace( + /^export (const|let|var|class|function|async\s+function) (\w+)/gm, + (match, type, name) => { exports.push(name); - }); + return `${type} ${name}`; + } + ) + .replace(/^export \{([^}]+)\}(?: from ['"]([^'"]+)['"];?)?/gm, (match, names, source) => { + names + .split(',') + .filter(Boolean) + .forEach((name) => { + exports.push(name); + }); return source ? `const { ${names} } = require("${source}");` : ''; }) .replace(/^export function (\w+)/gm, 'exports.$1 = function $1'); - exports.forEach(name => { + exports.forEach((name) => { code += `\nexports.${name} = ${name};`; }); diff --git a/test/sourcemaps/helpers.js b/test/sourcemaps/helpers.js index 689c3fbf1b..db9d34fc8b 100644 --- a/test/sourcemaps/helpers.js +++ b/test/sourcemaps/helpers.js @@ -9,19 +9,13 @@ import MagicString, { Bundle } from 'magic-string'; /** * @param {AssertMappedParameters} param */ -export function assert_mapped( - { code, filename, input, input_code, preprocessed } -) { +export function assert_mapped({ code, filename, input, input_code, preprocessed }) { const locate_input = typeof input === 'function' ? input : getLocator(input); if (filename === undefined) filename = 'input.svelte'; if (input_code === undefined) input_code = code; const source_loc = locate_input(input_code); - assert.notEqual( - source_loc, - undefined, - `failed to locate "${input_code}" in "${filename}"` - ); + assert.notEqual(source_loc, undefined, `failed to locate "${input_code}" in "${filename}"`); const transformed_loc = preprocessed.locate_1(code); assert.notEqual( @@ -49,9 +43,7 @@ export function assert_mapped( /** * @param {AssertNotMappedParameters} param */ -export function assert_not_mapped( - { code, filename, preprocessed } -) { +export function assert_not_mapped({ code, filename, preprocessed }) { if (filename === undefined) filename = 'input.svelte'; const transformed_loc = preprocessed.locate_1(code); @@ -78,11 +70,7 @@ export function assert_not_mapped( * @param {ReturnType} locate * @param {string} filename */ -export function assert_not_located( - code, - locate, - filename = 'input.svelte' -) { +export function assert_not_located(code, locate, filename = 'input.svelte') { assert.equal( locate(code), undefined, @@ -96,11 +84,7 @@ export function assert_not_located( * @param {string} separator * @returns */ -export function magic_string_bundle( - inputs, - filename = 'bundle.js', - separator = '\n' -) { +export function magic_string_bundle(inputs, filename = 'bundle.js', separator = '\n') { const bundle = new Bundle({ separator }); inputs.forEach(({ code, filename }) => { bundle.addSource({ diff --git a/test/sourcemaps/index.js b/test/sourcemaps/index.js index fc021cd6a7..5a4235366d 100644 --- a/test/sourcemaps/index.js +++ b/test/sourcemaps/index.js @@ -7,9 +7,8 @@ import { loadConfig, svelte } from '../helpers'; import { getLocator } from 'locate-character'; import { SourceMapConsumer } from 'source-map'; - describe('sourcemaps', () => { - fs.readdirSync(`${__dirname}/samples`).forEach(dir => { + fs.readdirSync(`${__dirname}/samples`).forEach((dir) => { if (dir[0] === '.') return; const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); @@ -43,8 +42,7 @@ describe('sourcemaps', () => { } ); - const { js, css } = svelte.compile( - preprocessed.code, { + const { js, css } = svelte.compile(preprocessed.code, { filename: 'input.svelte', // filenames for sourcemaps sourcemap: preprocessed.map, @@ -53,9 +51,8 @@ describe('sourcemaps', () => { ...(config.compile_options || {}) }); - js.code = js.code.replace( - /generated by Svelte v\d+\.\d+\.\d+/, - match => match.replace(/\d/g, 'x') + js.code = js.code.replace(/generated by Svelte v\d+\.\d+\.\d+/, (match) => + match.replace(/\d/g, 'x') ); fs.writeFileSync(`${outputBase}.svelte`, preprocessed.code); @@ -66,23 +63,14 @@ describe('sourcemaps', () => { JSON.stringify(preprocessed.map, null, 2) ); } - fs.writeFileSync( - `${outputBase}.js`, - `${js.code}\n//# sourceMappingURL=${outputName}.js.map` - ); - fs.writeFileSync( - `${outputBase}.js.map`, - JSON.stringify(js.map, null, 2) - ); + fs.writeFileSync(`${outputBase}.js`, `${js.code}\n//# sourceMappingURL=${outputName}.js.map`); + fs.writeFileSync(`${outputBase}.js.map`, JSON.stringify(js.map, null, 2)); if (css.code) { fs.writeFileSync( `${outputBase}.css`, `${css.code}\n/*# sourceMappingURL=${outputName}.css.map */` ); - fs.writeFileSync( - `${outputBase}.css.map`, - JSON.stringify(css.map, null, ' ') - ); + fs.writeFileSync(`${outputBase}.css.map`, JSON.stringify(css.map, null, ' ')); } if (js.map) { @@ -103,15 +91,16 @@ describe('sourcemaps', () => { // use locate_1 with mapConsumer: // lines are one-based, columns are zero-based - preprocessed.mapConsumer = preprocessed.map && await new SourceMapConsumer(preprocessed.map); + preprocessed.mapConsumer = + preprocessed.map && (await new SourceMapConsumer(preprocessed.map)); preprocessed.locate = getLocator(preprocessed.code); preprocessed.locate_1 = getLocator(preprocessed.code, { offsetLine: 1 }); - js.mapConsumer = js.map && await new SourceMapConsumer(js.map); + js.mapConsumer = js.map && (await new SourceMapConsumer(js.map)); js.locate = getLocator(js.code); js.locate_1 = getLocator(js.code, { offsetLine: 1 }); - css.mapConsumer = css.map && await new SourceMapConsumer(css.map); + css.mapConsumer = css.map && (await new SourceMapConsumer(css.map)); css.locate = getLocator(css.code || ''); css.locate_1 = getLocator(css.code || '', { offsetLine: 1 }); await test({ assert, input, preprocessed, js, css }); diff --git a/test/sourcemaps/samples/attached-sourcemap/_config.js b/test/sourcemaps/samples/attached-sourcemap/_config.js index 86498caeba..d32cf75b9d 100644 --- a/test/sourcemaps/samples/attached-sourcemap/_config.js +++ b/test/sourcemaps/samples/attached-sourcemap/_config.js @@ -18,10 +18,10 @@ function get_processor(tag_name, search, replace) { const map_opts = { source: filename, hires: true, includeContent: false }; const map = ms.generateMap(map_opts); - const attach_line = (tag_name == 'style' || comment_multi) - ? `\n/*# sourceMappingURL=${map.toUrl()} */` - : `\n//# sourceMappingURL=${map.toUrl()}` // only in script - ; + const attach_line = + tag_name == 'style' || comment_multi + ? `\n/*# sourceMappingURL=${map.toUrl()} */` + : `\n//# sourceMappingURL=${map.toUrl()}`; // only in script code = ms.toString() + attach_line; indent_size += 2; @@ -33,12 +33,10 @@ function get_processor(tag_name, search, replace) { export default { preprocess: [ - get_processor('script', 'replace_me_script', 'done_replace_script_1'), get_processor('script', 'done_replace_script_1', 'done_replace_script_2'), get_processor('style', '.replace_me_style', '.done_replace_style_1'), get_processor('style', '.done_replace_style_1', '.done_replace_style_2') - ] }; diff --git a/test/sourcemaps/samples/attached-sourcemap/test.js b/test/sourcemaps/samples/attached-sourcemap/test.js index ecb88ab11d..04869394d2 100644 --- a/test/sourcemaps/samples/attached-sourcemap/test.js +++ b/test/sourcemaps/samples/attached-sourcemap/test.js @@ -1,9 +1,8 @@ import * as assert from 'assert'; -const get_line_column = obj => ({ line: obj.line, column: obj.column }); +const get_line_column = (obj) => ({ line: obj.line, column: obj.column }); export function test({ input, css, js }) { - let out_obj, loc_output, actual, loc_input, expected; out_obj = js; diff --git a/test/sourcemaps/samples/compile-option-dev/_config.js b/test/sourcemaps/samples/compile-option-dev/_config.js index b6ea851b6d..cd353dda40 100644 --- a/test/sourcemaps/samples/compile-option-dev/_config.js +++ b/test/sourcemaps/samples/compile-option-dev/_config.js @@ -6,16 +6,20 @@ export default { dev: true }, preprocess: [ - { style: ({ content, filename }) => { + { + style: ({ content, filename }) => { const src = new MagicString(content); magic_string_replace_all(src, '--replace-me-once', '\n --done-replace-once'); magic_string_replace_all(src, '--replace-me-twice', '\n--almost-done-replace-twice'); return magic_string_preprocessor_result(filename, src); - } }, - { style: ({ content, filename }) => { + } + }, + { + style: ({ content, filename }) => { const src = new MagicString(content); magic_string_replace_all(src, '--almost-done-replace-twice', '\n --done-replace-twice'); return magic_string_preprocessor_result(filename, src); - } } + } + } ] }; diff --git a/test/sourcemaps/samples/compile-option-dev/test.js b/test/sourcemaps/samples/compile-option-dev/test.js index eec81fc93e..0dbcaf56b8 100644 --- a/test/sourcemaps/samples/compile-option-dev/test.js +++ b/test/sourcemaps/samples/compile-option-dev/test.js @@ -1,11 +1,12 @@ import { SourceMapConsumer } from 'source-map'; -const b64dec = s => Buffer.from(s, 'base64').toString(); - -export async function test({ assert, css, js }) { +const b64dec = (s) => Buffer.from(s, 'base64').toString(); +export async function test({ assert, css, js }) { // We check that the css source map embedded in the js is accurate - const match = js.code.match(/\tappend_styles\(target, "svelte-.{6}", "(.*?)(?:\\n\/\*# sourceMappingURL=data:(.*?);charset=(.*?);base64,(.*?) \*\/)?"\);\n/); + const match = js.code.match( + /\tappend_styles\(target, "svelte-.{6}", "(.*?)(?:\\n\/\*# sourceMappingURL=data:(.*?);charset=(.*?);base64,(.*?) \*\/)?"\);\n/ + ); assert.notEqual(match, null); const [mimeType, encoding, cssMapBase64] = match.slice(2); @@ -25,12 +26,9 @@ export async function test({ assert, css, js }) { // each tab is 1 col [css, '--done-replace-once', 6, 4], [css, '--done-replace-twice', 9, 4] - ] - .forEach(([where, content, line, column]) => { + ].forEach(([where, content, line, column]) => { assert.deepEqual( - where.mapConsumer.originalPositionFor( - where.locate_1(content) - ), + where.mapConsumer.originalPositionFor(where.locate_1(content)), { source: sourcefile, name: null, diff --git a/test/sourcemaps/samples/decoded-sourcemap/_config.js b/test/sourcemaps/samples/decoded-sourcemap/_config.js index a0b2c82692..3af6b4a2b1 100644 --- a/test/sourcemaps/samples/decoded-sourcemap/_config.js +++ b/test/sourcemaps/samples/decoded-sourcemap/_config.js @@ -2,7 +2,6 @@ import MagicString from 'magic-string'; import { magic_string_preprocessor_result, magic_string_replace_all } from '../../helpers'; export default { - js_map_sources: ['input.svelte'], preprocess: { diff --git a/test/sourcemaps/samples/decoded-sourcemap/test.js b/test/sourcemaps/samples/decoded-sourcemap/test.js index 5a44ee83cf..fe54a570b8 100644 --- a/test/sourcemaps/samples/decoded-sourcemap/test.js +++ b/test/sourcemaps/samples/decoded-sourcemap/test.js @@ -1,19 +1,17 @@ export function test({ assert, input, preprocessed }) { + const expected = input.locate('replace me'); - const expected = input.locate('replace me'); + const start = preprocessed.locate('success'); - const start = preprocessed.locate('success'); - - const actualbar = preprocessed.mapConsumer.originalPositionFor({ - line: start.line + 1, - column: start.column - }); - - assert.deepEqual(actualbar, { - source: 'input.svelte', - name: 'replace me', - line: expected.line + 1, - column: expected.column - }); + const actualbar = preprocessed.mapConsumer.originalPositionFor({ + line: start.line + 1, + column: start.column + }); + assert.deepEqual(actualbar, { + source: 'input.svelte', + name: 'replace me', + line: expected.line + 1, + column: expected.column + }); } diff --git a/test/sourcemaps/samples/no-sourcemap/_config.js b/test/sourcemaps/samples/no-sourcemap/_config.js index 5b84d40554..05a4e02be8 100644 --- a/test/sourcemaps/samples/no-sourcemap/_config.js +++ b/test/sourcemaps/samples/no-sourcemap/_config.js @@ -1,5 +1,5 @@ export default { - compile_options: { - enableSourcemap: false - } + compile_options: { + enableSourcemap: false + } }; diff --git a/test/sourcemaps/samples/only-css-sourcemap/_config.js b/test/sourcemaps/samples/only-css-sourcemap/_config.js index 767e10a4b9..1a14a5a5ad 100644 --- a/test/sourcemaps/samples/only-css-sourcemap/_config.js +++ b/test/sourcemaps/samples/only-css-sourcemap/_config.js @@ -1,5 +1,5 @@ export default { - compile_options: { - enableSourcemap: { css: true } - } + compile_options: { + enableSourcemap: { css: true } + } }; diff --git a/test/sourcemaps/samples/only-js-sourcemap/_config.js b/test/sourcemaps/samples/only-js-sourcemap/_config.js index 0b3b7987f1..7a40ca5983 100644 --- a/test/sourcemaps/samples/only-js-sourcemap/_config.js +++ b/test/sourcemaps/samples/only-js-sourcemap/_config.js @@ -1,5 +1,5 @@ export default { - compile_options: { - enableSourcemap: { js: true } - } + compile_options: { + enableSourcemap: { js: true } + } }; diff --git a/test/sourcemaps/samples/preprocessed-markup/_config.js b/test/sourcemaps/samples/preprocessed-markup/_config.js index 0b2baeb49c..40e73d7f9b 100644 --- a/test/sourcemaps/samples/preprocessed-markup/_config.js +++ b/test/sourcemaps/samples/preprocessed-markup/_config.js @@ -3,7 +3,7 @@ import { magic_string_preprocessor_result, magic_string_replace_all } from '../. export default { preprocess: { - markup: ({ content, filename }) => { + markup: ({ content, filename }) => { const src = new MagicString(content); magic_string_replace_all(src, 'baritone', 'bar'); return magic_string_preprocessor_result(filename, src); diff --git a/test/sourcemaps/samples/preprocessed-no-map/test.js b/test/sourcemaps/samples/preprocessed-no-map/test.js index 22286ae282..ef1aba1630 100644 --- a/test/sourcemaps/samples/preprocessed-no-map/test.js +++ b/test/sourcemaps/samples/preprocessed-no-map/test.js @@ -14,14 +14,14 @@ export function test({ input, preprocessed }) { input: input.locate, preprocessed }); - + // markup (middle) assert_mapped({ code: '
    {name}
    ', input: input.locate, preprocessed }); - + // style content (preprocessed without map, content changed) assert_not_mapped({ code: 'font-weight: bold;', diff --git a/test/sourcemaps/samples/preprocessed-script/_config.js b/test/sourcemaps/samples/preprocessed-script/_config.js index 94bd83c22f..8e129d06a6 100644 --- a/test/sourcemaps/samples/preprocessed-script/_config.js +++ b/test/sourcemaps/samples/preprocessed-script/_config.js @@ -3,7 +3,7 @@ import { magic_string_preprocessor_result, magic_string_replace_all } from '../. export default { preprocess: { - script: ({ content, filename }) => { + script: ({ content, filename }) => { const src = new MagicString(content); magic_string_replace_all(src, 'baritone', 'bar'); return magic_string_preprocessor_result(filename, src); diff --git a/test/sourcemaps/samples/preprocessed-script/test.js b/test/sourcemaps/samples/preprocessed-script/test.js index 20a366f6d2..5baed6f6fc 100644 --- a/test/sourcemaps/samples/preprocessed-script/test.js +++ b/test/sourcemaps/samples/preprocessed-script/test.js @@ -9,12 +9,16 @@ export function test({ assert, input, js }) { column: start.column }); - assert.deepEqual(actualbar, { - source: 'input.svelte', - name: 'baritone', - line: expectedBar.line + 1, - column: expectedBar.column - }, "couldn't find bar: in source"); + assert.deepEqual( + actualbar, + { + source: 'input.svelte', + name: 'baritone', + line: expectedBar.line + 1, + column: expectedBar.column + }, + "couldn't find bar: in source" + ); start = js.locate('baz:'); @@ -23,10 +27,14 @@ export function test({ assert, input, js }) { column: start.column }); - assert.deepEqual(actualbaz, { - source: 'input.svelte', - name: null, - line: expectedBaz.line + 1, - column: expectedBaz.column - }, "couldn't find baz: in source"); + assert.deepEqual( + actualbaz, + { + source: 'input.svelte', + name: null, + line: expectedBaz.line + 1, + column: expectedBaz.column + }, + "couldn't find baz: in source" + ); } diff --git a/test/sourcemaps/samples/preprocessed-styles/_config.js b/test/sourcemaps/samples/preprocessed-styles/_config.js index 04c8bcda7a..d1d681bea7 100644 --- a/test/sourcemaps/samples/preprocessed-styles/_config.js +++ b/test/sourcemaps/samples/preprocessed-styles/_config.js @@ -3,7 +3,7 @@ import { magic_string_preprocessor_result, magic_string_replace_all } from '../. export default { preprocess: { - style: ({ content, filename }) => { + style: ({ content, filename }) => { const src = new MagicString(content); magic_string_replace_all(src, 'baritone', 'bar'); return magic_string_preprocessor_result(filename, src); diff --git a/test/sourcemaps/samples/preprocessed-styles/test.js b/test/sourcemaps/samples/preprocessed-styles/test.js index 5b28a12514..bab59110bd 100644 --- a/test/sourcemaps/samples/preprocessed-styles/test.js +++ b/test/sourcemaps/samples/preprocessed-styles/test.js @@ -9,12 +9,16 @@ export function test({ assert, input, css }) { column: start.column }); - assert.deepEqual(actualbar, { - source: 'input.svelte', - name: null, - line: expectedBar.line + 1, - column: expectedBar.column - }, "couldn't find bar in source"); + assert.deepEqual( + actualbar, + { + source: 'input.svelte', + name: null, + line: expectedBar.line + 1, + column: expectedBar.column + }, + "couldn't find bar in source" + ); start = css.locate('--baz'); @@ -23,10 +27,14 @@ export function test({ assert, input, css }) { column: start.column }); - assert.deepEqual(actualbaz, { - source: 'input.svelte', - name: null, - line: expectedBaz.line + 1, - column: expectedBaz.column - }, "couldn't find baz in source"); + assert.deepEqual( + actualbaz, + { + source: 'input.svelte', + name: null, + line: expectedBaz.line + 1, + column: expectedBaz.column + }, + "couldn't find baz in source" + ); } diff --git a/test/sourcemaps/samples/script/test.js b/test/sourcemaps/samples/script/test.js index e6a91f51e1..17b37e546a 100644 --- a/test/sourcemaps/samples/script/test.js +++ b/test/sourcemaps/samples/script/test.js @@ -7,7 +7,7 @@ export function test({ assert, input, js }) { column: start.column }); - assert.deepEqual( actual, { + assert.deepEqual(actual, { source: 'input.svelte', name: null, line: expected.line + 1, diff --git a/test/sourcemaps/samples/source-map-generator/_config.js b/test/sourcemaps/samples/source-map-generator/_config.js index 3cd15d9dda..306f4aa88e 100644 --- a/test/sourcemaps/samples/source-map-generator/_config.js +++ b/test/sourcemaps/samples/source-map-generator/_config.js @@ -3,7 +3,7 @@ import { SourceMapConsumer, SourceMapGenerator } from 'source-map'; export default { preprocess: { - style: async ({ content, filename }) => { + style: async ({ content, filename }) => { const src = new MagicString(content); const idx = content.indexOf('baritone'); src.overwrite(idx, idx + 'baritone'.length, 'bar'); diff --git a/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js b/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js index 15c346bfb9..d1656d0680 100644 --- a/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js +++ b/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js @@ -1,5 +1,4 @@ - -import {magic_string_bundle} from '../../helpers'; +import { magic_string_bundle } from '../../helpers'; export const component_filepath = 'src/some/deep/path/input.svelte'; export const component_file_basename = 'input.svelte'; @@ -12,15 +11,18 @@ export default { { style: ({ content, filename }) => { const style_to_add = `/* Filename from preprocess: ${filename} */` + input_css; - return magic_string_bundle([ - { code: content, filename: component_file_basename }, - { code: style_to_add, filename: css_file_basename } - ],component_filepath); + return magic_string_bundle( + [ + { code: content, filename: component_file_basename }, + { code: style_to_add, filename: css_file_basename } + ], + component_filepath + ); } } ], js_map_sources: [component_file_basename], - css_map_sources: [css_file_basename,component_file_basename], + css_map_sources: [css_file_basename, component_file_basename], options: { filename: component_filepath }, diff --git a/test/sourcemaps/samples/sourcemap-basename-without-outputname/test.js b/test/sourcemaps/samples/sourcemap-basename-without-outputname/test.js index c5747713a7..7bac789180 100644 --- a/test/sourcemaps/samples/sourcemap-basename-without-outputname/test.js +++ b/test/sourcemaps/samples/sourcemap-basename-without-outputname/test.js @@ -1,3 +1,2 @@ // no additional test needed, _config.js values and the js.map.sources assertion in ../../index.ts cover it export function test() {} - diff --git a/test/sourcemaps/samples/sourcemap-basename/test.js b/test/sourcemaps/samples/sourcemap-basename/test.js index 34f6504722..a7b1e7a530 100644 --- a/test/sourcemaps/samples/sourcemap-basename/test.js +++ b/test/sourcemaps/samples/sourcemap-basename/test.js @@ -6,7 +6,7 @@ export function test({ assert, preprocessed }) { undefined, 'Preprocessor should receive same value for filename as passed to preprocess function' ); - + assert.deepEqual( preprocessed.map.sources.slice().sort(), [external_relative_filename, component_file_basename].sort(), diff --git a/test/sourcemaps/samples/sourcemap-names/_config.js b/test/sourcemaps/samples/sourcemap-names/_config.js index c8557ba465..5d2207d8c3 100644 --- a/test/sourcemaps/samples/sourcemap-names/_config.js +++ b/test/sourcemaps/samples/sourcemap-names/_config.js @@ -7,9 +7,9 @@ export default { markup: ({ content, filename }) => { const src = new MagicString(content); magic_string_replace_all(src, 'baritone', 'bar'); - magic_string_replace_all(src,'--bazitone', '--baz'); - magic_string_replace_all(src,'old_name_1', 'temp_new_name_1'); - magic_string_replace_all(src,'old_name_2', 'temp_new_name_2'); + magic_string_replace_all(src, '--bazitone', '--baz'); + magic_string_replace_all(src, 'old_name_1', 'temp_new_name_1'); + magic_string_replace_all(src, 'old_name_2', 'temp_new_name_2'); return magic_string_preprocessor_result(filename, src); } }, diff --git a/test/sourcemaps/samples/sourcemap-names/test.js b/test/sourcemaps/samples/sourcemap-names/test.js index cd70bd25ce..1265e959db 100644 --- a/test/sourcemaps/samples/sourcemap-names/test.js +++ b/test/sourcemaps/samples/sourcemap-names/test.js @@ -2,18 +2,17 @@ import { getLocator } from 'locate-character'; export function test({ assert, preprocessed, js, css }) { - assert.deepEqual( preprocessed.map.names.sort(), ['baritone', '--bazitone', 'old_name_1', 'old_name_2'].sort() ); function test_name(old_name, new_name, where) { - let loc = { character: -1 }; - while (loc = where.locate(new_name, loc.character + 1)) { + while ((loc = where.locate(new_name, loc.character + 1))) { const actualMapping = where.mapConsumer.originalPositionFor({ - line: loc.line + 1, column: loc.column + line: loc.line + 1, + column: loc.column }); if (actualMapping.line === null) { // location is not mapped - ignore diff --git a/test/sourcemaps/samples/sourcemap-offsets/test.js b/test/sourcemaps/samples/sourcemap-offsets/test.js index a6c328770c..ccfa34e945 100644 --- a/test/sourcemaps/samples/sourcemap-offsets/test.js +++ b/test/sourcemaps/samples/sourcemap-offsets/test.js @@ -8,7 +8,7 @@ export function test({ input, preprocessed }) { input: input.locate, preprocessed }); - + // Part from external file, should be without offset assert_mapped({ filename: 'external.css', diff --git a/test/sourcemaps/samples/sourcemap-sources/_config.js b/test/sourcemaps/samples/sourcemap-sources/_config.js index 97024cea5f..6c5094a73b 100644 --- a/test/sourcemaps/samples/sourcemap-sources/_config.js +++ b/test/sourcemaps/samples/sourcemap-sources/_config.js @@ -4,7 +4,6 @@ import MagicString from 'magic-string'; import { Bundle } from 'magic-string'; - function add(bundle, filename, source) { bundle.addSource({ filename, @@ -26,13 +25,7 @@ function result(bundle, filename) { } export default { - js_map_sources: [ - 'input.svelte', - 'foo.js', - 'bar.js', - 'foo2.js', - 'bar2.js' - ], + js_map_sources: ['input.svelte', 'foo.js', 'bar.js', 'foo2.js', 'bar2.js'], preprocess: [ { script: ({ content, filename }) => { diff --git a/test/sourcemaps/samples/sourcemap-sources/test.js b/test/sourcemaps/samples/sourcemap-sources/test.js index 78a4c80a17..d79ca9a56e 100644 --- a/test/sourcemaps/samples/sourcemap-sources/test.js +++ b/test/sourcemaps/samples/sourcemap-sources/test.js @@ -1,5 +1,4 @@ export function test({ assert, preprocessed, js }) { - assert.equal(preprocessed.error, undefined); // sourcemap stores location only for 'answer = 42;' @@ -9,13 +8,9 @@ export function test({ assert, preprocessed, js }) { [js, 'bar.js', 'console.log(answer);', 0], [js, 'foo2.js', 'answer2 = 84;', 4], [js, 'bar2.js', 'console.log(answer2);', 0] - ] - .forEach(([where, sourcefile, content, column]) => { - + ].forEach(([where, sourcefile, content, column]) => { assert.deepEqual( - where.mapConsumer.originalPositionFor( - where.locate_1(content) - ), + where.mapConsumer.originalPositionFor(where.locate_1(content)), { source: sourcefile, name: null, @@ -24,6 +19,5 @@ export function test({ assert, preprocessed, js }) { }, `failed to locate "${content}" from "${sourcefile}"` ); - }); } diff --git a/test/sourcemaps/samples/two-scripts/test.js b/test/sourcemaps/samples/two-scripts/test.js index 70901af8c9..06ecc46929 100644 --- a/test/sourcemaps/samples/two-scripts/test.js +++ b/test/sourcemaps/samples/two-scripts/test.js @@ -1,13 +1,13 @@ export function test({ assert, input, js }) { - const expected = input.locate( 'assertThisLine' ); - const start = js.locate( 'assertThisLine' ); + const expected = input.locate('assertThisLine'); + const start = js.locate('assertThisLine'); const actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); - assert.deepEqual( actual, { + assert.deepEqual(actual, { source: 'input.svelte', name: null, line: expected.line + 1, diff --git a/test/sourcemaps/samples/typescript/_config.js b/test/sourcemaps/samples/typescript/_config.js index c8a955dfbd..3582c1b12c 100644 --- a/test/sourcemaps/samples/typescript/_config.js +++ b/test/sourcemaps/samples/typescript/_config.js @@ -1,9 +1,7 @@ import * as ts from 'typescript'; export default { - js_map_sources: [ - 'input.svelte' - ], + js_map_sources: ['input.svelte'], preprocess: [ { script: ({ content, filename }) => { diff --git a/test/sourcemaps/samples/typescript/test.js b/test/sourcemaps/samples/typescript/test.js index bec397e33c..7af24b6e3b 100644 --- a/test/sourcemaps/samples/typescript/test.js +++ b/test/sourcemaps/samples/typescript/test.js @@ -15,7 +15,7 @@ export function test({ input, preprocessed }) { input: input.locate, preprocessed }); - + // TS types, removed assert_not_located('ITimeoutDestroyer', preprocessed.locate_1); } diff --git a/test/stats/index.js b/test/stats/index.js index a6efd93d22..22e2ef5be5 100644 --- a/test/stats/index.js +++ b/test/stats/index.js @@ -3,7 +3,7 @@ import * as assert from 'assert'; import { svelte, loadConfig, tryToLoadJson } from '../helpers'; describe('stats', () => { - fs.readdirSync(`${__dirname}/samples`).forEach(dir => { + fs.readdirSync(`${__dirname}/samples`).forEach((dir) => { if (dir[0] === '.') return; // add .solo to a sample directory name to only run that test @@ -19,9 +19,7 @@ describe('stats', () => { const filename = `${__dirname}/samples/${dir}/input.svelte`; const input = fs.readFileSync(filename, 'utf-8').replace(/\s+$/, ''); - const expectedError = tryToLoadJson( - `${__dirname}/samples/${dir}/error.json` - ); + const expectedError = tryToLoadJson(`${__dirname}/samples/${dir}/error.json`); let result; let error; diff --git a/test/store/index.js b/test/store/index.js index 39b773ef46..9fcda311e8 100644 --- a/test/store/index.js +++ b/test/store/index.js @@ -7,17 +7,17 @@ describe('store', () => { const count = writable(0); const values = []; - const unsubscribe = count.subscribe(value => { + const unsubscribe = count.subscribe((value) => { values.push(value); }); count.set(1); - count.update(n => n + 1); + count.update((n) => n + 1); unsubscribe(); count.set(3); - count.update(n => n + 1); + count.update((n) => n + 1); assert.deepEqual(values, [0, 1, 2]); }); @@ -26,7 +26,7 @@ describe('store', () => { const store = writable(); const values = []; - const unsubscribe = store.subscribe(value => { + const unsubscribe = store.subscribe((value) => { values.push(value); }); @@ -40,13 +40,13 @@ describe('store', () => { const store = writable(0, () => { called += 1; - return () => called -= 1; + return () => (called -= 1); }); - const unsubscribe1 = store.subscribe(() => { }); + const unsubscribe1 = store.subscribe(() => {}); assert.equal(called, 1); - const unsubscribe2 = store.subscribe(() => { }); + const unsubscribe2 = store.subscribe(() => {}); assert.equal(called, 1); unsubscribe1(); @@ -69,21 +69,21 @@ describe('store', () => { store.set(obj); assert.equal(called, 2); - store.update(obj => obj); + store.update((obj) => obj); assert.equal(called, 3); }); it('only calls subscriber once initially, including on resubscriptions', () => { let num = 0; - const store = writable(num, set => set(num += 1)); + const store = writable(num, (set) => set((num += 1))); let count1 = 0; let count2 = 0; - store.subscribe(() => count1 += 1)(); + store.subscribe(() => (count1 += 1))(); assert.equal(count1, 1); - const unsubscribe = store.subscribe(() => count2 += 1); + const unsubscribe = store.subscribe(() => (count2 += 1)); assert.equal(count2, 1); unsubscribe(); @@ -91,8 +91,8 @@ describe('store', () => { it('no error even if unsubscribe calls twice', () => { let num = 0; - const store = writable(num, set => set(num += 1)); - const unsubscribe = store.subscribe(() => { }); + const store = writable(num, (set) => set((num += 1))); + const unsubscribe = store.subscribe(() => {}); unsubscribe(); assert.doesNotThrow(() => unsubscribe()); }); @@ -104,14 +104,14 @@ describe('store', () => { /** @type {import('svelte/store').Subscriber} */ let tick; - const store = readable(undefined, set => { + const store = readable(undefined, (set) => { tick = set; running = true; set(0); return () => { - tick = () => { }; + tick = () => {}; running = false; }; }); @@ -120,7 +120,7 @@ describe('store', () => { const values = []; - const unsubscribe = store.subscribe(value => { + const unsubscribe = store.subscribe((value) => { values.push(value); }); @@ -145,13 +145,13 @@ describe('store', () => { const store = readable(undefined, (set, update) => { tick = set; running = true; - add = n => update(value => value + n); + add = (n) => update((value) => value + n); set(0); return () => { - tick = () => { }; - add = _ => { }; + tick = () => {}; + add = (_) => {}; running = false; }; }); @@ -160,7 +160,7 @@ describe('store', () => { const values = []; - const unsubscribe = store.subscribe(value => { + const unsubscribe = store.subscribe((value) => { values.push(value); }); @@ -185,7 +185,7 @@ describe('store', () => { const store = readable(); const values = []; - const unsubscribe = store.subscribe(value => { + const unsubscribe = store.subscribe((value) => { values.push(value); }); @@ -198,7 +198,7 @@ describe('store', () => { const store = readable(100); const values = []; - const unsubscribe = store.subscribe(value => { + const unsubscribe = store.subscribe((value) => { values.push(value); }); @@ -213,7 +213,7 @@ describe('store', () => { subscribe(fn) { fn(42); return { - unsubscribe: () => { } + unsubscribe: () => {} }; } }; @@ -221,11 +221,11 @@ describe('store', () => { describe('derived', () => { it('maps a single store', () => { const a = writable(1); - const b = derived(a, n => n * 2); + const b = derived(a, (n) => n * 2); const values = []; - const unsubscribe = b.subscribe(value => { + const unsubscribe = b.subscribe((value) => { values.push(value); }); @@ -241,11 +241,11 @@ describe('store', () => { it('maps multiple stores', () => { const a = writable(2); const b = writable(3); - const c = derived(([a, b]), ([a, b]) => a * b); + const c = derived([a, b], ([a, b]) => a * b); const values = []; - const unsubscribe = c.subscribe(value => { + const unsubscribe = c.subscribe((value) => { values.push(value); }); @@ -261,13 +261,17 @@ describe('store', () => { it('passes optional set function', () => { const number = writable(1); - const evens = derived(number, (n, set) => { - if (n % 2 === 0) set(n); - }, 0); + const evens = derived( + number, + (n, set) => { + if (n % 2 === 0) set(n); + }, + 0 + ); const values = []; - const unsubscribe = evens.subscribe(value => { + const unsubscribe = evens.subscribe((value) => { values.push(value); }); @@ -287,14 +291,18 @@ describe('store', () => { it('passes optional set and update functions', () => { const number = writable(1); - const evensAndSquaresOf4 = derived(number, (n, set, update) => { - if (n % 2 === 0) set(n); - if (n % 4 === 0) update(n => n * n); - }, 0); + const evensAndSquaresOf4 = derived( + number, + (n, set, update) => { + if (n % 2 === 0) set(n); + if (n % 4 === 0) update((n) => n * n); + }, + 0 + ); const values = []; - const unsubscribe = evensAndSquaresOf4.subscribe(value => { + const unsubscribe = evensAndSquaresOf4.subscribe((value) => { values.push(value); }); @@ -320,22 +328,19 @@ describe('store', () => { it('prevents glitches', () => { const lastname = writable('Jekyll'); - const firstname = derived(lastname, n => n === 'Jekyll' ? 'Henry' : 'Edward'); + const firstname = derived(lastname, (n) => (n === 'Jekyll' ? 'Henry' : 'Edward')); - const fullname = derived([firstname, lastname], names => names.join(' ')); + const fullname = derived([firstname, lastname], (names) => names.join(' ')); const values = []; - const unsubscribe = fullname.subscribe(value => { + const unsubscribe = fullname.subscribe((value) => { values.push(value); }); lastname.set('Hyde'); - assert.deepEqual(values, [ - 'Henry Jekyll', - 'Edward Hyde' - ]); + assert.deepEqual(values, ['Henry Jekyll', 'Edward Hyde']); unsubscribe(); }); @@ -344,11 +349,11 @@ describe('store', () => { const count = writable(0); const values = []; - const a = derived(count, $count => { + const a = derived(count, ($count) => { return 'a' + $count; }); - const b = derived(count, $count => { + const b = derived(count, ($count) => { return 'b' + $count; }); @@ -356,7 +361,7 @@ describe('store', () => { return a + b; }); - const unsubscribe = combined.subscribe(v => { + const unsubscribe = combined.subscribe((v) => { values.push(v); }); @@ -372,7 +377,7 @@ describe('store', () => { const root = writable({ a: 0, b: 0 }); const values = []; - const a = derived(root, $root => { + const a = derived(root, ($root) => { return 'a' + $root.a; }); @@ -380,7 +385,7 @@ describe('store', () => { return 'b' + $root.b + $a; }); - const unsubscribe = b.subscribe(v => { + const unsubscribe = b.subscribe((v) => { values.push(v); }); @@ -396,14 +401,14 @@ describe('store', () => { const arr = [0]; const number = writable(1); - const numbers = derived(number, $number => { + const numbers = derived(number, ($number) => { arr[0] = $number; return arr; }); const concatenated = []; - const unsubscribe = numbers.subscribe(value => { + const unsubscribe = numbers.subscribe((value) => { concatenated.push(...value); }); @@ -431,7 +436,7 @@ describe('store', () => { num.set(2); - const unsubscribe = d.subscribe(value => { + const unsubscribe = d.subscribe((value) => { values.push(value); }); @@ -458,7 +463,7 @@ describe('store', () => { num.set(2); - const unsubscribe = d.subscribe(value => { + const unsubscribe = d.subscribe((value) => { values.push(value); }); @@ -483,11 +488,11 @@ describe('store', () => { }); it('works with RxJS-style observables', () => { - const d = derived(fake_observable, _ => _); + const d = derived(fake_observable, (_) => _); assert.equal(get(d), 42); }); - it('doesn\'t restart when unsubscribed from another store with a shared ancestor', () => { + it("doesn't restart when unsubscribed from another store with a shared ancestor", () => { const a = writable(true); let b_started = false; const b = derived(a, (_, __) => { @@ -501,7 +506,7 @@ describe('store', () => { if ($a) return b.subscribe(set); }); - c.subscribe(() => { }); + c.subscribe(() => {}); a.set(false); assert.equal(b_started, false); }); @@ -524,7 +529,7 @@ describe('store', () => { describe('get', () => { it('gets the current value of a store', () => { - const store = readable(42, () => { }); + const store = readable(42, () => {}); assert.equal(get(store), 42); }); @@ -548,6 +553,5 @@ describe('store', () => { // @ts-ignore assert.throws(() => readableStore.set(3)); }); - }); }); diff --git a/test/test.js b/test/test.js index e33e4124a7..b6998943c2 100644 --- a/test/test.js +++ b/test/test.js @@ -9,13 +9,13 @@ require('../internal'); console.clear(); const test_folders = glob('*/index.js', { cwd: 'test' }); -const solo_folders = test_folders.filter(folder => /\.solo/.test(folder)); +const solo_folders = test_folders.filter((folder) => /\.solo/.test(folder)); if (solo_folders.length) { if (process.env.CI) { throw new Error('Forgot to remove `.solo` from test'); } - solo_folders.forEach(name => require('./' + name)); + solo_folders.forEach((name) => require('./' + name)); } else { - test_folders.forEach(name => require('./' + name)); + test_folders.forEach((name) => require('./' + name)); } diff --git a/test/types/actions.ts b/test/types/actions.ts index 3d56aa3605..bc1225a8ca 100644 --- a/test/types/actions.ts +++ b/test/types/actions.ts @@ -118,7 +118,7 @@ const invalidProperty: ActionReturn = { }; invalidProperty; -type Attributes = ActionReturn['$$_attributes']; +type Attributes = ActionReturn['$$_attributes']; const attributes: Attributes = { a: 'a' }; attributes; // @ts-expect-error wrong type diff --git a/test/types/create-event-dispatcher.ts b/test/types/create-event-dispatcher.ts index 37e31fd179..31f06f71b5 100644 --- a/test/types/create-event-dispatcher.ts +++ b/test/types/create-event-dispatcher.ts @@ -1,10 +1,10 @@ import { createEventDispatcher } from '$runtime/internal/lifecycle'; const dispatch = createEventDispatcher<{ - loaded: never - change: string - valid: boolean - optional: number | null + loaded: never; + change: string; + valid: boolean; + optional: number | null; }>(); // @ts-expect-error: dispatch invalid event diff --git a/test/types/on-mount.ts b/test/types/on-mount.ts index 47d272b8f5..5f5dac71ee 100644 --- a/test/types/on-mount.ts +++ b/test/types/on-mount.ts @@ -1,58 +1,58 @@ -import { onMount } from '$runtime/index'; - -// sync and no return -onMount(() => { - console.log('mounted'); -}); - -// sync and return value -onMount(() => { - return 'done'; -}); - -// sync and return sync -onMount(() => { - return () => { - return 'done'; - }; -}); - -// sync and return async -onMount(() => { - return async () => { - const res = await fetch(''); - return res; - }; -}); - -// async and no return -onMount(async () => { - await fetch(''); -}); - -// async and return value -onMount(async () => { - const res = await fetch(''); - return res; -}); - -// @ts-expect-error async and return sync -onMount(async () => { - return () => { - return 'done'; - }; -}); - -// @ts-expect-error async and return async -onMount(async () => { - return async () => { - const res = await fetch(''); - return res; - }; -}); - -// @ts-expect-error async and return any -onMount(async () => { - const a: any = null as any; - return a; -}); +import { onMount } from '$runtime/index'; + +// sync and no return +onMount(() => { + console.log('mounted'); +}); + +// sync and return value +onMount(() => { + return 'done'; +}); + +// sync and return sync +onMount(() => { + return () => { + return 'done'; + }; +}); + +// sync and return async +onMount(() => { + return async () => { + const res = await fetch(''); + return res; + }; +}); + +// async and no return +onMount(async () => { + await fetch(''); +}); + +// async and return value +onMount(async () => { + const res = await fetch(''); + return res; +}); + +// @ts-expect-error async and return sync +onMount(async () => { + return () => { + return 'done'; + }; +}); + +// @ts-expect-error async and return async +onMount(async () => { + return async () => { + const res = await fetch(''); + return res; + }; +}); + +// @ts-expect-error async and return any +onMount(async () => { + const a: any = null as any; + return a; +}); diff --git a/test/types/tsconfig.json b/test/types/tsconfig.json index 108ed2a2b2..da07886f25 100644 --- a/test/types/tsconfig.json +++ b/test/types/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "../..", + "rootDir": "../..", "baseUrl": "../../", "paths": { "$runtime/*": ["src/runtime/*"] @@ -10,7 +10,7 @@ "allowUnreachableCode": false, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, - "strict": true, + "strict": true }, "include": ["."] -} \ No newline at end of file +} diff --git a/test/validator/index.js b/test/validator/index.js index fce5ed7065..4c15eaf22b 100644 --- a/test/validator/index.js +++ b/test/validator/index.js @@ -3,7 +3,7 @@ import * as assert from 'assert'; import { svelte, loadConfig, tryToLoadJson } from '../helpers'; describe('validate', () => { - fs.readdirSync(`${__dirname}/samples`).forEach(dir => { + fs.readdirSync(`${__dirname}/samples`).forEach((dir) => { if (dir[0] === '.') return; // add .solo to a sample directory name to only run that test @@ -17,7 +17,10 @@ describe('validate', () => { (solo ? it.only : skip ? it.skip : it)(dir, () => { const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); - const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8').replace(/\s+$/, '').replace(/\r/g, ''); + const input = fs + .readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8') + .replace(/\s+$/, '') + .replace(/\r/g, ''); const expected_warnings = tryToLoadJson(`${__dirname}/samples/${dir}/warnings.json`) || []; const expected_errors = tryToLoadJson(`${__dirname}/samples/${dir}/errors.json`); const options = tryToLoadJson(`${__dirname}/samples/${dir}/options.json`); @@ -135,13 +138,18 @@ describe('validate', () => { generate: false }); - assert.deepEqual(warnings.map(w => ({ - code: w.code, - message: w.message - })), [{ - code: 'options-lowercase-name', - message: 'options.name should be capitalised' - }]); + assert.deepEqual( + warnings.map((w) => ({ + code: w.code, + message: w.message + })), + [ + { + code: 'options-lowercase-name', + message: 'options.name should be capitalised' + } + ] + ); }); it('does not warn if options.name begins with non-alphabetic character', () => { @@ -171,16 +179,19 @@ describe('validate', () => { }, /Invalid namespace 'foriegn' \(did you mean 'foreign'\?\)/); }); - it('does not throw error if \'this\' is bound for foreign element', () => { + it("does not throw error if 'this' is bound for foreign element", () => { assert.doesNotThrow(() => { - svelte.compile(` + svelte.compile( + ` -
    `, { - name: 'test', - namespace: 'foreign' - }); +
    `, + { + name: 'test', + namespace: 'foreign' + } + ); }); }); }); diff --git a/test/validator/samples/a11y-anchor-has-content/warnings.json b/test/validator/samples/a11y-anchor-has-content/warnings.json index e5e0a5a48c..d9076ddba1 100644 --- a/test/validator/samples/a11y-anchor-has-content/warnings.json +++ b/test/validator/samples/a11y-anchor-has-content/warnings.json @@ -1,12 +1,14 @@ -[{ - "code": "a11y-missing-content", - "message": "A11y: element should have child content", - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 +[ + { + "code": "a11y-missing-content", + "message": "A11y: element should have child content", + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } } -}] +] diff --git a/test/validator/samples/a11y-aria-activedescendant/warnings.json b/test/validator/samples/a11y-aria-activedescendant/warnings.json index 57288f188f..186a18666f 100644 --- a/test/validator/samples/a11y-aria-activedescendant/warnings.json +++ b/test/validator/samples/a11y-aria-activedescendant/warnings.json @@ -1,14 +1,14 @@ [ - { - "code": "a11y-aria-activedescendant-has-tabindex", - "end": { - "column": 36, - "line": 16 - }, - "message": "A11y: Elements with attribute aria-activedescendant should have tabindex value", - "start": { - "column": 5, - "line": 16 - } - } + { + "code": "a11y-aria-activedescendant-has-tabindex", + "end": { + "column": 36, + "line": 16 + }, + "message": "A11y: Elements with attribute aria-activedescendant should have tabindex value", + "start": { + "column": 5, + "line": 16 + } + } ] diff --git a/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json b/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json index eadd4314bb..61cd1aabba 100644 --- a/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json @@ -1,26 +1,26 @@ [ - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 27 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 26 - } - } + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 27 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 26 + } + } ] diff --git a/test/validator/samples/a11y-aria-proptypes-integer/warnings.json b/test/validator/samples/a11y-aria-proptypes-integer/warnings.json index f894174368..51b31e70ef 100644 --- a/test/validator/samples/a11y-aria-proptypes-integer/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-integer/warnings.json @@ -1,38 +1,38 @@ [ - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-level' must be of type integer", - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 21 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-level' must be of type integer", - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 20 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-level' must be of type integer", - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 15 - } - } + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-level' must be of type integer", + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 21 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-level' must be of type integer", + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 20 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-level' must be of type integer", + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 15 + } + } ] diff --git a/test/validator/samples/a11y-aria-proptypes-token/warnings.json b/test/validator/samples/a11y-aria-proptypes-token/warnings.json index b07838dde4..555f956d95 100644 --- a/test/validator/samples/a11y-aria-proptypes-token/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-token/warnings.json @@ -1,50 +1,50 @@ [ - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 17 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 26 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 14 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 37 - } - } + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 17 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 26 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 14 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 37 + } + } ] diff --git a/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json b/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json index 43159dafcd..408a0db916 100644 --- a/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json @@ -1,62 +1,62 @@ [ - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 21 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 27 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 18 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 40 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 41 - } - } + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 21 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 27 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 18 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 40 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 41 + } + } ] diff --git a/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json b/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json index 3711efa22b..2733b2ad18 100644 --- a/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json @@ -1,26 +1,26 @@ [ - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-checked' must be exactly one of true, false, or mixed", - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 23 - } - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-checked' must be exactly one of true, false, or mixed", - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 22 - } - } + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-checked' must be exactly one of true, false, or mixed", + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 23 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-checked' must be exactly one of true, false, or mixed", + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 22 + } + } ] diff --git a/test/validator/samples/a11y-media-has-caption/warnings.json b/test/validator/samples/a11y-media-has-caption/warnings.json index b1d705c9fb..a438bbdc0f 100644 --- a/test/validator/samples/a11y-media-has-caption/warnings.json +++ b/test/validator/samples/a11y-media-has-caption/warnings.json @@ -1,50 +1,50 @@ [ - { - "code": "a11y-media-has-caption", - "end": { - "column": 15, - "line": 2 - }, - "message": "A11y: