-
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.
- Loading branch information
1 parent
6dd9342
commit e8f640b
Showing
18 changed files
with
345 additions
and
74 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
270 changes: 269 additions & 1 deletion
270
...ages/@lwc/template-compiler/src/__tests__/fixtures/scoped-slots/child-named-slot/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 |
---|---|---|
@@ -1 +1,269 @@ | ||
{} | ||
{ | ||
"root": { | ||
"type": "Root", | ||
"location": { | ||
"startLine": 1, | ||
"startColumn": 1, | ||
"endLine": 5, | ||
"endColumn": 12, | ||
"start": 0, | ||
"end": 214, | ||
"startTag": { | ||
"startLine": 1, | ||
"startColumn": 1, | ||
"endLine": 1, | ||
"endColumn": 35, | ||
"start": 0, | ||
"end": 34 | ||
}, | ||
"endTag": { | ||
"startLine": 5, | ||
"startColumn": 1, | ||
"endLine": 5, | ||
"endColumn": 12, | ||
"start": 203, | ||
"end": 214 | ||
} | ||
}, | ||
"directives": [ | ||
{ | ||
"type": "Directive", | ||
"name": "RenderMode", | ||
"value": { | ||
"type": "Literal", | ||
"value": "light" | ||
}, | ||
"location": { | ||
"startLine": 1, | ||
"startColumn": 11, | ||
"endLine": 1, | ||
"endColumn": 34, | ||
"start": 10, | ||
"end": 33 | ||
} | ||
} | ||
], | ||
"children": [ | ||
{ | ||
"type": "Slot", | ||
"name": "slot", | ||
"namespace": "http://www.w3.org/1999/xhtml", | ||
"slotName": "slotname1", | ||
"location": { | ||
"startLine": 2, | ||
"startColumn": 5, | ||
"endLine": 2, | ||
"endColumn": 61, | ||
"start": 39, | ||
"end": 95, | ||
"startTag": { | ||
"startLine": 2, | ||
"startColumn": 5, | ||
"endLine": 2, | ||
"endColumn": 54, | ||
"start": 39, | ||
"end": 88 | ||
}, | ||
"endTag": { | ||
"startLine": 2, | ||
"startColumn": 54, | ||
"endLine": 2, | ||
"endColumn": 61, | ||
"start": 88, | ||
"end": 95 | ||
} | ||
}, | ||
"attributes": [ | ||
{ | ||
"type": "Attribute", | ||
"name": "name", | ||
"value": { | ||
"type": "Literal", | ||
"value": "slotname1" | ||
}, | ||
"location": { | ||
"startLine": 2, | ||
"startColumn": 11, | ||
"endLine": 2, | ||
"endColumn": 27, | ||
"start": 45, | ||
"end": 61 | ||
} | ||
} | ||
], | ||
"properties": [], | ||
"directives": [ | ||
{ | ||
"type": "Directive", | ||
"name": "SlotBind", | ||
"value": { | ||
"type": "Identifier", | ||
"start": 1, | ||
"end": 10, | ||
"name": "slot1data", | ||
"location": { | ||
"startLine": 2, | ||
"startColumn": 28, | ||
"endLine": 2, | ||
"endColumn": 53, | ||
"start": 62, | ||
"end": 87 | ||
} | ||
}, | ||
"location": { | ||
"startLine": 2, | ||
"startColumn": 28, | ||
"endLine": 2, | ||
"endColumn": 53, | ||
"start": 62, | ||
"end": 87 | ||
} | ||
} | ||
], | ||
"listeners": [], | ||
"children": [] | ||
}, | ||
{ | ||
"type": "Slot", | ||
"name": "slot", | ||
"namespace": "http://www.w3.org/1999/xhtml", | ||
"slotName": "slotname2", | ||
"location": { | ||
"startLine": 3, | ||
"startColumn": 5, | ||
"endLine": 3, | ||
"endColumn": 61, | ||
"start": 100, | ||
"end": 156, | ||
"startTag": { | ||
"startLine": 3, | ||
"startColumn": 5, | ||
"endLine": 3, | ||
"endColumn": 54, | ||
"start": 100, | ||
"end": 149 | ||
}, | ||
"endTag": { | ||
"startLine": 3, | ||
"startColumn": 54, | ||
"endLine": 3, | ||
"endColumn": 61, | ||
"start": 149, | ||
"end": 156 | ||
} | ||
}, | ||
"attributes": [ | ||
{ | ||
"type": "Attribute", | ||
"name": "name", | ||
"value": { | ||
"type": "Literal", | ||
"value": "slotname2" | ||
}, | ||
"location": { | ||
"startLine": 3, | ||
"startColumn": 11, | ||
"endLine": 3, | ||
"endColumn": 27, | ||
"start": 106, | ||
"end": 122 | ||
} | ||
} | ||
], | ||
"properties": [], | ||
"directives": [ | ||
{ | ||
"type": "Directive", | ||
"name": "SlotBind", | ||
"value": { | ||
"type": "Identifier", | ||
"start": 1, | ||
"end": 10, | ||
"name": "slot2data", | ||
"location": { | ||
"startLine": 3, | ||
"startColumn": 28, | ||
"endLine": 3, | ||
"endColumn": 53, | ||
"start": 123, | ||
"end": 148 | ||
} | ||
}, | ||
"location": { | ||
"startLine": 3, | ||
"startColumn": 28, | ||
"endLine": 3, | ||
"endColumn": 53, | ||
"start": 123, | ||
"end": 148 | ||
} | ||
} | ||
], | ||
"listeners": [], | ||
"children": [] | ||
}, | ||
{ | ||
"type": "Slot", | ||
"name": "slot", | ||
"namespace": "http://www.w3.org/1999/xhtml", | ||
"slotName": "", | ||
"location": { | ||
"startLine": 4, | ||
"startColumn": 5, | ||
"endLine": 4, | ||
"endColumn": 46, | ||
"start": 161, | ||
"end": 202, | ||
"startTag": { | ||
"startLine": 4, | ||
"startColumn": 5, | ||
"endLine": 4, | ||
"endColumn": 39, | ||
"start": 161, | ||
"end": 195 | ||
}, | ||
"endTag": { | ||
"startLine": 4, | ||
"startColumn": 39, | ||
"endLine": 4, | ||
"endColumn": 46, | ||
"start": 195, | ||
"end": 202 | ||
} | ||
}, | ||
"attributes": [], | ||
"properties": [], | ||
"directives": [ | ||
{ | ||
"type": "Directive", | ||
"name": "SlotBind", | ||
"value": { | ||
"type": "Identifier", | ||
"start": 1, | ||
"end": 12, | ||
"name": "defaultdata", | ||
"location": { | ||
"startLine": 4, | ||
"startColumn": 11, | ||
"endLine": 4, | ||
"endColumn": 38, | ||
"start": 167, | ||
"end": 194 | ||
} | ||
}, | ||
"location": { | ||
"startLine": 4, | ||
"startColumn": 11, | ||
"endLine": 4, | ||
"endColumn": 38, | ||
"start": 167, | ||
"end": 194 | ||
} | ||
} | ||
], | ||
"listeners": [], | ||
"children": [] | ||
} | ||
] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...s/@lwc/template-compiler/src/__tests__/fixtures/scoped-slots/child-named-slot/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 | ||
} |
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,30 @@ | ||
import { registerTemplate } from "lwc"; | ||
const stc0 = { | ||
attrs: { | ||
name: "slotname1", | ||
}, | ||
key: 0, | ||
}; | ||
const stc1 = []; | ||
const stc2 = { | ||
attrs: { | ||
name: "slotname2", | ||
}, | ||
key: 1, | ||
}; | ||
const stc3 = { | ||
key: 2, | ||
}; | ||
function tmpl($api, $cmp, $slotset, $ctx) { | ||
const { s: api_slot, f: api_flatten } = $api; | ||
return api_flatten([ | ||
api_slot("slotname1", stc0, stc1, $slotset), | ||
api_slot("slotname2", stc2, stc1, $slotset), | ||
api_slot("", stc3, stc1, $slotset), | ||
]); | ||
/*LWC compiler vX.X.X*/ | ||
} | ||
export default registerTemplate(tmpl); | ||
tmpl.slots = ["", "slotname1", "slotname2"]; | ||
tmpl.stylesheets = []; | ||
tmpl.renderMode = "light"; |
36 changes: 1 addition & 35 deletions
36
...@lwc/template-compiler/src/__tests__/fixtures/scoped-slots/child-named-slot/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 |
---|---|---|
@@ -1,37 +1,3 @@ | ||
{ | ||
"warnings": [ | ||
{ | ||
"code": 1159, | ||
"message": "LWC1159: Invalid `lwc:slot-bind` usage. The \"Scoped Slots\" feature must be enabled in order to use this directive.", | ||
"level": 1, | ||
"location": { | ||
"line": 2, | ||
"column": 5, | ||
"start": 39, | ||
"length": 56 | ||
} | ||
}, | ||
{ | ||
"code": 1159, | ||
"message": "LWC1159: Invalid `lwc:slot-bind` usage. The \"Scoped Slots\" feature must be enabled in order to use this directive.", | ||
"level": 1, | ||
"location": { | ||
"line": 3, | ||
"column": 5, | ||
"start": 100, | ||
"length": 56 | ||
} | ||
}, | ||
{ | ||
"code": 1159, | ||
"message": "LWC1159: Invalid `lwc:slot-bind` usage. The \"Scoped Slots\" feature must be enabled in order to use this directive.", | ||
"level": 1, | ||
"location": { | ||
"line": 4, | ||
"column": 5, | ||
"start": 161, | ||
"length": 41 | ||
} | ||
} | ||
] | ||
"warnings": [] | ||
} |
Oops, something went wrong.