-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: v2 non-field api support (#5178)
* fix: support non-field api in ssr * chore: tests * fix: additional coverage, redundant api decorator error * chore: add throw TODO * fix: added tests
- Loading branch information
1 parent
476bb41
commit b6c0276
Showing
33 changed files
with
177 additions
and
24 deletions.
There are no files selected for viewing
Empty file.
14 changes: 14 additions & 0 deletions
14
packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-getter/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,14 @@ | ||
<x-parent> | ||
<template shadowrootmode="open"> | ||
<x-child> | ||
<template shadowrootmode="open"> | ||
const setter getter api value | ||
</template> | ||
</x-child> | ||
<x-child> | ||
<template shadowrootmode="open"> | ||
setter getter api value | ||
</template> | ||
</x-child> | ||
</template> | ||
</x-parent> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-getter/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
...@lwc/engine-server/src/__tests__/fixtures/api/decorated-getter/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> | ||
{setterGetterApi} | ||
</template> |
12 changes: 12 additions & 0 deletions
12
...s/@lwc/engine-server/src/__tests__/fixtures/api/decorated-getter/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,12 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Child extends LightningElement { | ||
set setterGetterApi(value) { | ||
this._someApi = value; | ||
} | ||
|
||
@api | ||
get setterGetterApi() { | ||
return this._someApi; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...wc/engine-server/src/__tests__/fixtures/api/decorated-getter/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,4 @@ | ||
<template> | ||
<x-child setter-getter-api="const setter getter api value"></x-child> | ||
<x-child setter-getter-api={setterGetterApiValue}></x-child> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...@lwc/engine-server/src/__tests__/fixtures/api/decorated-getter/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,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement { | ||
setterGetterApiValue = 'setter getter api value'; | ||
} |
1 change: 1 addition & 0 deletions
1
packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter-getter/error.txt
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 @@ | ||
LWC1112: @api get setterGetterApi and @api set setterGetterApi detected in class declaration. Only one of the two needs to be decorated with @api. |
Empty file.
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter-getter/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
...gine-server/src/__tests__/fixtures/api/decorated-setter-getter/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> | ||
{setterGetterApi} | ||
</template> |
13 changes: 13 additions & 0 deletions
13
...engine-server/src/__tests__/fixtures/api/decorated-setter-getter/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,13 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Child extends LightningElement { | ||
@api | ||
set setterGetterApi(value) { | ||
this._someApi = value; | ||
} | ||
|
||
@api | ||
get setterGetterApi() { | ||
return this._someApi; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...ne-server/src/__tests__/fixtures/api/decorated-setter-getter/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,4 @@ | ||
<template> | ||
<x-child setter-getter-api="const setter getter api value"></x-child> | ||
<x-child setter-getter-api={setterGetterApiValue}></x-child> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...gine-server/src/__tests__/fixtures/api/decorated-setter-getter/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,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement { | ||
setterGetterApiValue = 'setter getter api value'; | ||
} |
Empty file.
14 changes: 14 additions & 0 deletions
14
packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter/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,14 @@ | ||
<x-parent> | ||
<template shadowrootmode="open"> | ||
<x-child> | ||
<template shadowrootmode="open"> | ||
const setter getter api value | ||
</template> | ||
</x-child> | ||
<x-child> | ||
<template shadowrootmode="open"> | ||
setter getter api value | ||
</template> | ||
</x-child> | ||
</template> | ||
</x-parent> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter/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
...@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter/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> | ||
{setterGetterApi} | ||
</template> |
12 changes: 12 additions & 0 deletions
12
...s/@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter/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,12 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Child extends LightningElement { | ||
@api | ||
set setterGetterApi(value) { | ||
this._someApi = value; | ||
} | ||
|
||
get setterGetterApi() { | ||
return this._someApi; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...wc/engine-server/src/__tests__/fixtures/api/decorated-setter/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,4 @@ | ||
<template> | ||
<x-child setter-getter-api="const setter getter api value"></x-child> | ||
<x-child setter-getter-api={setterGetterApiValue}></x-child> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...@lwc/engine-server/src/__tests__/fixtures/api/decorated-setter/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,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement { | ||
setterGetterApiValue = 'setter getter api value'; | ||
} |
Empty file.
14 changes: 14 additions & 0 deletions
14
packages/@lwc/engine-server/src/__tests__/fixtures/api/property/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,14 @@ | ||
<x-parent> | ||
<template shadowrootmode="open"> | ||
<x-child> | ||
<template shadowrootmode="open"> | ||
const field api value | ||
</template> | ||
</x-child> | ||
<x-child> | ||
<template shadowrootmode="open"> | ||
field api value | ||
</template> | ||
</x-child> | ||
</template> | ||
</x-parent> |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/engine-server/src/__tests__/fixtures/api/property/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
packages/@lwc/engine-server/src/__tests__/fixtures/api/property/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> | ||
{fieldApi} | ||
</template> |
5 changes: 5 additions & 0 deletions
5
packages/@lwc/engine-server/src/__tests__/fixtures/api/property/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,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Child extends LightningElement { | ||
@api fieldApi; | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/@lwc/engine-server/src/__tests__/fixtures/api/property/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,4 @@ | ||
<template> | ||
<x-child field-api="const field api value"></x-child> | ||
<x-child field-api={fieldApiValue}></x-child> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
packages/@lwc/engine-server/src/__tests__/fixtures/api/property/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,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement { | ||
fieldApiValue = 'field api value'; | ||
} |
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
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
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