@@ -131,11 +131,7 @@ export class MyBasicRefComponent {
131
131
`;
132
132
133
133
exports[`Stencil > jsx > Javascript Test > Basic 1`] = `
134
- "export const DEFAULT_VALUES = {
135
- name: \\"Steve\\",
136
- };
137
-
138
- import { Component, h, Fragment, State } from \\"@stencil/core\\";
134
+ "import { Component, h, Fragment, State } from \\"@stencil/core\\";
139
135
140
136
@Component({
141
137
tag: \\"my-basic-component\\",
@@ -155,11 +151,15 @@ export class MyBasicComponent {
155
151
return \\"bar\\";
156
152
}
157
153
154
+ DEFAULT_VALUES = {
155
+ name: \\"Steve\\",
156
+ };
157
+
158
158
render() {
159
159
return (
160
160
<div class=\\"test div\\">
161
161
<input
162
- value={DEFAULT_VALUES.name || this.name}
162
+ value={this. DEFAULT_VALUES.name || this.name}
163
163
onChange={(myEvent) => (this.name = myEvent.target.value)}
164
164
/>
165
165
Hello! I can run in React, Vue, Solid, or Liquid! >
@@ -524,20 +524,7 @@ export class MyBasicRefAssignmentComponent {
524
524
`;
525
525
526
526
exports[`Stencil > jsx > Javascript Test > BasicRefPrevious 1`] = `
527
- "export function usePrevious(value) {
528
- // The ref object is a generic container whose current property is mutable ...
529
- // ... and can hold any value, similar to an instance property on a class
530
- let ref = useRef(null); // Store current value in ref
531
-
532
- onUpdate(() => {
533
- ref = value;
534
- }, [value]); // Only re-run if value changes
535
- // Return previous value (happens before update in useEffect above)
536
-
537
- return ref;
538
- }
539
-
540
- import { Component, h, Fragment, State } from \\"@stencil/core\\";
527
+ "import { Component, h, Fragment, State } from \\"@stencil/core\\";
541
528
542
529
@Component({
543
530
tag: \\"my-previous-component\\",
@@ -2490,24 +2477,24 @@ export class Button {
2490
2477
`;
2491
2478
2492
2479
exports[`Stencil > jsx > Javascript Test > defaultValsWithTypes 1`] = `
2493
- "const DEFAULT_VALUES = {
2494
- name: \\"Sami\\",
2495
- };
2496
-
2497
- import { Component, h, Fragment, Prop } from \\"@stencil/core\\";
2480
+ "import { Component, h, Fragment, Prop } from \\"@stencil/core\\";
2498
2481
2499
2482
@Component({
2500
2483
tag: \\"component-with-types\\",
2501
2484
})
2502
2485
export class ComponentWithTypes {
2503
2486
@Prop() name: any;
2504
2487
2488
+ DEFAULT_VALUES = {
2489
+ name: \\"Sami\\",
2490
+ };
2491
+
2505
2492
render() {
2506
2493
return (
2507
2494
<div>
2508
2495
{\\" \\"}
2509
2496
Hello
2510
- {this.name || DEFAULT_VALUES.name}
2497
+ {this.name || this. DEFAULT_VALUES.name}
2511
2498
</div>
2512
2499
);
2513
2500
}
@@ -2819,11 +2806,7 @@ export class OnInit {
2819
2806
`;
2820
2807
2821
2808
exports[`Stencil > jsx > Javascript Test > onInit 1`] = `
2822
- "export const defaultValues = {
2823
- name: \\"PatrickJS\\",
2824
- };
2825
-
2826
- import { Component, h, Fragment, Prop, State } from \\"@stencil/core\\";
2809
+ "import { Component, h, Fragment, Prop, State } from \\"@stencil/core\\";
2827
2810
2828
2811
@Component({
2829
2812
tag: \\"on-init\\",
@@ -2949,13 +2932,7 @@ export class OnUpdateWithDeps {
2949
2932
`;
2950
2933
2951
2934
exports[`Stencil > jsx > Javascript Test > preserveExportOrLocalStatement 1`] = `
2952
- "const b = 3;
2953
- const foo = () => {};
2954
- export const a = 3;
2955
- export const bar = () => {};
2956
- export function run(value) {}
2957
-
2958
- import { Component, h, Fragment } from \\"@stencil/core\\";
2935
+ "import { Component, h, Fragment } from \\"@stencil/core\\";
2959
2936
2960
2937
@Component({
2961
2938
tag: \\"my-basic-component\\",
@@ -4081,11 +4058,7 @@ export class MyBasicRefComponent {
4081
4058
`;
4082
4059
4083
4060
exports[`Stencil > jsx > Typescript Test > Basic 1`] = `
4084
- "export const DEFAULT_VALUES = {
4085
- name: \\"Steve\\",
4086
- };
4087
-
4088
- import { Component, h, Fragment, State } from \\"@stencil/core\\";
4061
+ "import { Component, h, Fragment, State } from \\"@stencil/core\\";
4089
4062
4090
4063
@Component({
4091
4064
tag: \\"my-basic-component\\",
@@ -4105,11 +4078,15 @@ export class MyBasicComponent {
4105
4078
return \\"bar\\";
4106
4079
}
4107
4080
4081
+ DEFAULT_VALUES = {
4082
+ name: \\"Steve\\",
4083
+ };
4084
+
4108
4085
render() {
4109
4086
return (
4110
4087
<div class=\\"test div\\">
4111
4088
<input
4112
- value={DEFAULT_VALUES.name || this.name}
4089
+ value={this. DEFAULT_VALUES.name || this.name}
4113
4090
onChange={(myEvent) => (this.name = myEvent.target.value)}
4114
4091
/>
4115
4092
Hello! I can run in React, Vue, Solid, or Liquid! >
@@ -4474,20 +4451,7 @@ export class MyBasicRefAssignmentComponent {
4474
4451
`;
4475
4452
4476
4453
exports[`Stencil > jsx > Typescript Test > BasicRefPrevious 1`] = `
4477
- "export function usePrevious<T>(value: T) {
4478
- // The ref object is a generic container whose current property is mutable ...
4479
- // ... and can hold any value, similar to an instance property on a class
4480
- let ref = useRef<T>(null); // Store current value in ref
4481
-
4482
- onUpdate(() => {
4483
- ref = value;
4484
- }, [value]); // Only re-run if value changes
4485
- // Return previous value (happens before update in useEffect above)
4486
-
4487
- return ref;
4488
- }
4489
-
4490
- import { Component, h, Fragment, State } from \\"@stencil/core\\";
4454
+ "import { Component, h, Fragment, State } from \\"@stencil/core\\";
4491
4455
4492
4456
@Component({
4493
4457
tag: \\"my-previous-component\\",
@@ -6453,24 +6417,24 @@ export class Button {
6453
6417
`;
6454
6418
6455
6419
exports[`Stencil > jsx > Typescript Test > defaultValsWithTypes 1`] = `
6456
- "const DEFAULT_VALUES: Props = {
6457
- name: \\"Sami\\",
6458
- };
6459
-
6460
- import { Component, h, Fragment, Prop } from \\"@stencil/core\\";
6420
+ "import { Component, h, Fragment, Prop } from \\"@stencil/core\\";
6461
6421
6462
6422
@Component({
6463
6423
tag: \\"component-with-types\\",
6464
6424
})
6465
6425
export class ComponentWithTypes {
6466
6426
@Prop() name: any;
6467
6427
6428
+ DEFAULT_VALUES = {
6429
+ name: \\"Sami\\",
6430
+ };
6431
+
6468
6432
render() {
6469
6433
return (
6470
6434
<div>
6471
6435
{\\" \\"}
6472
6436
Hello
6473
- {this.name || DEFAULT_VALUES.name}
6437
+ {this.name || this. DEFAULT_VALUES.name}
6474
6438
</div>
6475
6439
);
6476
6440
}
@@ -6783,11 +6747,7 @@ export class OnInit {
6783
6747
`;
6784
6748
6785
6749
exports[`Stencil > jsx > Typescript Test > onInit 1`] = `
6786
- "export const defaultValues = {
6787
- name: \\"PatrickJS\\",
6788
- };
6789
-
6790
- import { Component, h, Fragment, Prop, State } from \\"@stencil/core\\";
6750
+ "import { Component, h, Fragment, Prop, State } from \\"@stencil/core\\";
6791
6751
6792
6752
@Component({
6793
6753
tag: \\"on-init\\",
@@ -6913,13 +6873,7 @@ export class OnUpdateWithDeps {
6913
6873
`;
6914
6874
6915
6875
exports[`Stencil > jsx > Typescript Test > preserveExportOrLocalStatement 1`] = `
6916
- "const b = 3;
6917
- const foo = () => {};
6918
- export const a = 3;
6919
- export const bar = () => {};
6920
- export function run<T>(value: T) {}
6921
-
6922
- import { Component, h, Fragment } from \\"@stencil/core\\";
6876
+ "import { Component, h, Fragment } from \\"@stencil/core\\";
6923
6877
6924
6878
@Component({
6925
6879
tag: \\"my-basic-component\\",
0 commit comments