Skip to content

Commit

Permalink
test: more tests for duplicates detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ravijayaramappa committed Oct 12, 2022
1 parent 4a426fe commit 3576c5e
Show file tree
Hide file tree
Showing 37 changed files with 786 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ export const ParserDiagnostics = {
url: '',
},

// TODO [#3100]: Update message to point to external documentation once available.
SLOT_TAG_CANNOT_HAVE_DIRECTIVES: {
code: 1082,
message:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import compiler, { Config } from '../index';
describe('fixtures', () => {
testFixtureDir(
{
root: path.resolve(__dirname, 'fixtures'),
root: path.resolve(__dirname, 'fixtures', 'scoped-slots'),
pattern: '**/actual.html',
},
({ src, dirname }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template lwc:render-mode="light">
<template lwc:if={showStandard}>
<slot></slot>
</template>
<template lwc:elseif={showVariant}>
<slot lwc:slot-bind={slot1VariantData}></slot>
</template>
<template lwc:else>
<slot lwc:slot-bind={slot2VariantData}></slot>
</template>
<slot lwc:slot-bind={slot3VariantData}></slot>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enableScopedSlots": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"warnings": [
{
"code": 1172,
"message": "LWC1172: Invalid duplicate scoped slots (default)",
"level": 1,
"location": {
"line": 11,
"column": 5,
"start": 320,
"length": 46
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template lwc:render-mode="light">
<slot lwc:slot-bind={slot1VariantData}></slot>
<template lwc:if={showStandard}>
<slot></slot>
</template>
<template lwc:elseif={showVariant}>
<slot lwc:slot-bind={slot1VariantData}></slot>
</template>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enableScopedSlots": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"warnings": [
{
"code": 1173,
"message": "LWC1173: Mixing slot types disallowed for same (default) slot.",
"level": 1,
"location": {
"line": 4,
"column": 9,
"start": 131,
"length": 13
}
},
{
"code": 1172,
"message": "LWC1172: Invalid duplicate scoped slots (default)",
"level": 1,
"location": {
"line": 7,
"column": 9,
"start": 209,
"length": 46
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template lwc:render-mode="light">
<template lwc:if={showStandard}>
<slot name="slotname1"></slot>
</template>
<template lwc:else>
<slot name="slotname1" lwc:slot-bind={slot1VariantData}></slot>
</template>
<slot name="slotname1" lwc:slot-bind={slot1VariantData}></slot>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enableScopedSlots": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"warnings": [
{
"code": 1172,
"message": "LWC1172: Invalid duplicate scoped slots (name=\"slotname1\")",
"level": 1,
"location": {
"line": 8,
"column": 5,
"start": 243,
"length": 63
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template lwc:render-mode="light">
<template lwc:if={showStandard}>
<slot name="slotname1"></slot>
</template>
<template lwc:elseif={showVariant}>
<slot name="slotname1" lwc:slot-bind={slot1VariantData}></slot>
</template>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
{
"root": {
"type": "Root",
"location": {
"startLine": 1,
"startColumn": 1,
"endLine": 8,
"endColumn": 12,
"start": 0,
"end": 266,
"startTag": {
"startLine": 1,
"startColumn": 1,
"endLine": 1,
"endColumn": 35,
"start": 0,
"end": 34
},
"endTag": {
"startLine": 8,
"startColumn": 1,
"endLine": 8,
"endColumn": 12,
"start": 255,
"end": 266
}
},
"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": "IfBlock",
"condition": {
"type": "Identifier",
"start": 1,
"end": 13,
"name": "showStandard",
"location": {
"startLine": 2,
"startColumn": 15,
"endLine": 2,
"endColumn": 36,
"start": 49,
"end": 70
}
},
"location": {
"startLine": 2,
"startColumn": 5,
"endLine": 4,
"endColumn": 16,
"start": 39,
"end": 126
},
"directiveLocation": {
"startLine": 2,
"startColumn": 15,
"endLine": 2,
"endColumn": 36,
"start": 49,
"end": 70
},
"children": [
{
"type": "Slot",
"name": "slot",
"namespace": "http://www.w3.org/1999/xhtml",
"slotName": "slotname1",
"location": {
"startLine": 3,
"startColumn": 9,
"endLine": 3,
"endColumn": 39,
"start": 80,
"end": 110,
"startTag": {
"startLine": 3,
"startColumn": 9,
"endLine": 3,
"endColumn": 32,
"start": 80,
"end": 103
},
"endTag": {
"startLine": 3,
"startColumn": 32,
"endLine": 3,
"endColumn": 39,
"start": 103,
"end": 110
}
},
"attributes": [
{
"type": "Attribute",
"name": "name",
"value": {
"type": "Literal",
"value": "slotname1"
},
"location": {
"startLine": 3,
"startColumn": 15,
"endLine": 3,
"endColumn": 31,
"start": 86,
"end": 102
}
}
],
"properties": [],
"directives": [],
"listeners": [],
"children": []
}
],
"else": {
"type": "ElseifBlock",
"condition": {
"type": "Identifier",
"start": 1,
"end": 12,
"name": "showVariant",
"location": {
"startLine": 5,
"startColumn": 15,
"endLine": 5,
"endColumn": 39,
"start": 141,
"end": 165
}
},
"location": {
"startLine": 5,
"startColumn": 5,
"endLine": 7,
"endColumn": 16,
"start": 131,
"end": 254
},
"directiveLocation": {
"startLine": 5,
"startColumn": 15,
"endLine": 5,
"endColumn": 39,
"start": 141,
"end": 165
},
"children": [
{
"type": "Slot",
"name": "slot",
"namespace": "http://www.w3.org/1999/xhtml",
"slotName": "slotname1",
"location": {
"startLine": 6,
"startColumn": 9,
"endLine": 6,
"endColumn": 72,
"start": 175,
"end": 238,
"startTag": {
"startLine": 6,
"startColumn": 9,
"endLine": 6,
"endColumn": 65,
"start": 175,
"end": 231
},
"endTag": {
"startLine": 6,
"startColumn": 65,
"endLine": 6,
"endColumn": 72,
"start": 231,
"end": 238
}
},
"attributes": [
{
"type": "Attribute",
"name": "name",
"value": {
"type": "Literal",
"value": "slotname1"
},
"location": {
"startLine": 6,
"startColumn": 15,
"endLine": 6,
"endColumn": 31,
"start": 181,
"end": 197
}
}
],
"properties": [],
"directives": [
{
"type": "Directive",
"name": "SlotBind",
"value": {
"type": "Identifier",
"start": 1,
"end": 17,
"name": "slot1VariantData",
"location": {
"startLine": 6,
"startColumn": 32,
"endLine": 6,
"endColumn": 64,
"start": 198,
"end": 230
}
},
"location": {
"startLine": 6,
"startColumn": 32,
"endLine": 6,
"endColumn": 64,
"start": 198,
"end": 230
}
}
],
"listeners": [],
"children": []
}
]
}
}
]
}
}
Loading

0 comments on commit 3576c5e

Please sign in to comment.