From b12839954011229751ea04fdc93addfa140ac603 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 16 Apr 2018 00:03:22 -0400 Subject: [PATCH] fix some more tests --- src/generators/dom/index.ts | 4 ++-- src/generators/nodes/shared/Node.ts | 2 +- src/validate/html/validateHead.ts | 2 +- src/validate/html/validateWindow.ts | 4 ++-- test/custom-elements/samples/html/main.html | 2 +- test/custom-elements/samples/nested/Counter.html | 2 +- test/custom-elements/samples/nested/main.html | 2 +- test/custom-elements/samples/new/main.html | 2 +- .../samples/no-missing-prop-warnings/main.html | 4 ++-- test/formats/index.js | 10 +++++----- .../collapses-text-around-comments/expected-bundle.js | 2 +- .../samples/collapses-text-around-comments/expected.js | 2 +- test/js/samples/css-media-query/expected-bundle.js | 2 +- test/js/samples/css-media-query/expected.js | 2 +- test/js/samples/window-binding-scroll/input.html | 2 +- .../samples/styles-nested/_expected.css | 4 ++-- .../server-side-rendering/samples/styles/_expected.css | 2 +- test/sourcemaps/samples/basic/input.html | 2 +- test/sourcemaps/samples/each-block/input.html | 6 +++--- .../component-slot-dynamic-attribute/input.html | 10 +++++++++- .../missing-component/{warnings.json => errors.json} | 0 .../window-binding-invalid-innerwidth/errors.json | 2 +- .../samples/window-binding-invalid-value/errors.json | 2 +- .../samples/window-binding-invalid-width/errors.json | 2 +- .../samples/window-binding-invalid/errors.json | 2 +- 25 files changed, 42 insertions(+), 34 deletions(-) rename test/validator/samples/missing-component/{warnings.json => errors.json} (100%) diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index e3263e2552..9ae999d669 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -47,7 +47,7 @@ export class DomGenerator extends Generator { this.legacy = options.legacy; this.needsEncapsulateHelper = false; - // initial values for e.g. window.innerWidth, if there's a <:Window> meta tag + // initial values for e.g. window.innerWidth, if there's a meta tag this.metaBindings = []; } } @@ -89,7 +89,7 @@ export default function dom( }); if (generator.readonly.has(key)) { - // <:Window> bindings + // bindings throw new Error( `Cannot have a computed value '${key}' that clashes with a read-only property` ); diff --git a/src/generators/nodes/shared/Node.ts b/src/generators/nodes/shared/Node.ts index 1dad916983..392a50823d 100644 --- a/src/generators/nodes/shared/Node.ts +++ b/src/generators/nodes/shared/Node.ts @@ -58,7 +58,7 @@ export default class Node { if (child.type === 'Comment') return; // special case — this is an easy way to remove whitespace surrounding - // <:Window/>. lil hacky but it works + // . lil hacky but it works if (child.type === 'Window') { windowComponent = child; return; diff --git a/src/validate/html/validateHead.ts b/src/validate/html/validateHead.ts index 48756f9150..aca0fd87ad 100644 --- a/src/validate/html/validateHead.ts +++ b/src/validate/html/validateHead.ts @@ -6,7 +6,7 @@ export default function validateHead(validator: Validator, node: Node, refs: Map if (node.attributes.length) { validator.error(node.attributes[0], { code: `invalid-attribute`, - message: `<:Head> should not have any attributes or directives` + message: ` should not have any attributes or directives` }); } diff --git a/src/validate/html/validateWindow.ts b/src/validate/html/validateWindow.ts index 29b5f2a7df..6f312e0407 100644 --- a/src/validate/html/validateWindow.ts +++ b/src/validate/html/validateWindow.ts @@ -23,7 +23,7 @@ export default function validateWindow(validator: Validator, node: Node, refs: M validator.error(attribute.value, { code: `invalid-binding`, - message: `Bindings on <:Window/> 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('.')}'` }); } @@ -34,7 +34,7 @@ export default function validateWindow(validator: Validator, node: Node, refs: M ? 'innerHeight' : fuzzymatch(attribute.name, validBindings); - const message = `'${attribute.name}' is not a valid binding on <:Window>`; + const message = `'${attribute.name}' is not a valid binding on `; if (match) { validator.error(attribute, { diff --git a/test/custom-elements/samples/html/main.html b/test/custom-elements/samples/html/main.html index 6cc7a9e7af..67b0fa792c 100644 --- a/test/custom-elements/samples/html/main.html +++ b/test/custom-elements/samples/html/main.html @@ -1,4 +1,4 @@ -

Hello {{name}}!

+

Hello {name}!

\ No newline at end of file diff --git a/test/validator/samples/missing-component/warnings.json b/test/validator/samples/missing-component/errors.json similarity index 100% rename from test/validator/samples/missing-component/warnings.json rename to test/validator/samples/missing-component/errors.json diff --git a/test/validator/samples/window-binding-invalid-innerwidth/errors.json b/test/validator/samples/window-binding-invalid-innerwidth/errors.json index a91a928c60..e5bc0c7d34 100644 --- a/test/validator/samples/window-binding-invalid-innerwidth/errors.json +++ b/test/validator/samples/window-binding-invalid-innerwidth/errors.json @@ -1,6 +1,6 @@ [{ "code": "invalid-binding", - "message": "'innerwidth' is not a valid binding on <:Window> (did you mean 'innerWidth'?)", + "message": "'innerwidth' is not a valid binding on (did you mean 'innerWidth'?)", "loc": { "line": 1, "column": 15 diff --git a/test/validator/samples/window-binding-invalid-value/errors.json b/test/validator/samples/window-binding-invalid-value/errors.json index 32009552d6..49b2fa517f 100644 --- a/test/validator/samples/window-binding-invalid-value/errors.json +++ b/test/validator/samples/window-binding-invalid-value/errors.json @@ -1,6 +1,6 @@ [{ "code": "invalid-binding", - "message": "Bindings on <:Window/> must be to top-level properties, e.g. 'baz' rather than 'foo.bar.baz'", + "message": "Bindings on must be to top-level properties, e.g. 'baz' rather than 'foo.bar.baz'", "loc": { "line": 1, "column": 32 diff --git a/test/validator/samples/window-binding-invalid-width/errors.json b/test/validator/samples/window-binding-invalid-width/errors.json index 1ac57e825e..c340fe3f7d 100644 --- a/test/validator/samples/window-binding-invalid-width/errors.json +++ b/test/validator/samples/window-binding-invalid-width/errors.json @@ -1,6 +1,6 @@ [{ "code": "invalid-binding", - "message": "'width' is not a valid binding on <:Window> (did you mean 'innerWidth'?)", + "message": "'width' is not a valid binding on (did you mean 'innerWidth'?)", "loc": { "line": 1, "column": 15 diff --git a/test/validator/samples/window-binding-invalid/errors.json b/test/validator/samples/window-binding-invalid/errors.json index 9bebff624d..7d5f049b79 100644 --- a/test/validator/samples/window-binding-invalid/errors.json +++ b/test/validator/samples/window-binding-invalid/errors.json @@ -1,6 +1,6 @@ [{ "code": "invalid-binding", - "message": "'potato' is not a valid binding on <:Window> — valid bindings are innerWidth, innerHeight, outerWidth, outerHeight, scrollX, scrollY or online", + "message": "'potato' is not a valid binding on — valid bindings are innerWidth, innerHeight, outerWidth, outerHeight, scrollX, scrollY or online", "loc": { "line": 1, "column": 15