Hello)']);
clearLog();
render(
, scratch);
@@ -369,7 +361,6 @@ describe('Fragment', () => {
expect(scratch.innerHTML).to.equal('
Hello
');
expectDomLogToBe([
'
Hello.remove()',
- '
.appendChild(#text)',
// Re-append the Stateful DOM since it has been re-parented
'
.appendChild(
Hello)'
]);
@@ -395,22 +386,14 @@ describe('Fragment', () => {
expect(ops).to.deep.equal([]);
expect(scratch.innerHTML).to.equal('
Hello
');
- expectDomLogToBe([
- '
Hello.remove()',
- '
.appendChild(#text)',
- '
.appendChild(
Hello)'
- ]);
+ expectDomLogToBe(['
Hello.remove()', '
.appendChild(
Hello)']);
clearLog();
render(
, scratch);
expect(ops).to.deep.equal([]);
expect(scratch.innerHTML).to.equal('
Hello
');
- expectDomLogToBe([
- '
Hello.remove()',
- '
.appendChild(#text)',
- '
.appendChild(
Hello)'
- ]);
+ expectDomLogToBe(['
Hello.remove()', '
.appendChild(
Hello)']);
});
it('should just render children for fragments', () => {
@@ -791,9 +774,9 @@ describe('Fragment', () => {
expect(scratch.innerHTML).to.equal(htmlForFalse);
expectDomLogToBe(
[
- '
barHellobeep.insertBefore(
bar,
beep)',
- '
Hellobarbeep.appendChild(
Hello)',
- '
barbeepHello.appendChild(
bar)'
+ '
fooHellobeep.insertBefore(
beep,
foo)',
+ '
beepbarHello.appendChild(
bar)',
+ '
beepHellobar.insertBefore(
Hello,
bar)'
],
'rendering true to false'
);
@@ -805,8 +788,8 @@ describe('Fragment', () => {
expect(scratch.innerHTML).to.equal(htmlForTrue);
expectDomLogToBe(
[
- '
beepHellofoo.appendChild(
Hello)',
- '
boopfooHello.appendChild(
boop)'
+ '
beepHellofoo.insertBefore(
foo,
beep)',
+ '
foobeepHello.insertBefore(
Hello,
beep)'
],
'rendering false to true'
);
@@ -845,9 +828,7 @@ describe('Fragment', () => {
expectDomLogToBe([
'
1.remove()',
'Hello.remove()',
- '
.appendChild(#text)',
'2.insertBefore(
1, 2)',
- '.appendChild(#text)',
'
12.insertBefore(
Hello,
2)'
]);
@@ -859,9 +840,7 @@ describe('Fragment', () => {
expectDomLogToBe([
'1.remove()',
'Hello.remove()',
- '
.appendChild(#text)',
'2.insertBefore(
1, 2)',
- '.appendChild(#text)',
'
12.insertBefore(
Hello,
2)'
]);
});
@@ -1234,13 +1213,9 @@ describe('Fragment', () => {
expect(scratch.innerHTML).to.equal(html, 'initial render of true');
expectDomLogToBe(
[
- '.appendChild(#text)',
'.appendChild(- 0)',
- '
- .appendChild(#text)',
'
0.appendChild(- 1)',
- '
- .appendChild(#text)',
'
01.appendChild(- 2)',
- '
- .appendChild(#text)',
'
012.appendChild(- 3)',
'
.appendChild(
0123)'
],
@@ -1282,15 +1257,10 @@ describe('Fragment', () => {
expect(scratch.innerHTML).to.equal(htmlForTrue, 'initial render of true');
expectDomLogToBe(
[
- '- .appendChild(#text)',
'
.appendChild(- 0)',
- '
- .appendChild(#text)',
'
0.appendChild(- 1)',
- '
- .appendChild(#text)',
'
01.appendChild(- 2)',
- '
- .appendChild(#text)',
'
012.appendChild(- 3)',
- '
- .appendChild(#text)',
'
0123.appendChild(- 4)',
'
.appendChild(
01234)'
],
@@ -1316,15 +1286,14 @@ describe('Fragment', () => {
);
expectDomLogToBe(
[
- '- .appendChild(#text)',
'
034.insertBefore(- 1,
- 3)',
- '
- .appendChild(#text)',
'
0134.insertBefore(- 2,
- 3)'
],
'rendering from false to true'
);
});
+ // TODO
it('should support moving Fragments between beginning and end', () => {
const Foo = ({ condition }) => (
@@ -1382,7 +1351,9 @@ describe('Fragment', () => {
);
expectDomLogToBe([
'012345.insertBefore(- 4,
- 0)',
- '
401235.insertBefore(- 5,
- 0)'
+ '
401235.insertBefore(- 5,
- 0)',
+ '
450123.insertBefore(- 4,
- 0)',
+ '
540123.insertBefore(- 5,
- 0)'
]);
clearLog();
@@ -1392,8 +1363,10 @@ describe('Fragment', () => {
'rendering from false to true'
);
expectDomLogToBe([
- '
450123.appendChild(- 4)',
- '
501234.appendChild(- 5)'
+ '
450123.insertBefore(- 0,
- 4)',
+ '
045123.insertBefore(- 1,
- 4)',
+ '
014523.insertBefore(- 2,
- 4)',
+ '
012453.insertBefore(- 3,
- 4)'
]);
});
@@ -1436,9 +1409,7 @@ describe('Fragment', () => {
'
- 0.remove()',
'
- 1.remove()',
// Mount 3 & 4
- '
- .appendChild(#text)',
'
22.appendChild(- 3)',
- '
- .appendChild(#text)',
'
223.appendChild(- 4)'
]);
@@ -1453,9 +1424,7 @@ describe('Fragment', () => {
'
- 3.remove()',
'
- 4.remove()',
// Insert 0 and 1
- '
- .appendChild(#text)',
'
22.insertBefore(- 0,
- 2)',
- '
- .appendChild(#text)',
'
022.insertBefore(- 1,
- 2)'
]);
});
@@ -1507,9 +1476,7 @@ describe('Fragment', () => {
'
- 0.remove()',
'
- 1.remove()',
// Mount 4 & 5
- '
- .appendChild(#text)',
'
23.appendChild(- 4)',
- '
- .appendChild(#text)',
'
234.appendChild(- 5)'
]);
@@ -1524,9 +1491,7 @@ describe('Fragment', () => {
'
- 4.remove()',
'
- 5.remove()',
// Insert 0 and 1 back into the DOM
- '
- .appendChild(#text)',
'
23.insertBefore(- 0,
- 2)',
- '
- .appendChild(#text)',
'
023.insertBefore(- 1,
- 2)'
]);
});
@@ -1582,9 +1547,9 @@ describe('Fragment', () => {
expectDomLogToBe(
[
'
boop.remove()',
- '
barHellobeep.insertBefore(
bar,
beep)',
- '
Hellobarbeep.appendChild(
Hello)',
- '
barbeepHello.appendChild(
bar)'
+ '
fooHellobeep.insertBefore(
beep,
foo)',
+ '
beepbarHello.appendChild(
bar)',
+ '
beepHellobar.insertBefore(
Hello,
bar)'
],
'rendering from true to false'
);
@@ -1599,9 +1564,8 @@ describe('Fragment', () => {
);
expectDomLogToBe(
[
- '
beepHellofoo.appendChild(
Hello)',
- '
boopfooHello.appendChild(
boop)',
- '
.appendChild(#text)',
+ '
beepHellofoo.insertBefore(
foo,
beep)',
+ '
foobeepHello.insertBefore(
Hello,
beep)',
'
fooHelloboop.appendChild(
boop)'
],
'rendering from false to true'
@@ -1668,9 +1632,11 @@ describe('Fragment', () => {
);
expectDomLogToBe(
[
- '
barHellobeepbeepbeep.insertBefore(
bar,
beep)',
- '
Hellobarbeepbeepbeep.appendChild(
Hello)',
- '
barbeepbeepbeepHello.appendChild(
bar)'
+ '
fooHellobeepboopboop.insertBefore(
beep,
foo)',
+ '
beepfooHellobeepboop.insertBefore(
beep,
foo)',
+ '
beepbeepfooHellobeep.insertBefore(
beep,
foo)',
+ '
beepbeepbeepbarHello.appendChild(
bar)',
+ '
beepbeepbeepHellobar.insertBefore(
Hello,
bar)'
],
'rendering from true to false'
);
@@ -1685,9 +1651,10 @@ describe('Fragment', () => {
);
expectDomLogToBe(
[
- '
beepbeepbeepHellofoo.appendChild(
Hello)',
- '
beepbeepbeepfooHello.insertBefore(
foo,
beep)',
- '
foobeepbeepbeepHello.insertBefore(
Hello,
beep)'
+ '
beepbeepbeepHellofoo.insertBefore(
foo,
beep)',
+ '
foobeepbeepbeepHello.insertBefore(
Hello,
beep)',
+ '
fooHellobeepbeepbeep.insertBefore(
foo,
beep)',
+ '
Hellofoobeepbeepbeep.insertBefore(
Hello,
beep)'
],
'rendering from false to true'
);
@@ -1778,9 +1745,7 @@ describe('Fragment', () => {
[
'
2.remove()',
'#text.remove()',
- '
.appendChild(#text)',
'
.appendChild(
3)',
- '
.appendChild(#text)',
'
3.appendChild(
4)'
],
'rendering from true to false'
@@ -1791,13 +1756,7 @@ describe('Fragment', () => {
expect(scratch.innerHTML).to.equal(htmlForTrue);
expectDomLogToBe(
- [
- '
3.remove()',
- '
4.remove()',
- '
.appendChild(#text)',
- '
.appendChild(#text)',
- '
1.appendChild(
2)'
- ],
+ ['
1.appendChild(
2)'],
'rendering from false to true'
);
});
@@ -1851,17 +1810,11 @@ describe('Fragment', () => {
expect(scratch.innerHTML).to.equal(htmlForTrue, 'initial render of true');
expectDomLogToBe(
[
- '
- .appendChild(#text)',
'
.appendChild(- 0)',
- '
- .appendChild(#text)',
'
0.appendChild(- 1)',
- '
- .appendChild(#text)',
'
01.appendChild(- 2)',
- '
- .appendChild(#text)',
'
012.appendChild(- 3)',
- '
- .appendChild(#text)',
'
0123.appendChild(- 4)',
- '
- .appendChild(#text)',
'
01234.appendChild(- 5)',
'
.appendChild(
012345)'
],
@@ -1887,9 +1840,7 @@ describe('Fragment', () => {
);
expectDomLogToBe(
[
- '- .appendChild(#text)',
'
0145.insertBefore(- 2,
- 4)',
- '
- .appendChild(#text)',
'
01245.insertBefore(- 3,
- 4)'
],
'rendering from false to true'
@@ -2013,11 +1964,8 @@ describe('Fragment', () => {
expect(scratch.textContent).to.equal('ABC');
expectDomLogToBe([
- '
.appendChild(#text)',
'