Skip to content

Commit cae4dd9

Browse files
committed
fix some more tests
1 parent 87a8e37 commit cae4dd9

File tree

25 files changed

+42
-34
lines changed

25 files changed

+42
-34
lines changed

src/generators/dom/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class DomGenerator extends Generator {
4747
this.legacy = options.legacy;
4848
this.needsEncapsulateHelper = false;
4949

50-
// initial values for e.g. window.innerWidth, if there's a <:Window> meta tag
50+
// initial values for e.g. window.innerWidth, if there's a <svelte:window> meta tag
5151
this.metaBindings = [];
5252
}
5353
}
@@ -89,7 +89,7 @@ export default function dom(
8989
});
9090

9191
if (generator.readonly.has(key)) {
92-
// <:Window> bindings
92+
// <svelte:window> bindings
9393
throw new Error(
9494
`Cannot have a computed value '${key}' that clashes with a read-only property`
9595
);

src/generators/nodes/shared/Node.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default class Node {
5858
if (child.type === 'Comment') return;
5959

6060
// special case — this is an easy way to remove whitespace surrounding
61-
// <:Window/>. lil hacky but it works
61+
// <svelte:window/>. lil hacky but it works
6262
if (child.type === 'Window') {
6363
windowComponent = child;
6464
return;

src/validate/html/validateHead.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default function validateHead(validator: Validator, node: Node, refs: Map
66
if (node.attributes.length) {
77
validator.error(node.attributes[0], {
88
code: `invalid-attribute`,
9-
message: `<:Head> should not have any attributes or directives`
9+
message: `<svelte:head> should not have any attributes or directives`
1010
});
1111
}
1212

src/validate/html/validateWindow.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function validateWindow(validator: Validator, node: Node, refs: M
2323

2424
validator.error(attribute.value, {
2525
code: `invalid-binding`,
26-
message: `Bindings on <:Window/> must be to top-level properties, e.g. '${parts[parts.length - 1]}' rather than '${parts.join('.')}'`
26+
message: `Bindings on <svelte:window> must be to top-level properties, e.g. '${parts[parts.length - 1]}' rather than '${parts.join('.')}'`
2727
});
2828
}
2929

@@ -34,7 +34,7 @@ export default function validateWindow(validator: Validator, node: Node, refs: M
3434
? 'innerHeight'
3535
: fuzzymatch(attribute.name, validBindings);
3636

37-
const message = `'${attribute.name}' is not a valid binding on <:Window>`;
37+
const message = `'${attribute.name}' is not a valid binding on <svelte:window>`;
3838

3939
if (match) {
4040
validator.error(attribute, {

test/custom-elements/samples/html/main.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1>Hello {{name}}!</h1>
1+
<h1>Hello {name}!</h1>
22

33
<script>
44
export default {

test/custom-elements/samples/nested/Counter.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<button on:click='set({ count: count + 1 })'>count: {{count}}</button>
1+
<button on:click='set({ count: count + 1 })'>count: {count}</button>
22

33
<script>
44
export default {

test/custom-elements/samples/nested/main.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Counter bind:count/>
2-
<p>clicked {{count}} times</p>
2+
<p>clicked {count} times</p>
33

44
<script>
55
import Counter from './Counter.html';

test/custom-elements/samples/new/main.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1>Hello {{name}}!</h1>
1+
<h1>Hello {name}!</h1>
22

33
<script>
44
export default {

test/custom-elements/samples/no-missing-prop-warnings/main.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<p>foo: {{foo}}</p>
2-
<p>bar: {{bar}}</p>
1+
<p>foo: {foo}</p>
2+
<p>bar: {bar}</p>
33

44
<script>
55
export default {

test/formats/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe("formats", () => {
8585
describe("amd", () => {
8686
it("generates an AMD module", () => {
8787
const source = deindent`
88-
<div>{{answer}}</div>
88+
<div>{answer}</div>
8989
9090
<script>
9191
import answer from 'answer';
@@ -110,7 +110,7 @@ describe("formats", () => {
110110
describe("cjs", () => {
111111
it("generates a CommonJS module", () => {
112112
const source = deindent`
113-
<div>{{answer}}</div>
113+
<div>{answer}</div>
114114
115115
<script>
116116
import answer from 'answer';
@@ -134,7 +134,7 @@ describe("formats", () => {
134134
describe("iife", () => {
135135
it("generates a self-executing script", () => {
136136
const source = deindent`
137-
<div>{{answer}}</div>
137+
<div>{answer}</div>
138138
139139
<script>
140140
import answer from 'answer';
@@ -208,7 +208,7 @@ describe("formats", () => {
208208
describe("umd", () => {
209209
it("generates a UMD build", () => {
210210
const source = deindent`
211-
<div>{{answer}}</div>
211+
<div>{answer}</div>
212212
213213
<script>
214214
import answer from 'answer';
@@ -249,7 +249,7 @@ describe("formats", () => {
249249
describe("eval", () => {
250250
it("generates a self-executing script that returns the component on eval", () => {
251251
const source = deindent`
252-
<div>{{answer}}</div>
252+
<div>{answer}</div>
253253
254254
<script>
255255
import answer from 'answer';

test/js/samples/collapses-text-around-comments/expected-bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function data() {
148148
function add_css() {
149149
var style = createElement("style");
150150
style.id = 'svelte-1a7i8ec-style';
151-
style.textContent = "p.svelte-1a7i8ec,.svelte-1a7i8ec p{color:red}";
151+
style.textContent = "p.svelte-1a7i8ec{color:red}";
152152
appendNode(style, document.head);
153153
}
154154

test/js/samples/collapses-text-around-comments/expected.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function data() {
88
function add_css() {
99
var style = createElement("style");
1010
style.id = 'svelte-1a7i8ec-style';
11-
style.textContent = "p.svelte-1a7i8ec,.svelte-1a7i8ec p{color:red}";
11+
style.textContent = "p.svelte-1a7i8ec{color:red}";
1212
appendNode(style, document.head);
1313
}
1414

test/js/samples/css-media-query/expected-bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ var proto = {
141141
function add_css() {
142142
var style = createElement("style");
143143
style.id = 'svelte-1slhpfn-style';
144-
style.textContent = "@media(min-width: 1px){div.svelte-1slhpfn,.svelte-1slhpfn div{color:red}}";
144+
style.textContent = "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}";
145145
appendNode(style, document.head);
146146
}
147147

test/js/samples/css-media-query/expected.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { appendNode, assign, createElement, detachNode, init, insertNode, noop,
44
function add_css() {
55
var style = createElement("style");
66
style.id = 'svelte-1slhpfn-style';
7-
style.textContent = "@media(min-width: 1px){div.svelte-1slhpfn,.svelte-1slhpfn div{color:red}}";
7+
style.textContent = "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}";
88
appendNode(style, document.head);
99
}
1010

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<:Window bind:scrollY=y/>
1+
<svelte:window bind:scrollY=y/>
22

33
<p>scrolled to {y}</p>
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
div.svelte-bzh57p,.svelte-bzh57p div{color:red}
2-
div.svelte-4yw8vx,.svelte-4yw8vx div{color:green}
1+
div.svelte-bzh57p{color:red}
2+
div.svelte-4yw8vx{color:green}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
div.svelte-bzh57p,.svelte-bzh57p div{color:red}
1+
div.svelte-bzh57p{color:red}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{foo.bar.baz}}
1+
{foo.bar.baz}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{{#each foo as bar}}
2-
<span>{{bar}}</span>
3-
{{/each}}
1+
{#each foo as bar}
2+
<span>{bar}</span>
3+
{/each}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<Nested>
22
<button slot='{foo}'>click me</button>
3-
</Nested>
3+
</Nested>
4+
5+
<script>
6+
import Nested from './Nested.html';
7+
8+
export default {
9+
components: { Nested }
10+
};
11+
</script>

test/validator/samples/window-binding-invalid-innerwidth/errors.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[{
22
"code": "invalid-binding",
3-
"message": "'innerwidth' is not a valid binding on <:Window> (did you mean 'innerWidth'?)",
3+
"message": "'innerwidth' is not a valid binding on <svelte:window> (did you mean 'innerWidth'?)",
44
"loc": {
55
"line": 1,
66
"column": 15

test/validator/samples/window-binding-invalid-value/errors.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[{
22
"code": "invalid-binding",
3-
"message": "Bindings on <:Window/> must be to top-level properties, e.g. 'baz' rather than 'foo.bar.baz'",
3+
"message": "Bindings on <svelte:window> must be to top-level properties, e.g. 'baz' rather than 'foo.bar.baz'",
44
"loc": {
55
"line": 1,
66
"column": 32

test/validator/samples/window-binding-invalid-width/errors.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[{
22
"code": "invalid-binding",
3-
"message": "'width' is not a valid binding on <:Window> (did you mean 'innerWidth'?)",
3+
"message": "'width' is not a valid binding on <svelte:window> (did you mean 'innerWidth'?)",
44
"loc": {
55
"line": 1,
66
"column": 15

test/validator/samples/window-binding-invalid/errors.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[{
22
"code": "invalid-binding",
3-
"message": "'potato' is not a valid binding on <:Window> — valid bindings are innerWidth, innerHeight, outerWidth, outerHeight, scrollX, scrollY or online",
3+
"message": "'potato' is not a valid binding on <svelte:window> — valid bindings are innerWidth, innerHeight, outerWidth, outerHeight, scrollX, scrollY or online",
44
"loc": {
55
"line": 1,
66
"column": 15

0 commit comments

Comments
 (0)