-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complain if named slots other than direct descendant of component (#4509
- Loading branch information
Showing
18 changed files
with
98 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/runtime/samples/component-slot-nested-error-2/Nested.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<slot name="slot2"></slot> |
3 changes: 3 additions & 0 deletions
3
test/runtime/samples/component-slot-nested-error-2/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
error: [`Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`] | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/runtime/samples/component-slot-nested-error-2/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
import Nested from "./Nested.svelte"; | ||
</script> | ||
|
||
<Nested> | ||
<div slot="slot1"> | ||
<div> | ||
<div slot="slot2" /> | ||
</div> | ||
</div> | ||
</Nested> |
1 change: 1 addition & 0 deletions
1
test/runtime/samples/component-slot-nested-error-3/Nested.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<slot name="slot2"></slot> |
3 changes: 3 additions & 0 deletions
3
test/runtime/samples/component-slot-nested-error-3/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
error: [`Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`] | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/runtime/samples/component-slot-nested-error-3/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
import Nested from "./Nested.svelte"; | ||
</script> | ||
|
||
<Nested> | ||
<div> | ||
<div> | ||
<div slot="slot2" /> | ||
</div> | ||
</div> | ||
</Nested> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<slot name="slot2"></slot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
error: [`Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script> | ||
import Nested from "./Nested.svelte"; | ||
</script> | ||
|
||
<Nested> | ||
<div slot="slot1"> | ||
<div slot="slot2" /> | ||
</div> | ||
</Nested> |
9 changes: 9 additions & 0 deletions
9
test/validator/samples/component-slotted-custom-element-2/errors.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ | ||
{ | ||
"code": "invalid-slotted-content", | ||
"message": "Element with a slot='...' attribute must be a child of a component or a descendant of a custom element", | ||
"start": { "line": 10, "column": 9, "character": 138 }, | ||
"end": { "line": 10, "column": 19, "character": 148 }, | ||
"pos": 138 | ||
} | ||
] |
14 changes: 14 additions & 0 deletions
14
test/validator/samples/component-slotted-custom-element-2/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
import Nested from './Nested.svelte'; | ||
let thing = false; | ||
</script> | ||
|
||
<custom-element> | ||
<Nested> | ||
{#if thing} | ||
<div> | ||
<div slot='bar' /> | ||
</div> | ||
{/if} | ||
</Nested> | ||
</custom-element> |
1 change: 1 addition & 0 deletions
1
test/validator/samples/component-slotted-custom-element/errors.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
15 changes: 15 additions & 0 deletions
15
test/validator/samples/component-slotted-custom-element/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script> | ||
import Nested from './Nested.svelte'; | ||
let thing = false; | ||
</script> | ||
|
||
<Nested> | ||
<custom-element> | ||
<div> | ||
<div slot='foo' /> | ||
</div> | ||
{#if thing} | ||
<div slot='bar' /> | ||
{/if} | ||
</custom-element> | ||
</Nested> |
2 changes: 1 addition & 1 deletion
2
test/validator/samples/component-slotted-each-block/errors.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters