@spectrum-web-components/shared 1.9.0 → 1.9.1-nightly.20251028214328
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 +636 -0
- package/README.md +161 -42
- package/package.json +111 -111
- package/src/get-label-from-slot.d.ts +1 -1
- package/src/get-label-from-slot.dev.js +1 -15
- package/src/get-label-from-slot.dev.js.map +2 -2
- package/src/get-label-from-slot.js +1 -1
- package/src/get-label-from-slot.js.map +3 -3
- package/src/observe-slot-presence.d.ts +1 -12
- package/src/observe-slot-presence.dev.js +1 -61
- package/src/observe-slot-presence.dev.js.map +2 -2
- package/src/observe-slot-presence.js +1 -1
- package/src/observe-slot-presence.js.map +3 -3
- package/src/observe-slot-text.d.ts +1 -11
- package/src/observe-slot-text.dev.js +1 -93
- package/src/observe-slot-text.dev.js.map +2 -2
- package/src/observe-slot-text.js +1 -1
- package/src/observe-slot-text.js.map +3 -3
- package/test/focusable.test.js +23 -0
- package/test/focusable.test.js.map +7 -0
- package/test/observe-slot-presence.test.js +28 -0
- package/test/observe-slot-presence.test.js.map +7 -0
- package/test/observe-slot-text.test.js +25 -0
- package/test/observe-slot-text.test.js.map +7 -0
- package/test/random-id.test.js +25 -0
- package/test/random-id.test.js.map +7 -0
- package/test/reparent-children.test.js +254 -0
- package/test/reparent-children.test.js.map +7 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { expect, fixture, html } from "@open-wc/testing";
|
|
3
|
+
import { reparentChildren } from "@spectrum-web-components/shared/src/reparent-children.js";
|
|
4
|
+
describe("Reparent Children", () => {
|
|
5
|
+
it("reparents and returns a single child", async () => {
|
|
6
|
+
const context = await fixture(html`
|
|
7
|
+
<div>
|
|
8
|
+
<div class="source">
|
|
9
|
+
<div class="child"></div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="destination"></div>
|
|
12
|
+
</div>
|
|
13
|
+
`);
|
|
14
|
+
const source = context.querySelector(".source");
|
|
15
|
+
const child = context.querySelector(".child");
|
|
16
|
+
const destination = context.querySelector(
|
|
17
|
+
".destination"
|
|
18
|
+
);
|
|
19
|
+
expect(source.children.length).to.equal(1);
|
|
20
|
+
expect(destination.children.length).to.equal(0);
|
|
21
|
+
const restore = reparentChildren([child], destination);
|
|
22
|
+
expect(source.children.length).to.equal(0);
|
|
23
|
+
expect(destination.children.length).to.equal(1);
|
|
24
|
+
restore();
|
|
25
|
+
expect(source.children.length).to.equal(1);
|
|
26
|
+
expect(destination.children.length).to.equal(0);
|
|
27
|
+
});
|
|
28
|
+
it("early exits no children", async () => {
|
|
29
|
+
const context = await fixture(html`
|
|
30
|
+
<div>
|
|
31
|
+
<div class="source"></div>
|
|
32
|
+
<div class="destination"></div>
|
|
33
|
+
</div>
|
|
34
|
+
`);
|
|
35
|
+
const source = context.querySelector(".source");
|
|
36
|
+
const children = [...source.children];
|
|
37
|
+
const destination = context.querySelector(
|
|
38
|
+
".destination"
|
|
39
|
+
);
|
|
40
|
+
expect(source.children.length).to.equal(0);
|
|
41
|
+
expect(destination.children.length).to.equal(0);
|
|
42
|
+
const restore = reparentChildren(children, destination);
|
|
43
|
+
expect(source.children.length).to.equal(0);
|
|
44
|
+
expect(destination.children.length).to.equal(0);
|
|
45
|
+
restore();
|
|
46
|
+
expect(source.children.length).to.equal(0);
|
|
47
|
+
expect(destination.children.length).to.equal(0);
|
|
48
|
+
});
|
|
49
|
+
it("reparents and returns multiple child", async () => {
|
|
50
|
+
const context = await fixture(html`
|
|
51
|
+
<div>
|
|
52
|
+
<div class="source">
|
|
53
|
+
<div class="child"></div>
|
|
54
|
+
<div class="child"></div>
|
|
55
|
+
<div class="child"></div>
|
|
56
|
+
<div class="child"></div>
|
|
57
|
+
<div class="child"></div>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="destination"></div>
|
|
60
|
+
</div>
|
|
61
|
+
`);
|
|
62
|
+
const source = context.querySelector(".source");
|
|
63
|
+
const { children } = source;
|
|
64
|
+
const destination = context.querySelector(
|
|
65
|
+
".destination"
|
|
66
|
+
);
|
|
67
|
+
expect(source.children.length).to.equal(5);
|
|
68
|
+
expect(destination.children.length).to.equal(0);
|
|
69
|
+
const restore = reparentChildren([...children], destination);
|
|
70
|
+
expect(source.children.length).to.equal(0);
|
|
71
|
+
expect(destination.children.length).to.equal(5);
|
|
72
|
+
restore();
|
|
73
|
+
expect(source.children.length).to.equal(5);
|
|
74
|
+
expect(destination.children.length).to.equal(0);
|
|
75
|
+
});
|
|
76
|
+
it("augments the child via a callback", async () => {
|
|
77
|
+
const context = await fixture(html`
|
|
78
|
+
<div>
|
|
79
|
+
<div class="source">
|
|
80
|
+
<div class="child" slot="slot"></div>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="destination"></div>
|
|
83
|
+
</div>
|
|
84
|
+
`);
|
|
85
|
+
const child = context.querySelector(".child");
|
|
86
|
+
const destination = context.querySelector(
|
|
87
|
+
".destination"
|
|
88
|
+
);
|
|
89
|
+
expect(child.getAttribute("slot")).to.equal("slot");
|
|
90
|
+
const restore = reparentChildren([child], destination, {
|
|
91
|
+
position: "beforeend",
|
|
92
|
+
prepareCallback: (el) => {
|
|
93
|
+
const slotName = el.slot;
|
|
94
|
+
el.removeAttribute("slot");
|
|
95
|
+
return (el2) => {
|
|
96
|
+
el2.slot = slotName;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
expect(child.hasAttribute("slot")).to.be.false;
|
|
101
|
+
restore();
|
|
102
|
+
expect(child.getAttribute("slot")).to.equal("slot");
|
|
103
|
+
});
|
|
104
|
+
it("beforeend - reparents and returns multiple children", async () => {
|
|
105
|
+
var _a, _b, _c, _d;
|
|
106
|
+
const context = await fixture(html`
|
|
107
|
+
<div>
|
|
108
|
+
<div class="source">
|
|
109
|
+
<div class="child">1</div>
|
|
110
|
+
<div class="child">2</div>
|
|
111
|
+
<div class="child">3</div>
|
|
112
|
+
<div class="child">4</div>
|
|
113
|
+
<div class="child">5</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="destination">
|
|
116
|
+
<div class="marker"></div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
`);
|
|
120
|
+
const source = context.querySelector(".source");
|
|
121
|
+
const { children } = source;
|
|
122
|
+
const destination = context.querySelector(
|
|
123
|
+
".destination"
|
|
124
|
+
);
|
|
125
|
+
expect(source.children.length).to.equal(5);
|
|
126
|
+
expect(destination.children.length).to.equal(1);
|
|
127
|
+
const restore = reparentChildren([...children], destination, {
|
|
128
|
+
position: "beforeend"
|
|
129
|
+
});
|
|
130
|
+
expect(source.children.length).to.equal(0);
|
|
131
|
+
expect(destination.children.length).to.equal(5 + 1);
|
|
132
|
+
const marker = context.querySelector(".marker");
|
|
133
|
+
expect(marker.previousElementSibling).to.be.null;
|
|
134
|
+
expect((_a = marker.nextElementSibling) == null ? void 0 : _a.textContent).to.equal("1");
|
|
135
|
+
expect((_b = destination.lastElementChild) == null ? void 0 : _b.textContent).to.equal("5");
|
|
136
|
+
restore();
|
|
137
|
+
expect(source.children.length).to.equal(5);
|
|
138
|
+
expect(destination.children.length).to.equal(1);
|
|
139
|
+
expect((_c = source.firstElementChild) == null ? void 0 : _c.textContent).to.equal("1");
|
|
140
|
+
expect((_d = source.lastElementChild) == null ? void 0 : _d.textContent).to.equal("5");
|
|
141
|
+
});
|
|
142
|
+
it("afterbegin - reparents and returns multiple children", async () => {
|
|
143
|
+
var _a, _b, _c, _d;
|
|
144
|
+
const context = await fixture(html`
|
|
145
|
+
<div>
|
|
146
|
+
<div class="source">
|
|
147
|
+
<div class="child">1</div>
|
|
148
|
+
<div class="child">2</div>
|
|
149
|
+
<div class="child">3</div>
|
|
150
|
+
<div class="child">4</div>
|
|
151
|
+
<div class="child">5</div>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="destination">
|
|
154
|
+
<div class="marker"></div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
`);
|
|
158
|
+
const source = context.querySelector(".source");
|
|
159
|
+
const { children } = source;
|
|
160
|
+
const destination = context.querySelector(
|
|
161
|
+
".destination"
|
|
162
|
+
);
|
|
163
|
+
expect(source.children.length).to.equal(5);
|
|
164
|
+
expect(destination.children.length).to.equal(1);
|
|
165
|
+
const restore = reparentChildren([...children], destination, {
|
|
166
|
+
position: "afterbegin"
|
|
167
|
+
});
|
|
168
|
+
expect(source.children.length).to.equal(0);
|
|
169
|
+
expect(destination.children.length).to.equal(5 + 1);
|
|
170
|
+
const marker = context.querySelector(".marker");
|
|
171
|
+
expect(marker.nextElementSibling).to.be.null;
|
|
172
|
+
expect((_a = marker.previousElementSibling) == null ? void 0 : _a.textContent).to.equal("5");
|
|
173
|
+
expect((_b = destination.firstElementChild) == null ? void 0 : _b.textContent).to.equal("1");
|
|
174
|
+
restore();
|
|
175
|
+
expect(source.children.length).to.equal(5);
|
|
176
|
+
expect(destination.children.length).to.equal(1);
|
|
177
|
+
expect((_c = source.firstElementChild) == null ? void 0 : _c.textContent).to.equal("1");
|
|
178
|
+
expect((_d = source.lastElementChild) == null ? void 0 : _d.textContent).to.equal("5");
|
|
179
|
+
});
|
|
180
|
+
it("beforebegin - reparents and returns multiple children", async () => {
|
|
181
|
+
var _a, _b, _c, _d;
|
|
182
|
+
const context = await fixture(html`
|
|
183
|
+
<div>
|
|
184
|
+
<div class="source">
|
|
185
|
+
<div class="child">1</div>
|
|
186
|
+
<div class="child">2</div>
|
|
187
|
+
<div class="child">3</div>
|
|
188
|
+
<div class="child">4</div>
|
|
189
|
+
<div class="child">5</div>
|
|
190
|
+
</div>
|
|
191
|
+
<div class="marker"></div>
|
|
192
|
+
<div class="destination"></div>
|
|
193
|
+
</div>
|
|
194
|
+
`);
|
|
195
|
+
const source = context.querySelector(".source");
|
|
196
|
+
const { children } = source;
|
|
197
|
+
const destination = context.querySelector(
|
|
198
|
+
".destination"
|
|
199
|
+
);
|
|
200
|
+
expect(source.children.length).to.equal(5);
|
|
201
|
+
const restore = reparentChildren([...children], destination, {
|
|
202
|
+
position: "beforebegin"
|
|
203
|
+
});
|
|
204
|
+
expect(source.children.length).to.equal(0);
|
|
205
|
+
expect(destination.children.length).to.equal(0);
|
|
206
|
+
const marker = context.querySelector(".marker");
|
|
207
|
+
expect(marker.previousElementSibling).to.not.be.null;
|
|
208
|
+
expect((_a = marker.nextElementSibling) == null ? void 0 : _a.textContent).to.equal("1");
|
|
209
|
+
expect((_b = destination.previousElementSibling) == null ? void 0 : _b.textContent).to.equal("5");
|
|
210
|
+
restore();
|
|
211
|
+
expect(source.children.length).to.equal(5);
|
|
212
|
+
expect(marker.nextElementSibling).to.equal(destination);
|
|
213
|
+
expect((_c = source.firstElementChild) == null ? void 0 : _c.textContent).to.equal("1");
|
|
214
|
+
expect((_d = source.lastElementChild) == null ? void 0 : _d.textContent).to.equal("5");
|
|
215
|
+
});
|
|
216
|
+
it("afterend - reparents and returns multiple children", async () => {
|
|
217
|
+
var _a, _b, _c, _d;
|
|
218
|
+
const context = await fixture(html`
|
|
219
|
+
<div>
|
|
220
|
+
<div class="source">
|
|
221
|
+
<div class="child">1</div>
|
|
222
|
+
<div class="child">2</div>
|
|
223
|
+
<div class="child">3</div>
|
|
224
|
+
<div class="child">4</div>
|
|
225
|
+
<div class="child">5</div>
|
|
226
|
+
</div>
|
|
227
|
+
<div class="destination"></div>
|
|
228
|
+
<div class="marker"></div>
|
|
229
|
+
</div>
|
|
230
|
+
`);
|
|
231
|
+
const source = context.querySelector(".source");
|
|
232
|
+
const { children } = source;
|
|
233
|
+
const destination = context.querySelector(
|
|
234
|
+
".destination"
|
|
235
|
+
);
|
|
236
|
+
expect(source.children.length).to.equal(5);
|
|
237
|
+
const marker = context.querySelector(".marker");
|
|
238
|
+
expect(marker.previousElementSibling).to.equal(destination);
|
|
239
|
+
expect(marker.nextElementSibling).to.be.null;
|
|
240
|
+
const restore = reparentChildren([...children], destination, {
|
|
241
|
+
position: "afterend"
|
|
242
|
+
});
|
|
243
|
+
expect(source.children.length).to.equal(0);
|
|
244
|
+
expect(destination.children.length).to.equal(0);
|
|
245
|
+
expect((_a = destination.nextElementSibling) == null ? void 0 : _a.textContent).to.equal("1");
|
|
246
|
+
expect((_b = marker.previousElementSibling) == null ? void 0 : _b.textContent).to.equal("5");
|
|
247
|
+
restore();
|
|
248
|
+
expect(source.children.length).to.equal(5);
|
|
249
|
+
expect(marker.previousElementSibling).to.equal(destination);
|
|
250
|
+
expect((_c = source.firstElementChild) == null ? void 0 : _c.textContent).to.equal("1");
|
|
251
|
+
expect((_d = source.lastElementChild) == null ? void 0 : _d.textContent).to.equal("5");
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
//# sourceMappingURL=reparent-children.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["reparent-children.test.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { expect, fixture, html } from '@open-wc/testing';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\n\ndescribe('Reparent Children', () => {\n it('reparents and returns a single child', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\">\n <div class=\"child\"></div>\n </div>\n <div class=\"destination\"></div>\n </div>\n `);\n\n const source = context.querySelector('.source') as HTMLDivElement;\n const child = context.querySelector('.child') as HTMLDivElement;\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(source.children.length).to.equal(1);\n expect(destination.children.length).to.equal(0);\n const restore = reparentChildren([child], destination);\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(1);\n\n restore();\n expect(source.children.length).to.equal(1);\n expect(destination.children.length).to.equal(0);\n });\n\n it('early exits no children', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\"></div>\n <div class=\"destination\"></div>\n </div>\n `);\n\n const source = context.querySelector('.source') as HTMLDivElement;\n const children = [...source.children] as HTMLDivElement[];\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(0);\n const restore = reparentChildren(children, destination);\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(0);\n\n restore();\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(0);\n });\n\n it('reparents and returns multiple child', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\">\n <div class=\"child\"></div>\n <div class=\"child\"></div>\n <div class=\"child\"></div>\n <div class=\"child\"></div>\n <div class=\"child\"></div>\n </div>\n <div class=\"destination\"></div>\n </div>\n `);\n\n const source = context.querySelector('.source') as HTMLDivElement;\n const { children } = source;\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(source.children.length).to.equal(5);\n expect(destination.children.length).to.equal(0);\n const restore = reparentChildren([...children], destination);\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(5);\n\n restore();\n expect(source.children.length).to.equal(5);\n expect(destination.children.length).to.equal(0);\n });\n\n it('augments the child via a callback', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\">\n <div class=\"child\" slot=\"slot\"></div>\n </div>\n <div class=\"destination\"></div>\n </div>\n `);\n\n const child = context.querySelector('.child') as HTMLDivElement;\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(child.getAttribute('slot')).to.equal('slot');\n const restore = reparentChildren([child], destination, {\n position: 'beforeend',\n prepareCallback: (el: Element) => {\n const slotName = el.slot;\n el.removeAttribute('slot');\n return (el: Element) => {\n el.slot = slotName;\n };\n },\n });\n\n expect(child.hasAttribute('slot')).to.be.false;\n\n restore();\n expect(child.getAttribute('slot')).to.equal('slot');\n });\n\n it('beforeend - reparents and returns multiple children', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\">\n <div class=\"child\">1</div>\n <div class=\"child\">2</div>\n <div class=\"child\">3</div>\n <div class=\"child\">4</div>\n <div class=\"child\">5</div>\n </div>\n <div class=\"destination\">\n <div class=\"marker\"></div>\n </div>\n </div>\n `);\n\n const source = context.querySelector('.source') as HTMLDivElement;\n const { children } = source;\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(source.children.length).to.equal(5);\n expect(destination.children.length).to.equal(1);\n const restore = reparentChildren([...children], destination, {\n position: 'beforeend',\n });\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(5 + 1);\n\n const marker = context.querySelector('.marker') as HTMLDivElement;\n expect(marker.previousElementSibling).to.be.null;\n expect(marker.nextElementSibling?.textContent).to.equal('1');\n expect(destination.lastElementChild?.textContent).to.equal('5');\n\n restore();\n expect(source.children.length).to.equal(5);\n expect(destination.children.length).to.equal(1);\n\n expect(source.firstElementChild?.textContent).to.equal('1');\n expect(source.lastElementChild?.textContent).to.equal('5');\n });\n\n it('afterbegin - reparents and returns multiple children', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\">\n <div class=\"child\">1</div>\n <div class=\"child\">2</div>\n <div class=\"child\">3</div>\n <div class=\"child\">4</div>\n <div class=\"child\">5</div>\n </div>\n <div class=\"destination\">\n <div class=\"marker\"></div>\n </div>\n </div>\n `);\n\n const source = context.querySelector('.source') as HTMLDivElement;\n const { children } = source;\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(source.children.length).to.equal(5);\n expect(destination.children.length).to.equal(1);\n const restore = reparentChildren([...children], destination, {\n position: 'afterbegin',\n });\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(5 + 1);\n\n const marker = context.querySelector('.marker') as HTMLDivElement;\n expect(marker.nextElementSibling).to.be.null;\n expect(marker.previousElementSibling?.textContent).to.equal('5');\n expect(destination.firstElementChild?.textContent).to.equal('1');\n\n restore();\n expect(source.children.length).to.equal(5);\n expect(destination.children.length).to.equal(1);\n\n expect(source.firstElementChild?.textContent).to.equal('1');\n expect(source.lastElementChild?.textContent).to.equal('5');\n });\n\n it('beforebegin - reparents and returns multiple children', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\">\n <div class=\"child\">1</div>\n <div class=\"child\">2</div>\n <div class=\"child\">3</div>\n <div class=\"child\">4</div>\n <div class=\"child\">5</div>\n </div>\n <div class=\"marker\"></div>\n <div class=\"destination\"></div>\n </div>\n `);\n\n const source = context.querySelector('.source') as HTMLDivElement;\n const { children } = source;\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(source.children.length).to.equal(5);\n const restore = reparentChildren([...children], destination, {\n position: 'beforebegin',\n });\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(0);\n\n const marker = context.querySelector('.marker') as HTMLDivElement;\n expect(marker.previousElementSibling).to.not.be.null;\n expect(marker.nextElementSibling?.textContent).to.equal('1');\n expect(destination.previousElementSibling?.textContent).to.equal('5');\n\n restore();\n expect(source.children.length).to.equal(5);\n expect(marker.nextElementSibling).to.equal(destination);\n\n expect(source.firstElementChild?.textContent).to.equal('1');\n expect(source.lastElementChild?.textContent).to.equal('5');\n });\n\n it('afterend - reparents and returns multiple children', async () => {\n const context = await fixture<HTMLDivElement>(html`\n <div>\n <div class=\"source\">\n <div class=\"child\">1</div>\n <div class=\"child\">2</div>\n <div class=\"child\">3</div>\n <div class=\"child\">4</div>\n <div class=\"child\">5</div>\n </div>\n <div class=\"destination\"></div>\n <div class=\"marker\"></div>\n </div>\n `);\n\n const source = context.querySelector('.source') as HTMLDivElement;\n const { children } = source;\n const destination = context.querySelector(\n '.destination'\n ) as HTMLDivElement;\n\n expect(source.children.length).to.equal(5);\n\n const marker = context.querySelector('.marker') as HTMLDivElement;\n expect(marker.previousElementSibling).to.equal(destination);\n expect(marker.nextElementSibling).to.be.null;\n\n const restore = reparentChildren([...children], destination, {\n position: 'afterend',\n });\n\n expect(source.children.length).to.equal(0);\n expect(destination.children.length).to.equal(0);\n\n expect(destination.nextElementSibling?.textContent).to.equal('1');\n expect(marker.previousElementSibling?.textContent).to.equal('5');\n\n restore();\n expect(source.children.length).to.equal(5);\n expect(marker.previousElementSibling).to.equal(destination);\n\n expect(source.firstElementChild?.textContent).to.equal('1');\n expect(source.lastElementChild?.textContent).to.equal('5');\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,QAAQ,SAAS,YAAY;AACtC,SAAS,wBAAwB;AAEjC,SAAS,qBAAqB,MAAM;AAChC,KAAG,wCAAwC,YAAY;AACnD,UAAM,UAAU,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAO7C;AAED,UAAM,SAAS,QAAQ,cAAc,SAAS;AAC9C,UAAM,QAAQ,QAAQ,cAAc,QAAQ;AAC5C,UAAM,cAAc,QAAQ;AAAA,MACxB;AAAA,IACJ;AAEA,WAAO,OAAO,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;AACzC,WAAO,YAAY,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;AAC9C,UAAM,UAAU,iBAAiB,CAAC,KAAK,GAAG,WAAW;AAErD,WAAO,OAAO,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;AACzC,WAAO,YAAY,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;AAE9C,YAAQ;AACR,WAAO,OAAO,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;AACzC,WAAO,YAAY,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;AAAA,EAClD,CAAC;AAED,KAAG,2BAA2B,YAAY;AACtC,UAAM,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