From c0ac093a2b72e6d219e25a5897557b4605aaa7bd Mon Sep 17 00:00:00 2001 From: Will Harney Date: Mon, 2 Dec 2024 17:00:51 -0500 Subject: [PATCH] test(ssr): add fixture for computed prop exploding --- .../errors/throws-on-computed-key/error.txt | 1 + .../throws-on-computed-key/expected.html | 0 .../errors/throws-on-computed-key/index.js | 3 +++ .../modules/x/wire/adapter.js | 13 +++++++++++++ .../modules/x/wire/wire.html | 3 +++ .../modules/x/wire/wire.js | 19 +++++++++++++++++++ 6 files changed, 39 insertions(+) create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/error.txt create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/expected.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/index.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/adapter.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.js diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/error.txt new file mode 100644 index 0000000000..47c107c9f9 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/error.txt @@ -0,0 +1 @@ +get bothDecorated should not be called \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/expected.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/index.js new file mode 100644 index 0000000000..fafb890973 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/index.js @@ -0,0 +1,3 @@ +export const tagName = 'x-wire'; +export { default } from 'x/wire'; +export * from 'x/wire'; diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/adapter.js b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/adapter.js new file mode 100644 index 0000000000..b212b22d3f --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/adapter.js @@ -0,0 +1,13 @@ +export class adapter { + constructor(dataCallback) { + this.dc = dataCallback; + } + + connect() {} + + update(config) { + this.dc(config.name); + } + + disconnect() {} +} diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.html b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.html new file mode 100644 index 0000000000..3981f33b93 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.js b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.js new file mode 100644 index 0000000000..8fedcd6ed3 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/wire/errors/throws-on-computed-key/modules/x/wire/wire.js @@ -0,0 +1,19 @@ +import { LightningElement, wire } from 'lwc'; +import { adapter } from './adapter'; +const sym = Symbol('computed prop'); + +export default class Wire extends LightningElement { + @wire(adapter, { name: 'symbol' }) + get [sym]() { + throw new Error('get bothDecorated should not be called'); + } + + @wire(adapter, { name: 'symbol' }) + set [sym](v) { + throw new Error('set bothDecorated should not be called'); + } + + get exposedSymbol() { + return this[sym]; + } +}