ripple 0.3.67 → 0.3.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/package.json +3 -3
- package/src/jsx-runtime.d.ts +2 -2
- package/src/runtime/element.js +1 -1
- package/src/runtime/index-client.js +11 -11
- package/src/runtime/index-server.js +7 -4
- package/src/runtime/internal/client/bindings.js +1 -1
- package/src/runtime/internal/client/blocks.js +13 -4
- package/src/runtime/internal/client/component.js +55 -0
- package/src/runtime/internal/client/composite.js +4 -2
- package/src/runtime/internal/client/expression.js +65 -7
- package/src/runtime/internal/client/hmr.js +54 -43
- package/src/runtime/internal/client/index.js +5 -1
- package/src/runtime/internal/client/portal.js +70 -69
- package/src/runtime/internal/client/render.js +3 -0
- package/src/runtime/internal/server/index.js +92 -8
- package/tests/client/__snapshots__/html.test.tsrx.snap +3 -3
- package/tests/client/array/array.copy-within.test.tsrx +33 -31
- package/tests/client/array/array.derived.test.tsrx +186 -169
- package/tests/client/array/array.iteration.test.tsrx +40 -37
- package/tests/client/array/array.mutations.test.tsrx +113 -101
- package/tests/client/array/array.static.test.tsrx +119 -101
- package/tests/client/array/array.to-methods.test.tsrx +24 -21
- package/tests/client/async-suspend.test.tsrx +247 -246
- package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +0 -1
- package/tests/client/basic/basic.attributes.test.tsrx +428 -423
- package/tests/client/basic/basic.collections.test.tsrx +109 -102
- package/tests/client/basic/basic.components.test.tsrx +323 -205
- package/tests/client/basic/basic.errors.test.tsrx +91 -91
- package/tests/client/basic/basic.events.test.tsrx +114 -115
- package/tests/client/basic/basic.get-set.test.tsrx +97 -87
- package/tests/client/basic/basic.hmr.test.tsrx +19 -16
- package/tests/client/basic/basic.reactivity.test.tsrx +199 -191
- package/tests/client/basic/basic.rendering.test.tsrx +272 -182
- package/tests/client/basic/basic.styling.test.tsrx +23 -22
- package/tests/client/basic/basic.utilities.test.tsrx +10 -8
- package/tests/client/boundaries.test.tsrx +26 -26
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.rsrx.snap +5 -5
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.tsrx.snap +5 -5
- package/tests/client/compiler/compiler.assignments.test.tsrx +77 -81
- package/tests/client/compiler/compiler.attributes.test.tsrx +15 -15
- package/tests/client/compiler/compiler.basic.test.tsrx +322 -314
- package/tests/client/compiler/compiler.regex.test.tsrx +44 -47
- package/tests/client/compiler/compiler.tracked-access.test.tsrx +38 -38
- package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
- package/tests/client/compiler/compiler.typescript.test.tsrx +2 -2
- package/tests/client/composite/composite.dynamic-components.test.tsrx +47 -48
- package/tests/client/composite/composite.generics.test.tsrx +168 -192
- package/tests/client/composite/composite.props.test.tsrx +97 -81
- package/tests/client/composite/composite.reactivity.test.tsrx +177 -147
- package/tests/client/composite/composite.render.test.tsrx +122 -105
- package/tests/client/computed-properties.test.tsrx +28 -28
- package/tests/client/context.test.tsrx +21 -21
- package/tests/client/css/global-additional-cases.test.tsrx +58 -58
- package/tests/client/css/global-advanced-selectors.test.tsrx +16 -16
- package/tests/client/css/global-at-rules.test.tsrx +10 -10
- package/tests/client/css/global-basic.test.tsrx +14 -14
- package/tests/client/css/global-classes-ids.test.tsrx +14 -14
- package/tests/client/css/global-combinators.test.tsrx +10 -10
- package/tests/client/css/global-complex-nesting.test.tsrx +14 -14
- package/tests/client/css/global-edge-cases.test.tsrx +18 -18
- package/tests/client/css/global-keyframes.test.tsrx +12 -12
- package/tests/client/css/global-nested.test.tsrx +10 -10
- package/tests/client/css/global-pseudo.test.tsrx +12 -12
- package/tests/client/css/global-scoping.test.tsrx +20 -20
- package/tests/client/css/style-identifier.test.tsrx +143 -291
- package/tests/client/date.test.tsrx +146 -133
- package/tests/client/dynamic-elements.test.tsrx +398 -365
- package/tests/client/events.test.tsrx +292 -290
- package/tests/client/for.test.tsrx +156 -153
- package/tests/client/head.test.tsrx +105 -96
- package/tests/client/html.test.tsrx +122 -26
- package/tests/client/input-value.test.tsrx +1361 -1314
- package/tests/client/lazy-array.test.tsrx +16 -13
- package/tests/client/lazy-destructuring.test.tsrx +257 -213
- package/tests/client/map.test.tsrx +65 -60
- package/tests/client/media-query.test.tsrx +22 -20
- package/tests/client/object.test.tsrx +87 -81
- package/tests/client/portal.test.tsrx +57 -51
- package/tests/client/ref.test.tsrx +233 -202
- package/tests/client/return.test.tsrx +71 -2560
- package/tests/client/set.test.tsrx +54 -45
- package/tests/client/svg.test.tsrx +216 -186
- package/tests/client/switch.test.tsrx +194 -193
- package/tests/client/track-async-hydration.test.tsrx +18 -14
- package/tests/client/tracked-index-access.test.tsrx +28 -18
- package/tests/client/try.test.tsrx +675 -548
- package/tests/client/tsx.test.tsrx +373 -311
- package/tests/client/typescript-generics.test.tsrx +145 -145
- package/tests/client/url/url.derived.test.tsrx +33 -28
- package/tests/client/url/url.parsing.test.tsrx +61 -51
- package/tests/client/url/url.partial-removal.test.tsrx +56 -48
- package/tests/client/url/url.reactivity.test.tsrx +142 -125
- package/tests/client/url/url.serialization.test.tsrx +13 -11
- package/tests/client/url-search-params/url-search-params.derived.test.tsrx +34 -29
- package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +25 -21
- package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +50 -45
- package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +111 -99
- package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +49 -43
- package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +14 -12
- package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +16 -14
- package/tests/hydration/basic.test.js +3 -3
- package/tests/hydration/compiled/client/basic.js +586 -651
- package/tests/hydration/compiled/client/composite.js +79 -104
- package/tests/hydration/compiled/client/events.js +140 -148
- package/tests/hydration/compiled/client/for.js +1005 -1018
- package/tests/hydration/compiled/client/head.js +124 -134
- package/tests/hydration/compiled/client/hmr.js +41 -48
- package/tests/hydration/compiled/client/html-in-template.js +38 -41
- package/tests/hydration/compiled/client/html.js +970 -1314
- package/tests/hydration/compiled/client/if-children.js +234 -249
- package/tests/hydration/compiled/client/if.js +182 -189
- package/tests/hydration/compiled/client/mixed-control-flow.js +347 -303
- package/tests/hydration/compiled/client/nested-control-flow.js +1084 -832
- package/tests/hydration/compiled/client/portal.js +65 -85
- package/tests/hydration/compiled/client/reactivity.js +84 -90
- package/tests/hydration/compiled/client/return.js +38 -1939
- package/tests/hydration/compiled/client/switch.js +218 -224
- package/tests/hydration/compiled/client/track-async-serialization.js +250 -259
- package/tests/hydration/compiled/client/try.js +123 -132
- package/tests/hydration/compiled/server/basic.js +773 -831
- package/tests/hydration/compiled/server/composite.js +166 -191
- package/tests/hydration/compiled/server/events.js +170 -184
- package/tests/hydration/compiled/server/for.js +851 -909
- package/tests/hydration/compiled/server/head.js +206 -216
- package/tests/hydration/compiled/server/hmr.js +64 -72
- package/tests/hydration/compiled/server/html-in-template.js +42 -76
- package/tests/hydration/compiled/server/html.js +1362 -1667
- package/tests/hydration/compiled/server/if-children.js +419 -445
- package/tests/hydration/compiled/server/if.js +194 -208
- package/tests/hydration/compiled/server/mixed-control-flow.js +249 -257
- package/tests/hydration/compiled/server/nested-control-flow.js +491 -515
- package/tests/hydration/compiled/server/portal.js +152 -160
- package/tests/hydration/compiled/server/reactivity.js +94 -106
- package/tests/hydration/compiled/server/return.js +28 -2172
- package/tests/hydration/compiled/server/switch.js +274 -286
- package/tests/hydration/compiled/server/track-async-serialization.js +340 -358
- package/tests/hydration/compiled/server/try.js +167 -185
- package/tests/hydration/components/basic.tsrx +320 -272
- package/tests/hydration/components/composite.tsrx +44 -32
- package/tests/hydration/components/events.tsrx +101 -91
- package/tests/hydration/components/for.tsrx +510 -452
- package/tests/hydration/components/head.tsrx +87 -80
- package/tests/hydration/components/hmr.tsrx +22 -17
- package/tests/hydration/components/html-in-template.tsrx +22 -17
- package/tests/hydration/components/html.tsrx +525 -443
- package/tests/hydration/components/if-children.tsrx +158 -148
- package/tests/hydration/components/if.tsrx +109 -95
- package/tests/hydration/components/mixed-control-flow.tsrx +100 -96
- package/tests/hydration/components/nested-control-flow.tsrx +215 -203
- package/tests/hydration/components/portal.tsrx +41 -34
- package/tests/hydration/components/reactivity.tsrx +37 -27
- package/tests/hydration/components/return.tsrx +12 -556
- package/tests/hydration/components/switch.tsrx +120 -114
- package/tests/hydration/components/track-async-serialization.tsrx +107 -91
- package/tests/hydration/components/try.tsrx +55 -40
- package/tests/hydration/html.test.js +4 -4
- package/tests/hydration/return.test.js +13 -532
- package/tests/server/await.test.tsrx +3 -3
- package/tests/server/basic.attributes.test.tsrx +264 -195
- package/tests/server/basic.components.test.tsrx +296 -169
- package/tests/server/basic.test.tsrx +300 -198
- package/tests/server/compiler.test.tsrx +62 -60
- package/tests/server/composite.props.test.tsrx +77 -63
- package/tests/server/composite.test.tsrx +168 -192
- package/tests/server/context.test.tsrx +18 -12
- package/tests/server/dynamic-elements.test.tsrx +197 -180
- package/tests/server/for.test.tsrx +85 -78
- package/tests/server/head.test.tsrx +50 -43
- package/tests/server/html-nesting-validation.test.tsrx +8 -8
- package/tests/server/if.test.tsrx +57 -51
- package/tests/server/lazy-destructuring.test.tsrx +366 -294
- package/tests/server/return.test.tsrx +76 -1355
- package/tests/server/streaming-ssr.test.tsrx +4 -75
- package/tests/server/style-identifier.test.tsrx +169 -148
- package/tests/server/switch.test.tsrx +91 -85
- package/tests/server/track-async-serialization.test.tsrx +105 -85
- package/tests/server/try.test.tsrx +374 -280
- package/tests/utils/compiler-compat-config.test.js +2 -2
- package/tests/utils/runtime-imports.test.js +10 -0
- package/types/index.d.ts +8 -0
- package/tests/client/__snapshots__/html.test.rsrx.snap +0 -40
|
@@ -3,13 +3,13 @@ import { track } from 'ripple';
|
|
|
3
3
|
|
|
4
4
|
describe('lazy destructuring', () => {
|
|
5
5
|
it('supports tracked value getter and setter', async () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
function Test() {
|
|
7
|
+
return <>
|
|
8
|
+
let count = track(1);
|
|
9
|
+
let derived = track(() => count.value * 2);
|
|
10
|
+
count.value = 3;
|
|
11
|
+
<pre>{`${count.value}-${derived.value}`}</pre>
|
|
12
|
+
</>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const { body } = await render(Test);
|
|
@@ -17,12 +17,12 @@ describe('lazy destructuring', () => {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('lazily accesses object properties', async () => {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
function Inner(&{ a, b }: { a: number; b: string }) {
|
|
21
|
+
return <><pre>{`${a}-${b}`}</pre></>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
function Test() {
|
|
25
|
+
return <><Inner a={1} b="hello" /></>;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const { body } = await render(Test);
|
|
@@ -30,10 +30,12 @@ describe('lazy destructuring', () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
it('supports default values in lazy object destructuring', async () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
function Test() {
|
|
34
|
+
return <>
|
|
35
|
+
const obj: { a: number; b?: number } = { a: 5 };
|
|
36
|
+
const &{ a, b = 99 } = obj;
|
|
37
|
+
<pre>{`${a}-${b}`}</pre>
|
|
38
|
+
</>;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
const { body } = await render(Test);
|
|
@@ -41,13 +43,15 @@ describe('lazy destructuring', () => {
|
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
it('supports nested lazy destructuring in non-lazy component params', async () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
function Inner({ something: &[first, second] }: { something: Tracked<number> }) {
|
|
47
|
+
return <>
|
|
48
|
+
first = second.value + 1;
|
|
49
|
+
<pre>{`${first}-${second.value}`}</pre>
|
|
50
|
+
</>;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
function Test() {
|
|
54
|
+
return <><Inner something={track(1)} /></>;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
const { body } = await render(Test);
|
|
@@ -55,12 +59,14 @@ describe('lazy destructuring', () => {
|
|
|
55
59
|
});
|
|
56
60
|
|
|
57
61
|
it('supports let lazy destructuring with assignment writeback', async () => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
function Test() {
|
|
63
|
+
return <>
|
|
64
|
+
const obj = { a: 1, b: 2 };
|
|
65
|
+
let &{ a, b } = obj;
|
|
66
|
+
a = 10;
|
|
67
|
+
b = 20;
|
|
68
|
+
<pre>{`${obj.a}-${obj.b}`}</pre>
|
|
69
|
+
</>;
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
const { body } = await render(Test);
|
|
@@ -68,12 +74,14 @@ describe('lazy destructuring', () => {
|
|
|
68
74
|
});
|
|
69
75
|
|
|
70
76
|
it('supports compound assignment operators on lazy bindings', async () => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
function Test() {
|
|
78
|
+
return <>
|
|
79
|
+
const obj = { a: 5, b: 10 };
|
|
80
|
+
let &{ a, b } = obj;
|
|
81
|
+
a += 3;
|
|
82
|
+
b *= 2;
|
|
83
|
+
<pre>{`${obj.a}-${obj.b}`}</pre>
|
|
84
|
+
</>;
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
const { body } = await render(Test);
|
|
@@ -81,13 +89,15 @@ describe('lazy destructuring', () => {
|
|
|
81
89
|
});
|
|
82
90
|
|
|
83
91
|
it('supports update expressions on lazy bindings', async () => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
function Test() {
|
|
93
|
+
return <>
|
|
94
|
+
const obj = { count: 0 };
|
|
95
|
+
let &{ count } = obj;
|
|
96
|
+
count++;
|
|
97
|
+
count++;
|
|
98
|
+
count--;
|
|
99
|
+
<pre>{obj.count}</pre>
|
|
100
|
+
</>;
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
const { body } = await render(Test);
|
|
@@ -95,12 +105,14 @@ describe('lazy destructuring', () => {
|
|
|
95
105
|
});
|
|
96
106
|
|
|
97
107
|
it('supports update expressions on lazy bindings with default values', async () => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
function Test() {
|
|
109
|
+
return <>
|
|
110
|
+
const obj: { count?: number } = {};
|
|
111
|
+
let &{ count = 0 } = obj;
|
|
112
|
+
count++;
|
|
113
|
+
count++;
|
|
114
|
+
<pre>{obj.count}</pre>
|
|
115
|
+
</>;
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
const { body } = await render(Test);
|
|
@@ -108,13 +120,15 @@ describe('lazy destructuring', () => {
|
|
|
108
120
|
});
|
|
109
121
|
|
|
110
122
|
it('supports function params with lazy destructuring and default values', async () => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
function Test() {
|
|
124
|
+
return <>
|
|
125
|
+
function calc(&{ x, y = 100 }: { x: number; y?: number }) {
|
|
126
|
+
return x + y;
|
|
127
|
+
}
|
|
128
|
+
const a = calc({ x: 5, y: 10 });
|
|
129
|
+
const b = calc({ x: 5 });
|
|
130
|
+
<pre>{`${a}-${b}`}</pre>
|
|
131
|
+
</>;
|
|
118
132
|
}
|
|
119
133
|
|
|
120
134
|
const { body } = await render(Test);
|
|
@@ -122,15 +136,15 @@ describe('lazy destructuring', () => {
|
|
|
122
136
|
});
|
|
123
137
|
|
|
124
138
|
it('supports nested lazy destructuring in non-lazy function params', async () => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
function Test() {
|
|
140
|
+
return <>
|
|
141
|
+
const something = track(1);
|
|
142
|
+
function getInfo({ something: &[first, second] }: { something: Tracked<number> }) {
|
|
143
|
+
first = second.value + 1;
|
|
144
|
+
return `${first}-${second.value}`;
|
|
145
|
+
}
|
|
146
|
+
<pre>{getInfo({ something })}</pre>
|
|
147
|
+
</>;
|
|
134
148
|
}
|
|
135
149
|
|
|
136
150
|
const { body } = await render(Test);
|
|
@@ -140,18 +154,20 @@ describe('lazy destructuring', () => {
|
|
|
140
154
|
it(
|
|
141
155
|
'preserves lazy getter/setter behavior for RestElement nested destructuring in non-lazy component params',
|
|
142
156
|
async () => {
|
|
143
|
-
|
|
157
|
+
function Inner({
|
|
144
158
|
values: [head, ...&{ 0: first_rest, length: rest_length }],
|
|
145
159
|
}: {
|
|
146
160
|
values: number[];
|
|
147
161
|
}) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
162
|
+
return <>
|
|
163
|
+
const before = `${first_rest}-${rest_length}`;
|
|
164
|
+
rest_length = 0;
|
|
165
|
+
<pre>{`${head}-${before}-${first_rest}-${rest_length}`}</pre>
|
|
166
|
+
</>;
|
|
151
167
|
}
|
|
152
168
|
|
|
153
|
-
|
|
154
|
-
|
|
169
|
+
function Test() {
|
|
170
|
+
return <><Inner values={[10, 20, 30]} /></>;
|
|
155
171
|
}
|
|
156
172
|
|
|
157
173
|
const { body } = await render(Test);
|
|
@@ -162,18 +178,19 @@ describe('lazy destructuring', () => {
|
|
|
162
178
|
it(
|
|
163
179
|
'preserves lazy getter/setter behavior for RestElement nested destructuring in non-lazy function params',
|
|
164
180
|
async () => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
function Test() {
|
|
182
|
+
return <>
|
|
183
|
+
function getInfo({
|
|
184
|
+
values: [head, ...&{ 0: first_rest, length: rest_length }],
|
|
185
|
+
}: {
|
|
186
|
+
values: number[];
|
|
187
|
+
}) {
|
|
188
|
+
const before = `${first_rest}-${rest_length}`;
|
|
189
|
+
rest_length = 0;
|
|
190
|
+
return `${head}-${before}-${first_rest}-${rest_length}`;
|
|
191
|
+
}
|
|
192
|
+
<pre>{getInfo({ values: [5, 6, 7] })}</pre>
|
|
193
|
+
</>;
|
|
177
194
|
}
|
|
178
195
|
|
|
179
196
|
const { body } = await render(Test);
|
|
@@ -182,10 +199,12 @@ describe('lazy destructuring', () => {
|
|
|
182
199
|
);
|
|
183
200
|
|
|
184
201
|
it('supports member access on lazy destructured objects', async () => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
202
|
+
function Test() {
|
|
203
|
+
return <>
|
|
204
|
+
const obj = { user: { name: 'Alice', age: 30 } };
|
|
205
|
+
const &{ user } = obj;
|
|
206
|
+
<pre>{`${user.name}-${user.age}`}</pre>
|
|
207
|
+
</>;
|
|
189
208
|
}
|
|
190
209
|
|
|
191
210
|
const { body } = await render(Test);
|
|
@@ -193,12 +212,12 @@ describe('lazy destructuring', () => {
|
|
|
193
212
|
});
|
|
194
213
|
|
|
195
214
|
it('preserves numeric member access on lazy array value bindings', async () => {
|
|
196
|
-
|
|
197
|
-
|
|
215
|
+
function Child({ pair: &[first] }: { pair: [{ 0: string }] }) {
|
|
216
|
+
return <><pre>{first[0]}</pre></>;
|
|
198
217
|
}
|
|
199
218
|
|
|
200
|
-
|
|
201
|
-
|
|
219
|
+
function Test() {
|
|
220
|
+
return <><Child pair={[{ 0: 'x' }]} /></>;
|
|
202
221
|
}
|
|
203
222
|
|
|
204
223
|
const { body } = await render(Test);
|
|
@@ -206,10 +225,12 @@ describe('lazy destructuring', () => {
|
|
|
206
225
|
});
|
|
207
226
|
|
|
208
227
|
it('supports rest in lazy array destructuring for tracked tuples (iterable)', async () => {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
228
|
+
function Test() {
|
|
229
|
+
return <>
|
|
230
|
+
let tracked_value = track(0);
|
|
231
|
+
let &[value, ...rest] = tracked_value;
|
|
232
|
+
<pre>{`${value}-${rest.length}-${rest[0] === tracked_value}`}</pre>
|
|
233
|
+
</>;
|
|
213
234
|
}
|
|
214
235
|
|
|
215
236
|
const { body } = await render(Test);
|
|
@@ -217,10 +238,12 @@ describe('lazy destructuring', () => {
|
|
|
217
238
|
});
|
|
218
239
|
|
|
219
240
|
it('supports rest in lazy array destructuring for length-only array-like values', async () => {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
241
|
+
function Test() {
|
|
242
|
+
return <>
|
|
243
|
+
const array_like = { 0: 'x', 1: 'y', 2: 'z', length: 3 };
|
|
244
|
+
const &[first, ...rest] = array_like;
|
|
245
|
+
<pre>{`${first}-${rest.join('')}`}</pre>
|
|
246
|
+
</>;
|
|
224
247
|
}
|
|
225
248
|
|
|
226
249
|
const { body } = await render(Test);
|
|
@@ -228,16 +251,18 @@ describe('lazy destructuring', () => {
|
|
|
228
251
|
});
|
|
229
252
|
|
|
230
253
|
it('supports rest in lazy array destructuring for iterable values', async () => {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
254
|
+
function Test() {
|
|
255
|
+
return <>
|
|
256
|
+
const source = {
|
|
257
|
+
*[Symbol.iterator]() {
|
|
258
|
+
yield 'x';
|
|
259
|
+
yield 'y';
|
|
260
|
+
yield 'z';
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
const &[first, ...rest] = source;
|
|
264
|
+
<pre>{`${first}-${rest.join('')}`}</pre>
|
|
265
|
+
</>;
|
|
241
266
|
}
|
|
242
267
|
|
|
243
268
|
const { body } = await render(Test);
|
|
@@ -245,10 +270,12 @@ describe('lazy destructuring', () => {
|
|
|
245
270
|
});
|
|
246
271
|
|
|
247
272
|
it('supports standalone lazy array destructuring with track()', async () => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
273
|
+
function Test() {
|
|
274
|
+
return <>
|
|
275
|
+
let count;
|
|
276
|
+
&[count] = track(0);
|
|
277
|
+
<div>{count}</div>
|
|
278
|
+
</>;
|
|
252
279
|
}
|
|
253
280
|
|
|
254
281
|
const { body } = await render(Test);
|
|
@@ -256,15 +283,16 @@ describe('lazy destructuring', () => {
|
|
|
256
283
|
});
|
|
257
284
|
|
|
258
285
|
it('supports direct value access on tracked values during SSR', async () => {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
286
|
+
function Test() {
|
|
287
|
+
return <>
|
|
288
|
+
let tracked = track(0);
|
|
289
|
+
++tracked.value;
|
|
290
|
+
tracked.value++;
|
|
291
|
+
tracked.value = tracked.value + 1;
|
|
292
|
+
let value = tracked.value;
|
|
293
|
+
let ref = tracked;
|
|
294
|
+
<pre>{`${value}-${ref === tracked}`}</pre>
|
|
295
|
+
</>;
|
|
268
296
|
}
|
|
269
297
|
|
|
270
298
|
const { body } = await render(Test);
|
|
@@ -272,15 +300,19 @@ describe('lazy destructuring', () => {
|
|
|
272
300
|
});
|
|
273
301
|
|
|
274
302
|
it('supports lazy destructured tracked ref value access during SSR', async () => {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
303
|
+
function Child({ pair: &[value, tracked_ref] }: { pair: Tracked<number> }) {
|
|
304
|
+
return <>
|
|
305
|
+
++tracked_ref.value;
|
|
306
|
+
tracked_ref.value++;
|
|
307
|
+
<pre>{`${value}-${tracked_ref.value}`}</pre>
|
|
308
|
+
</>;
|
|
279
309
|
}
|
|
280
310
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
311
|
+
function Test() {
|
|
312
|
+
return <>
|
|
313
|
+
let tracked = track(0);
|
|
314
|
+
<Child pair={tracked} />
|
|
315
|
+
</>;
|
|
284
316
|
}
|
|
285
317
|
|
|
286
318
|
const { body } = await render(Test);
|
|
@@ -288,11 +320,13 @@ describe('lazy destructuring', () => {
|
|
|
288
320
|
});
|
|
289
321
|
|
|
290
322
|
it('supports standalone lazy object destructuring', async () => {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
323
|
+
function Test() {
|
|
324
|
+
return <>
|
|
325
|
+
let a;
|
|
326
|
+
let b;
|
|
327
|
+
&{ a, b } = { a: 10, b: 20 };
|
|
328
|
+
<pre>{`${a}-${b}`}</pre>
|
|
329
|
+
</>;
|
|
296
330
|
}
|
|
297
331
|
|
|
298
332
|
const { body } = await render(Test);
|
|
@@ -303,19 +337,23 @@ describe('lazy destructuring', () => {
|
|
|
303
337
|
it('preserves nested lazy object access inside lazy object as component params', async () => {
|
|
304
338
|
let inner_value = 7;
|
|
305
339
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
340
|
+
function Inner(&{ outer: &{ inner } }: { outer: { inner: number } }) {
|
|
341
|
+
return <>
|
|
342
|
+
const before = inner;
|
|
343
|
+
inner_value = 8;
|
|
344
|
+
<pre>{`${before}-${inner}`}</pre>
|
|
345
|
+
</>;
|
|
310
346
|
}
|
|
311
347
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
348
|
+
function Test() {
|
|
349
|
+
return <>
|
|
350
|
+
const outer = {
|
|
351
|
+
get inner() {
|
|
352
|
+
return inner_value;
|
|
353
|
+
},
|
|
354
|
+
};
|
|
355
|
+
<Inner {outer} />
|
|
356
|
+
</>;
|
|
319
357
|
}
|
|
320
358
|
|
|
321
359
|
const { body } = await render(Test);
|
|
@@ -326,18 +364,22 @@ describe('lazy destructuring', () => {
|
|
|
326
364
|
let first_value = 3;
|
|
327
365
|
let second_value = 4;
|
|
328
366
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
367
|
+
function Inner({ pair: &[first, second] }: { pair: [number, number] }) {
|
|
368
|
+
return <>
|
|
369
|
+
const before = `${first}-${second}`;
|
|
370
|
+
first_value = 5;
|
|
371
|
+
second_value = 6;
|
|
372
|
+
<pre>{`${before}-${first}-${second}`}</pre>
|
|
373
|
+
</>;
|
|
334
374
|
}
|
|
335
375
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
376
|
+
function Test() {
|
|
377
|
+
return <>
|
|
378
|
+
const pair = [0, 0] as [number, number];
|
|
379
|
+
Object.defineProperty(pair, 0, { get: () => first_value });
|
|
380
|
+
Object.defineProperty(pair, 1, { get: () => second_value });
|
|
381
|
+
<Inner {pair} />
|
|
382
|
+
</>;
|
|
341
383
|
}
|
|
342
384
|
|
|
343
385
|
const { body } = await render(Test);
|
|
@@ -345,19 +387,21 @@ describe('lazy destructuring', () => {
|
|
|
345
387
|
});
|
|
346
388
|
|
|
347
389
|
it('preserves nested lazy object access inside lazy array as function params', async () => {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
390
|
+
function Test() {
|
|
391
|
+
return <>
|
|
392
|
+
let name_value = 'Alice';
|
|
393
|
+
function getName(&[&{ name }]: [{ name: string }]) {
|
|
394
|
+
const before = name;
|
|
395
|
+
name_value = 'Bob';
|
|
396
|
+
return `${before}-${name}`;
|
|
397
|
+
}
|
|
398
|
+
const user = {
|
|
399
|
+
get name() {
|
|
400
|
+
return name_value;
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
<pre>{getName([user])}</pre>
|
|
404
|
+
</>;
|
|
361
405
|
}
|
|
362
406
|
|
|
363
407
|
const { body } = await render(Test);
|
|
@@ -365,19 +409,21 @@ describe('lazy destructuring', () => {
|
|
|
365
409
|
});
|
|
366
410
|
|
|
367
411
|
it('preserves nested lazy array access inside lazy array as function params', async () => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
412
|
+
function Test() {
|
|
413
|
+
return <>
|
|
414
|
+
let first_value = 5;
|
|
415
|
+
let second_value = 6;
|
|
416
|
+
function getValues(&[&[a, b]]: [[number, number]]) {
|
|
417
|
+
const before = `${a}-${b}`;
|
|
418
|
+
first_value = 7;
|
|
419
|
+
second_value = 8;
|
|
420
|
+
return `${before}-${a}-${b}`;
|
|
421
|
+
}
|
|
422
|
+
const pair = [0, 0] as [number, number];
|
|
423
|
+
Object.defineProperty(pair, 0, { get: () => first_value });
|
|
424
|
+
Object.defineProperty(pair, 1, { get: () => second_value });
|
|
425
|
+
<pre>{getValues([pair])}</pre>
|
|
426
|
+
</>;
|
|
381
427
|
}
|
|
382
428
|
|
|
383
429
|
const { body } = await render(Test);
|
|
@@ -387,21 +433,25 @@ describe('lazy destructuring', () => {
|
|
|
387
433
|
it('preserves three-level lazy object access as component params', async () => {
|
|
388
434
|
let c_value = 42;
|
|
389
435
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
436
|
+
function Inner(&{ a: &{ b: &{ c } } }: { a: { b: { c: number } } }) {
|
|
437
|
+
return <>
|
|
438
|
+
const before = c;
|
|
439
|
+
c_value = 43;
|
|
440
|
+
<pre>{`${before}-${c}`}</pre>
|
|
441
|
+
</>;
|
|
394
442
|
}
|
|
395
443
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
444
|
+
function Test() {
|
|
445
|
+
return <>
|
|
446
|
+
const a = {
|
|
447
|
+
b: {
|
|
448
|
+
get c() {
|
|
449
|
+
return c_value;
|
|
450
|
+
},
|
|
401
451
|
},
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
452
|
+
};
|
|
453
|
+
<Inner {a} />
|
|
454
|
+
</>;
|
|
405
455
|
}
|
|
406
456
|
|
|
407
457
|
const { body } = await render(Test);
|
|
@@ -409,19 +459,21 @@ describe('lazy destructuring', () => {
|
|
|
409
459
|
});
|
|
410
460
|
|
|
411
461
|
it('preserves nested lazy object access inside lazy object as function params', async () => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
462
|
+
function Test() {
|
|
463
|
+
return <>
|
|
464
|
+
let inner_value = 11;
|
|
465
|
+
function getValue(&{ outer: &{ inner } }: { outer: { inner: number } }) {
|
|
466
|
+
const before = inner;
|
|
467
|
+
inner_value = 12;
|
|
468
|
+
return `${before}-${inner}`;
|
|
469
|
+
}
|
|
470
|
+
const outer = {
|
|
471
|
+
get inner() {
|
|
472
|
+
return inner_value;
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
<pre>{getValue({ outer })}</pre>
|
|
476
|
+
</>;
|
|
425
477
|
}
|
|
426
478
|
|
|
427
479
|
const { body } = await render(Test);
|
|
@@ -431,14 +483,16 @@ describe('lazy destructuring', () => {
|
|
|
431
483
|
it(
|
|
432
484
|
'supports nested lazy array inside lazy object as function params with writeback',
|
|
433
485
|
async () => {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
486
|
+
function Test() {
|
|
487
|
+
return <>
|
|
488
|
+
const obj = { pair: [1, 2] as [number, number] };
|
|
489
|
+
function bump(&{ pair: &[first, second] }: { pair: [number, number] }) {
|
|
490
|
+
first = first + 10;
|
|
491
|
+
second = second + 20;
|
|
492
|
+
}
|
|
493
|
+
bump(obj);
|
|
494
|
+
<pre>{`${obj.pair[0]}-${obj.pair[1]}`}</pre>
|
|
495
|
+
</>;
|
|
442
496
|
}
|
|
443
497
|
|
|
444
498
|
const { body } = await render(Test);
|
|
@@ -447,21 +501,23 @@ describe('lazy destructuring', () => {
|
|
|
447
501
|
);
|
|
448
502
|
|
|
449
503
|
it('preserves three-level lazy object access as function params', async () => {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
504
|
+
function Test() {
|
|
505
|
+
return <>
|
|
506
|
+
let c_value = 99;
|
|
507
|
+
function getValue(&{ a: &{ b: &{ c } } }: { a: { b: { c: number } } }) {
|
|
508
|
+
const before = c;
|
|
509
|
+
c_value = 100;
|
|
510
|
+
return `${before}-${c}`;
|
|
511
|
+
}
|
|
512
|
+
const a = {
|
|
513
|
+
b: {
|
|
514
|
+
get c() {
|
|
515
|
+
return c_value;
|
|
516
|
+
},
|
|
461
517
|
},
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
|
|
518
|
+
};
|
|
519
|
+
<pre>{getValue({ a })}</pre>
|
|
520
|
+
</>;
|
|
465
521
|
}
|
|
466
522
|
|
|
467
523
|
const { body } = await render(Test);
|
|
@@ -469,19 +525,21 @@ describe('lazy destructuring', () => {
|
|
|
469
525
|
});
|
|
470
526
|
|
|
471
527
|
it('preserves nested lazy object access inside lazy object in const declaration', async () => {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
528
|
+
function Test() {
|
|
529
|
+
return <>
|
|
530
|
+
let inner_value = 5;
|
|
531
|
+
const data = {
|
|
532
|
+
outer: {
|
|
533
|
+
get inner() {
|
|
534
|
+
return inner_value;
|
|
535
|
+
},
|
|
478
536
|
},
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
537
|
+
};
|
|
538
|
+
const &{ outer: &{ inner } } = data;
|
|
539
|
+
const before = inner;
|
|
540
|
+
inner_value = 6;
|
|
541
|
+
<pre>{`${before}-${inner}`}</pre>
|
|
542
|
+
</>;
|
|
485
543
|
}
|
|
486
544
|
|
|
487
545
|
const { body } = await render(Test);
|
|
@@ -489,11 +547,13 @@ describe('lazy destructuring', () => {
|
|
|
489
547
|
});
|
|
490
548
|
|
|
491
549
|
it('supports nested lazy object inside lazy object in let with writeback', async () => {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
550
|
+
function Test() {
|
|
551
|
+
return <>
|
|
552
|
+
const data = { outer: { inner: 5 } };
|
|
553
|
+
let &{ outer: &{ inner } } = data;
|
|
554
|
+
inner = 50;
|
|
555
|
+
<pre>{data.outer.inner}</pre>
|
|
556
|
+
</>;
|
|
497
557
|
}
|
|
498
558
|
|
|
499
559
|
const { body } = await render(Test);
|
|
@@ -501,12 +561,14 @@ describe('lazy destructuring', () => {
|
|
|
501
561
|
});
|
|
502
562
|
|
|
503
563
|
it('supports nested lazy array inside lazy object in let with writeback', async () => {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
564
|
+
function Test() {
|
|
565
|
+
return <>
|
|
566
|
+
const data = { pair: [1, 2] as [number, number] };
|
|
567
|
+
let &{ pair: &[first, second] } = data;
|
|
568
|
+
first = 100;
|
|
569
|
+
second = 200;
|
|
570
|
+
<pre>{`${data.pair[0]}-${data.pair[1]}`}</pre>
|
|
571
|
+
</>;
|
|
510
572
|
}
|
|
511
573
|
|
|
512
574
|
const { body } = await render(Test);
|
|
@@ -514,11 +576,13 @@ describe('lazy destructuring', () => {
|
|
|
514
576
|
});
|
|
515
577
|
|
|
516
578
|
it('supports three-level lazy object nesting in let with writeback', async () => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
579
|
+
function Test() {
|
|
580
|
+
return <>
|
|
581
|
+
const data = { a: { b: { c: 1 } } };
|
|
582
|
+
let &{ a: &{ b: &{ c } } } = data;
|
|
583
|
+
c = 999;
|
|
584
|
+
<pre>{data.a.b.c}</pre>
|
|
585
|
+
</>;
|
|
522
586
|
}
|
|
523
587
|
|
|
524
588
|
const { body } = await render(Test);
|
|
@@ -526,12 +590,14 @@ describe('lazy destructuring', () => {
|
|
|
526
590
|
});
|
|
527
591
|
|
|
528
592
|
it('supports compound assignment on deeply nested lazy bindings', async () => {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
593
|
+
function Test() {
|
|
594
|
+
return <>
|
|
595
|
+
const data = { a: { b: { c: 5 } } };
|
|
596
|
+
let &{ a: &{ b: &{ c } } } = data;
|
|
597
|
+
c += 10;
|
|
598
|
+
c *= 2;
|
|
599
|
+
<pre>{data.a.b.c}</pre>
|
|
600
|
+
</>;
|
|
535
601
|
}
|
|
536
602
|
|
|
537
603
|
const { body } = await render(Test);
|
|
@@ -539,19 +605,21 @@ describe('lazy destructuring', () => {
|
|
|
539
605
|
});
|
|
540
606
|
|
|
541
607
|
it('preserves default values inside nested lazy destructuring', async () => {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
outer: {
|
|
546
|
-
|
|
547
|
-
|
|
608
|
+
function Test() {
|
|
609
|
+
return <>
|
|
610
|
+
let inner_value: number | undefined;
|
|
611
|
+
const data: { outer: { inner?: number } } = {
|
|
612
|
+
outer: {
|
|
613
|
+
get inner() {
|
|
614
|
+
return inner_value;
|
|
615
|
+
},
|
|
548
616
|
},
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
617
|
+
};
|
|
618
|
+
const &{ outer: &{ inner = 42 } } = data;
|
|
619
|
+
const before = inner;
|
|
620
|
+
inner_value = 43;
|
|
621
|
+
<pre>{`${before}-${inner}`}</pre>
|
|
622
|
+
</>;
|
|
555
623
|
}
|
|
556
624
|
|
|
557
625
|
const { body } = await render(Test);
|
|
@@ -559,26 +627,28 @@ describe('lazy destructuring', () => {
|
|
|
559
627
|
});
|
|
560
628
|
|
|
561
629
|
it('preserves multiple sibling nested lazy destructures', async () => {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
630
|
+
function Test() {
|
|
631
|
+
return <>
|
|
632
|
+
let x_value = 1;
|
|
633
|
+
let y_value = 2;
|
|
634
|
+
const data = {
|
|
635
|
+
a: {
|
|
636
|
+
get x() {
|
|
637
|
+
return x_value;
|
|
638
|
+
},
|
|
569
639
|
},
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
640
|
+
b: {
|
|
641
|
+
get y() {
|
|
642
|
+
return y_value;
|
|
643
|
+
},
|
|
574
644
|
},
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
645
|
+
};
|
|
646
|
+
const &{ a: &{ x }, b: &{ y } } = data;
|
|
647
|
+
const before = `${x}-${y}`;
|
|
648
|
+
x_value = 3;
|
|
649
|
+
y_value = 4;
|
|
650
|
+
<pre>{`${before}-${x}-${y}`}</pre>
|
|
651
|
+
</>;
|
|
582
652
|
}
|
|
583
653
|
|
|
584
654
|
const { body } = await render(Test);
|
|
@@ -586,12 +656,14 @@ describe('lazy destructuring', () => {
|
|
|
586
656
|
});
|
|
587
657
|
|
|
588
658
|
it('supports multiple sibling nested lazy destructures with writeback', async () => {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
659
|
+
function Test() {
|
|
660
|
+
return <>
|
|
661
|
+
const data = { a: { x: 1 }, b: { y: 2 } };
|
|
662
|
+
let &{ a: &{ x }, b: &{ y } } = data;
|
|
663
|
+
x = 11;
|
|
664
|
+
y = 22;
|
|
665
|
+
<pre>{`${data.a.x}-${data.b.y}`}</pre>
|
|
666
|
+
</>;
|
|
595
667
|
}
|
|
596
668
|
|
|
597
669
|
const { body } = await render(Test);
|