-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: more tests for bindings and nested slots
- Loading branch information
1 parent
3be71d6
commit 505e592
Showing
23 changed files
with
1,018 additions
and
1 deletion.
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
26 changes: 26 additions & 0 deletions
26
...er/src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-parent/actual.html
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,26 @@ | ||
<template> | ||
<x-list> | ||
<template for:each={parentItems} for:item="parentItem" > | ||
<div key={parentItem}>{parentItem}</div> | ||
<template lwc:slot-data="item"> | ||
<span key={parentItem}>{item.id} - {item.name}</span> | ||
</template> | ||
</template> | ||
</x-list> | ||
<x-list> | ||
<template for:each={parentItems} for:item="parentItem" > | ||
<template lwc:slot-data="item"> | ||
<div key={parentItem}>{parentItem}</div> | ||
<span key={parentItem}>{item.id} - {item.name}</span> | ||
</template> | ||
</template> | ||
</x-list> | ||
<template for:each={parentItems} for:item="parentItem" > | ||
<x-list key={parentItem}> | ||
<template lwc:slot-data="item"> | ||
<div>{parentItem}</div> | ||
<span>{item.id} - {item.name}</span> | ||
</template> | ||
</x-list> | ||
</template> | ||
</template> |
1 change: 1 addition & 0 deletions
1
...piler/src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-parent/ast.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 @@ | ||
{} |
3 changes: 3 additions & 0 deletions
3
...er/src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-parent/config.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,3 @@ | ||
{ | ||
"enableScopedSlots": true | ||
} |
Empty file.
37 changes: 37 additions & 0 deletions
37
.../src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-parent/metadata.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,37 @@ | ||
{ | ||
"warnings": [ | ||
{ | ||
"code": 1178, | ||
"message": "LWC1178: Invalid usage of 'lwc:slot-data' in an iterator(for:each, for:of) block.", | ||
"level": 1, | ||
"location": { | ||
"line": 5, | ||
"column": 13, | ||
"start": 154, | ||
"length": 125 | ||
} | ||
}, | ||
{ | ||
"code": 1178, | ||
"message": "LWC1178: Invalid usage of 'lwc:slot-data' in an iterator(for:each, for:of) block.", | ||
"level": 1, | ||
"location": { | ||
"line": 12, | ||
"column": 13, | ||
"start": 404, | ||
"length": 182 | ||
} | ||
}, | ||
{ | ||
"code": 1178, | ||
"message": "LWC1178: Invalid usage of 'lwc:slot-data' in an iterator(for:each, for:of) block.", | ||
"level": 1, | ||
"location": { | ||
"line": 20, | ||
"column": 13, | ||
"start": 728, | ||
"length": 148 | ||
} | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
...r/src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-sibling/actual.html
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,7 @@ | ||
<template> | ||
<x-list> | ||
<template for:each={parentItems} for:item="parentItem" lwc:slot-data="item"> | ||
<div>{parentItem}</div><span>{item.id} - {item.name}</span> | ||
</template> | ||
</x-list> | ||
</template> |
1 change: 1 addition & 0 deletions
1
...iler/src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-sibling/ast.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 @@ | ||
{} |
3 changes: 3 additions & 0 deletions
3
...r/src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-sibling/config.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,3 @@ | ||
{ | ||
"enableScopedSlots": true | ||
} |
Empty file.
15 changes: 15 additions & 0 deletions
15
...src/__tests__/fixtures/scoped-slots/invalid/slot-data/with-for-each-sibling/metadata.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 @@ | ||
{ | ||
"warnings": [ | ||
{ | ||
"code": 1178, | ||
"message": "LWC1178: Invalid usage of 'lwc:slot-data' in an iterator(for:each, for:of) block.", | ||
"level": 1, | ||
"location": { | ||
"line": 3, | ||
"column": 9, | ||
"start": 32, | ||
"length": 168 | ||
} | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
...@lwc/template-compiler/src/__tests__/fixtures/scoped-slots/nested-scoped-slot/actual.html
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,13 @@ | ||
<template> | ||
<x-table data={data}> | ||
<template lwc:slot-data="row"> | ||
<x-row row={row}> <!-- this is rendered for every row in the table --> | ||
<template lwc:slot-data="column"> | ||
<span> <!-- this is rendered for every column in the row --> | ||
Coordinates: {row.number} - {column.number} <!-- can refer to both `row` and `column` --> | ||
</span> | ||
</template> | ||
</x-row> | ||
</template> | ||
</x-table> | ||
</template> |
Oops, something went wrong.