-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ssr): assert read-only-props for
lwc:is
(#4919)
- Loading branch information
1 parent
4aa7768
commit 3aaf2f2
Showing
21 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...ges/@lwc/engine-server/src/__tests__/fixtures/read-only-props/dynamic-child/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,15 @@ | ||
<x-parent> | ||
<template shadowrootmode="open"> | ||
<x-child> | ||
<template shadowrootmode="open"> | ||
<div> | ||
|
||
array: error hit during mutation | ||
object: error hit during mutation | ||
deep: error hit during mutation | ||
object: error hit during deletion | ||
</div> | ||
</template> | ||
</x-child> | ||
</template> | ||
</x-parent> |
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions
39
...gine-server/src/__tests__/fixtures/read-only-props/dynamic-child/modules/x/child/child.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,39 @@ | ||
import { LightningElement, api } from "lwc"; | ||
|
||
export default class extends LightningElement { | ||
@api array | ||
@api object | ||
@api deep | ||
|
||
result | ||
|
||
connectedCallback() { | ||
const results = [] | ||
|
||
try { | ||
this.array.push('bar') | ||
} catch (err) { | ||
results.push('array: error hit during mutation') | ||
} | ||
|
||
try { | ||
this.object.foo = 'baz' | ||
} catch (err) { | ||
results.push('object: error hit during mutation') | ||
} | ||
|
||
try { | ||
this.deep.foo[0].quux = 'quux' | ||
} catch (err) { | ||
results.push('deep: error hit during mutation') | ||
} | ||
|
||
try { | ||
delete this.object.foo | ||
} catch (err) { | ||
results.push('object: error hit during deletion') | ||
} | ||
|
||
this.result = '\n' + results.join('\n') | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...-server/src/__tests__/fixtures/read-only-props/dynamic-child/modules/x/parent/parent.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> | ||
<lwc:component lwc:is={ctor} | ||
array={array} | ||
object={object} | ||
deep={deep} | ||
> | ||
</lwc:component> | ||
</template> |
9 changes: 9 additions & 0 deletions
9
...ne-server/src/__tests__/fixtures/read-only-props/dynamic-child/modules/x/parent/parent.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,9 @@ | ||
import { LightningElement } from "lwc"; | ||
import Child from 'x/child' | ||
|
||
export default class extends LightningElement { | ||
ctor = Child | ||
array = [1, 2, 3] | ||
object = { foo: 'bar '} | ||
deep = { foo: [{ bar: 'baz' }]} | ||
} |
Empty file.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/read-only-props/pseudo-attribute/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-parent'; | ||
export { default } from 'x/parent'; | ||
export * from 'x/parent'; |
3 changes: 3 additions & 0 deletions
3
...server/src/__tests__/fixtures/read-only-props/pseudo-attribute/modules/x/child/child.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> | ||
<div>{result}</div> | ||
</template> |
File renamed without changes.
File renamed without changes.
File renamed without changes.