-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssr): add comments to the output of lwc:if blocks @W-16946260 (#4622
) * refactor: list all IR nodes explicitly * feat(ssr): implement iterator:* directive * test(ssr): add test for multiple iterator blocks * fix(ssr-for-of): use empty array as default for missing iterator * fix(ssr): update error in for-of directive for invalid value * chore(eslint): don't enforce header in spec files * test(lwc-if): add tests for lwc:if, lwc:elseif, and lwc:else * feat(ssr): handle lwc:elseif * fix(ssr): add comments to lwc:if output * fix(ssr): don't add comments for if:true and if:false
- Loading branch information
Showing
22 changed files
with
131 additions
and
9 deletions.
There are no files selected for viewing
Empty file.
5 changes: 5 additions & 0 deletions
5
packages/@lwc/engine-server/src/__tests__/fixtures/attribute-boolean copy/expected.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,5 @@ | ||
<x-attribute-boolean> | ||
<template shadowrootmode="open"> | ||
<input checked readonly required type="checkbox"> | ||
</template> | ||
</x-attribute-boolean> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/attribute-boolean copy/index.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 const tagName = 'x-attribute-boolean'; | ||
export { default } from 'x/attribute-boolean'; | ||
export * from 'x/attribute-boolean'; |
3 changes: 3 additions & 0 deletions
3
...ests__/fixtures/attribute-boolean copy/modules/x/attribute-boolean/attribute-boolean.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,3 @@ | ||
<template> | ||
<input type="checkbox" required readonly checked /> | ||
</template> |
3 changes: 3 additions & 0 deletions
3
..._tests__/fixtures/attribute-boolean copy/modules/x/attribute-boolean/attribute-boolean.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 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class AttributeBoolean extends LightningElement {} |
Empty file.
10 changes: 10 additions & 0 deletions
10
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if-else-if-else/expected.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,10 @@ | ||
<x-component> | ||
<template shadowrootmode="open"> | ||
<!----> | ||
I am rendered. | ||
<!----> | ||
<!----> | ||
Render me! | ||
<!----> | ||
</template> | ||
</x-component> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if-else-if-else/index.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 const tagName = 'x-component'; | ||
export { default } from 'x/component'; | ||
export * from 'x/component'; |
21 changes: 21 additions & 0 deletions
21
...gine-server/src/__tests__/fixtures/lwc-if-else-if-else/modules/x/component/component.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,21 @@ | ||
<template> | ||
<template lwc:if={isFalse}> | ||
I am not rendered. | ||
</template> | ||
<template lwc:elseif={isTrue}> | ||
I am rendered. | ||
</template> | ||
<template lwc:else> | ||
I am also not rendered. | ||
</template> | ||
|
||
<template lwc:if={isFalse}> | ||
I am not rendered. | ||
</template> | ||
<template lwc:elseif={isFalse}> | ||
I, too, do not render. | ||
</template> | ||
<template lwc:else> | ||
Render me! | ||
</template> | ||
</template> |
6 changes: 6 additions & 0 deletions
6
...engine-server/src/__tests__/fixtures/lwc-if-else-if-else/modules/x/component/component.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,6 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class IfBlock extends LightningElement { | ||
isTrue = true; | ||
isFalse = false; | ||
} |
Empty file.
10 changes: 10 additions & 0 deletions
10
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if-else/expected.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,10 @@ | ||
<x-component> | ||
<template shadowrootmode="open"> | ||
<!----> | ||
I am true! | ||
<!----> | ||
<!----> | ||
I am not false! | ||
<!----> | ||
</template> | ||
</x-component> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if-else/index.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 const tagName = 'x-component'; | ||
export { default } from 'x/component'; | ||
export * from 'x/component'; |
15 changes: 15 additions & 0 deletions
15
.../@lwc/engine-server/src/__tests__/fixtures/lwc-if-else/modules/x/component/component.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,15 @@ | ||
<template> | ||
<template lwc:if={isTrue}> | ||
I am true! | ||
</template> | ||
<template lwc:else> | ||
I am not true! | ||
</template> | ||
|
||
<template lwc:if={isFalse}> | ||
I am false! | ||
</template> | ||
<template lwc:else> | ||
I am not false! | ||
</template> | ||
</template> |
6 changes: 6 additions & 0 deletions
6
...es/@lwc/engine-server/src/__tests__/fixtures/lwc-if-else/modules/x/component/component.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,6 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class IfBlock extends LightningElement { | ||
isTrue = true; | ||
isFalse = false; | ||
} |
Empty file.
7 changes: 7 additions & 0 deletions
7
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if/expected.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 @@ | ||
<x-component> | ||
<template shadowrootmode="open"> | ||
<!----> | ||
I am rendered! | ||
<!----> | ||
</template> | ||
</x-component> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if/index.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 const tagName = 'x-component'; | ||
export { default } from 'x/component'; | ||
export * from 'x/component'; |
8 changes: 8 additions & 0 deletions
8
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if/modules/x/component/component.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,8 @@ | ||
<template> | ||
<template lwc:if={isTrue}> | ||
I am rendered! | ||
</template> | ||
<template lwc:if={isFalse}> | ||
I am not rendered! | ||
</template> | ||
</template> |
6 changes: 6 additions & 0 deletions
6
packages/@lwc/engine-server/src/__tests__/fixtures/lwc-if/modules/x/component/component.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,6 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class IfBlock extends LightningElement { | ||
isTrue = true; | ||
isFalse = false; | ||
} |
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