Skip to content

Commit 4a58641

Browse files
committed
test: convert inline private method tests to fixture-based tests
Move 14 inline tests from private-method-transform.spec.ts into fixture directories under fixtures/private-methods/, and remove 2 redundant tests already covered by existing fixtures. Made-with: Cursor
1 parent c59f08a commit 4a58641

File tree

42 files changed

+276
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+276
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { LightningElement } from 'lwc';
2+
export default class Test extends LightningElement {
3+
async #fetchData() {
4+
return await Promise.resolve(42);
5+
}
6+
}

packages/@lwc/babel-plugin-component/src/__tests__/fixtures/private-methods/async-private-method/error.json

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import _tmpl from "./test.html";
2+
import { LightningElement, registerComponent as _registerComponent } from 'lwc';
3+
class Test extends LightningElement {
4+
async #fetchData() {
5+
return await Promise.resolve(42);
6+
}
7+
/*LWC compiler vX.X.X*/
8+
}
9+
const __lwc_component_class_internal = _registerComponent(Test, {
10+
tmpl: _tmpl,
11+
sel: "lwc-test",
12+
apiVersion: 9999999
13+
});
14+
export default __lwc_component_class_internal;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { LightningElement } from 'lwc';
2+
export default class Test extends LightningElement {
3+
#greet(name = 'world', times = 3) {
4+
return name.repeat(times);
5+
}
6+
}

packages/@lwc/babel-plugin-component/src/__tests__/fixtures/private-methods/default-parameter-values/error.json

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import _tmpl from "./test.html";
2+
import { LightningElement, registerComponent as _registerComponent } from 'lwc';
3+
class Test extends LightningElement {
4+
#greet(name = 'world', times = 3) {
5+
return name.repeat(times);
6+
}
7+
/*LWC compiler vX.X.X*/
8+
}
9+
const __lwc_component_class_internal = _registerComponent(Test, {
10+
tmpl: _tmpl,
11+
sel: "lwc-test",
12+
apiVersion: 9999999
13+
});
14+
export default __lwc_component_class_internal;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { LightningElement } from 'lwc';
2+
export default class Test extends LightningElement {
3+
#process({ x, y }, [a, b]) {
4+
return x + y + a + b;
5+
}
6+
}

packages/@lwc/babel-plugin-component/src/__tests__/fixtures/private-methods/destructuring-parameters/error.json

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import _tmpl from "./test.html";
2+
import { LightningElement, registerComponent as _registerComponent } from 'lwc';
3+
class Test extends LightningElement {
4+
#process({
5+
x,
6+
y
7+
}, [a, b]) {
8+
return x + y + a + b;
9+
}
10+
/*LWC compiler vX.X.X*/
11+
}
12+
const __lwc_component_class_internal = _registerComponent(Test, {
13+
tmpl: _tmpl,
14+
sel: "lwc-test",
15+
apiVersion: 9999999
16+
});
17+
export default __lwc_component_class_internal;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { LightningElement } from 'lwc';
2+
export default class Test extends LightningElement {
3+
#noop() {}
4+
}

0 commit comments

Comments
 (0)