1 write to newTree
Microsoft.AspNetCore.Components.Tests (1)
RenderTreeDiffBuilderTest.cs (1)
22
newTree
= new RenderTreeBuilder();
336 references to newTree
Microsoft.AspNetCore.Components.Tests (336)
RenderTreeDiffBuilderTest.cs (336)
29
((IDisposable)
newTree
).Dispose();
39
appendFragment(
newTree
);
76
newTree
.AddContent(0, "text0");
77
newTree
.AddContent(1, "text1");
78
newTree
.AddContent(2, "text2");
100
newTree
.AddContent(0, "text0");
101
newTree
.AddContent(2, "text2");
120
newTree
.OpenElement(0, "container");
121
newTree
.SetKey("new key");
122
newTree
.AddContent(1, "Inserted");
123
newTree
.CloseElement();
125
newTree
.OpenElement(0, "container");
126
newTree
.SetKey("retained key");
127
newTree
.AddContent(1, "Existing");
128
newTree
.CloseElement();
160
newTree
.OpenElement(0, "container");
161
newTree
.SetKey("will retain");
162
newTree
.AddContent(1, "Second");
163
newTree
.CloseElement();
185
newTree
.OpenElement(0, "container");
186
newTree
.SetKey("new key");
187
newTree
.AddContent(1, "Inserted");
188
newTree
.CloseElement();
219
newTree
.OpenComponent<CaptureSetParametersComponent>(0);
220
newTree
.SetKey("new key");
221
newTree
.AddComponentParameter(1, "ParamName", "New component param value");
222
newTree
.CloseComponent();
224
newTree
.OpenComponent<CaptureSetParametersComponent>(0);
225
newTree
.SetKey("retained key");
226
newTree
.AddComponentParameter(1, "ParamName", "Param new value");
227
newTree
.CloseComponent();
236
var newComponents = GetComponents<CaptureSetParametersComponent>(
newTree
);
267
newTree
.OpenComponent<FakeComponent>(0);
268
newTree
.SetKey("will retain");
269
newTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Retained param value");
270
newTree
.CloseComponent();
278
var newComponent = GetComponents(
newTree
).Single();
304
newTree
.OpenComponent<FakeComponent>(2);
305
newTree
.AddComponentParameter(3, nameof(FakeComponent.StringProperty), "Retained param value");
306
newTree
.CloseComponent();
310
var newComponent = GetComponents(
newTree
).Single();
330
newTree
.OpenComponent<FakeComponent>(0);
331
newTree
.SetKey("will insert");
332
newTree
.CloseComponent();
334
newTree
.OpenComponent<FakeComponent>(1);
335
newTree
.CloseComponent();
339
var newComponents = GetComponents(
newTree
);
361
newTree
.OpenComponent<FakeComponent>(0);
362
newTree
.SetKey("new key");
363
newTree
.CloseComponent();
370
var newComponent = GetComponents(
newTree
).Single();
393
AddWithKey(
newTree
, "key1", "attrib1b");
394
AddWithKey(
newTree
, "key2", "attrib2");
395
AddWithKey(
newTree
, "key3", "attrib3");
410
AddWithKey(
newTree
, "key1", "attrib1b");
411
AddWithKey(
newTree
, "key2", "attrib2");
412
AddWithKey(
newTree
, "key1", "attrib3");
428
AddWithKey(
newTree
, "key1", "attrib1a");
429
AddWithKey(
newTree
, "key1", "attrib1b");
448
newTree
.OpenElement(2, "other");
449
newTree
.CloseElement();
451
newTree
.OpenElement(1, "el");
452
newTree
.SetKey("some key");
453
newTree
.CloseElement();
455
newTree
.OpenElement(0, "other 2");
456
newTree
.CloseElement();
485
newTree
.OpenElement(1, "el");
486
newTree
.SetKey("some key");
487
newTree
.CloseElement();
509
newTree
.OpenElement(0, "el");
510
newTree
.SetKey("some key");
511
newTree
.CloseElement();
540
newTree
.OpenElement(0, "el");
541
newTree
.CloseElement();
562
newTree
.AddContent(0, "x"); // Loop start
563
newTree
.AddContent(0, "x"); // Loop start
580
newTree
.AddContent(10, "x"); // Loop start
581
newTree
.AddContent(11, "x"); // Will be added
582
newTree
.AddContent(12, "x"); // Will be added
583
newTree
.AddContent(10, "x"); // Loop start
612
newTree
.AddContent(0, "x");
613
newTree
.AddContent(1, "x");
630
newTree
.AddContent(10, "x");
631
newTree
.AddContent(11, "x");
632
newTree
.AddContent(10, "x"); // Will be added
633
newTree
.AddContent(11, "x"); // Will be added
660
newTree
.AddContent(12, "x");
661
newTree
.AddContent(10, "x");
662
newTree
.AddContent(11, "x");
663
newTree
.AddContent(12, "x");
692
newTree
.AddContent(2, "x");
693
newTree
.AddContent(2, "x"); // Note that the '0' and '1' items are not present on this iteration
709
newTree
.AddContent(1, "text");
726
newTree
.AddContent(123, "new text 1");
727
newTree
.AddContent(182, "new text 2");
753
newTree
.AddMarkupContent(1, "preserved");
754
newTree
.AddMarkupContent(2, "was inserted");
755
newTree
.AddMarkupContent(3, "was updated");
790
newTree
.OpenElement(123, "new element");
791
newTree
.CloseElement();
814
newTree
.OpenComponent<FakeComponent2>(123);
815
newTree
.CloseComponent();
819
var diff = RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, oldTree.GetFrames(),
newTree
.GetFrames());
839
newTree
.OpenElement(0, "My element");
840
newTree
.AddAttribute(1, "existing", "existing value");
841
newTree
.AddAttribute(2, "added", "added value");
842
newTree
.CloseElement();
865
newTree
.OpenElement(0, "My element");
866
newTree
.AddAttribute(2, "will survive", "surviving value");
867
newTree
.CloseElement();
889
newTree
.OpenElement(0, "My element");
890
newTree
.AddAttribute(1, "will remain", "will remain value");
891
newTree
.AddAttribute(2, "will change", "did change value");
892
newTree
.CloseElement();
918
newTree
.OpenElement(0, "My element");
919
newTree
.AddAttribute(1, "onfoo", retainedHandler);
920
newTree
.AddAttribute(2, "onbar", addedHandler);
921
newTree
.CloseElement();
948
newTree
.OpenElement(0, "My element");
949
newTree
.AddAttribute(1, "newname", "same value");
950
newTree
.CloseElement();
978
newTree
.OpenElement(0, "My element");
979
newTree
.AddAttribute(0, "attr1", "value1");
980
newTree
.AddAttribute(0, "attr2", "value2");
981
newTree
.AddAttribute(0, "attr3", "value3");
982
newTree
.CloseElement();
1008
newTree
.OpenElement(0, "My element");
1009
newTree
.AddAttribute(0, "attr1", "value1");
1010
newTree
.AddAttribute(0, "attr2", "value2");
1011
newTree
.AddAttribute(0, "attr3", "value3");
1012
newTree
.CloseElement();
1039
newTree
.OpenElement(0, "My element");
1040
newTree
.AddAttribute(0, "attr1", "value1");
1041
newTree
.AddAttribute(0, "attr2", "value2");
1042
newTree
.AddAttribute(0, "attr3", "value3");
1043
newTree
.CloseElement();
1070
newTree
.OpenElement(0, "My element");
1071
newTree
.AddAttribute(1, "attr1", "value1");
1072
newTree
.AddAttribute(2, "attr2", "value2");
1073
newTree
.AddAttribute(3, "attr3", "value3");
1074
newTree
.CloseElement();
1100
newTree
.OpenElement(0, "My element");
1101
newTree
.AddAttribute(1, "attr1", "value1");
1102
newTree
.AddAttribute(2, "attr2", "value2");
1103
newTree
.AddAttribute(3, "attr3", "value3");
1104
newTree
.CloseElement();
1131
newTree
.OpenElement(0, "My element");
1132
newTree
.AddAttribute(1, "attr1", "value1");
1133
newTree
.AddAttribute(2, "attr2", "value2");
1134
newTree
.AddAttribute(3, "attr3", "value3");
1135
newTree
.CloseElement();
1163
newTree
.OpenElement(0, "My element");
1164
newTree
.AddAttribute(0, "attr2", "value2");
1165
newTree
.AddAttribute(0, "attr3", "value3");
1166
newTree
.CloseElement();
1190
newTree
.OpenElement(0, "My element");
1191
newTree
.AddAttribute(0, "attr1", "value1");
1192
newTree
.AddAttribute(0, "attr3", "value3");
1193
newTree
.CloseElement();
1217
newTree
.OpenElement(0, "My element");
1218
newTree
.AddAttribute(0, "attr1", "value1");
1219
newTree
.AddAttribute(0, "attr2", "value2");
1220
newTree
.CloseElement();
1244
newTree
.OpenElement(0, "My element");
1245
newTree
.AddAttribute(2, "attr2", "value2");
1246
newTree
.AddAttribute(3, "attr3", "value3");
1247
newTree
.CloseElement();
1271
newTree
.OpenElement(0, "My element");
1272
newTree
.AddAttribute(1, "attr1", "value1");
1273
newTree
.AddAttribute(3, "attr3", "value3");
1274
newTree
.CloseElement();
1298
newTree
.OpenElement(0, "My element");
1299
newTree
.AddAttribute(1, "attr1", "value1");
1300
newTree
.AddAttribute(2, "attr2", "value2");
1301
newTree
.CloseElement();
1329
newTree
.AddContent(09, "unrelated");
1330
newTree
.OpenElement(10, "root");
1331
newTree
.OpenElement(11, "child");
1332
newTree
.OpenElement(12, "grandchild");
1333
newTree
.AddContent(13, "grandchild new text");
1334
newTree
.CloseElement();
1335
newTree
.CloseElement();
1336
newTree
.CloseElement();
1370
newTree
.OpenElement(10, "root");
1371
newTree
.AddContent(11, "Text that has changed");
1372
newTree
.OpenElement(12, "Subtree that will not change");
1373
newTree
.OpenElement(13, "Another");
1374
newTree
.AddContent(14, "Text that will not change");
1375
newTree
.CloseElement();
1376
newTree
.CloseElement();
1377
newTree
.CloseElement();
1402
newTree
.AddContent(10, "text1");
1403
newTree
.AddContent(11, "text2modified");
1404
newTree
.AddContent(12, "text3");
1405
newTree
.AddContent(13, "text4");
1425
newTree
.AddContent(0, "Will not change");
1426
newTree
.OpenElement(1, "root");
1427
newTree
.OpenRegion(2);
1428
newTree
.AddContent(0, "text1");
1429
newTree
.CloseRegion();
1430
newTree
.CloseElement();
1454
newTree
.AddContent(1, "Start");
1455
newTree
.OpenRegion(2);
1456
newTree
.AddContent(4, "Text inside region"); // Sequence number is unrelated to outside the region
1457
newTree
.OpenRegion(5);
1458
newTree
.AddContent(6, "Text inside nested region");
1459
newTree
.CloseRegion();
1460
newTree
.CloseRegion();
1461
newTree
.AddContent(3, "End");
1494
newTree
.AddContent(1, "Start");
1495
newTree
.AddContent(3, "End");
1518
newTree
.AddContent(1, "Start");
1519
newTree
.OpenRegion(2);
1520
newTree
.AddContent(4, "Changed text inside region");
1521
newTree
.OpenRegion(6);
1522
newTree
.AddContent(5, "Text to move"); // Although it's the same sequence and content, it's now in a different region so not the same
1523
newTree
.CloseRegion();
1524
newTree
.CloseRegion();
1525
newTree
.AddContent(3, "End");
1554
newTree
.AddContent(10, "text1"); // 0: text1
1555
newTree
.OpenElement(11, "container"); // 1: <container>
1556
newTree
.OpenComponent<FakeComponent>(12); // 2: <FakeComponent>
1557
newTree
.CloseComponent(); // </FakeComponent>
1558
newTree
.OpenComponent<FakeComponent2>(13); // 3: <FakeComponent2>
1559
newTree
.CloseComponent(); // </FakeComponent2>
1560
newTree
.CloseElement(); // </container>
1589
newTree
.OpenComponent<FakeComponent>(0);
1590
newTree
.AddComponentParameter(1, nameof(FakeComponent.IntProperty), 123);
1591
newTree
.AddComponentParameter(2, nameof(FakeComponent.StringProperty), "some string");
1592
newTree
.AddComponentParameter(3, nameof(FakeComponent.ObjectProperty), testObject);
1593
newTree
.CloseComponent();
1597
var componentInstance =
newTree
.GetFrames().AsEnumerable().First().Component as FakeComponent;
1620
newTree
.AddContent(10, "text1"); // 0: text1
1621
newTree
.OpenElement(11, "container"); // 1: <container>
1622
newTree
.OpenComponent<FakeComponent>(12); // 2: <FakeComponent>
1623
newTree
.CloseComponent(); // </FakeComponent>
1624
newTree
.OpenComponent<FakeComponent2>(13); // 3: <FakeComponent2>
1625
newTree
.CloseComponent(); // </FakeComponent2>
1626
newTree
.CloseElement(); // </container>
1636
var newFrame1 =
newTree
.GetFrames().Array[2];
1637
var newFrame2 =
newTree
.GetFrames().Array[3];
1655
newTree
.OpenElement(0, "My element");
1656
newTree
.AddAttribute(1, "ontest", retainedHandler);
1657
newTree
.CloseElement();
1662
var newAttributeFrame =
newTree
.GetFrames().Array[1];
1681
newTree
.OpenElement(0, "My element");
1682
newTree
.AddAttribute(0, "another-attribute", "go down the slow path please");
1683
newTree
.AddAttribute(0, "ontest", retainedHandler);
1684
newTree
.CloseElement();
1689
var newAttributeFrame =
newTree
.GetFrames().Array[2];
1709
newTree
.OpenComponent<FakeComponent>(12);
1710
newTree
.AddComponentParameter(13, nameof(FakeComponent.StringProperty), "String did change");
1711
newTree
.AddComponentParameter(14, nameof(FakeComponent.ObjectProperty), objectWillNotChange);
1712
newTree
.CloseComponent();
1742
foreach (var tree in new[] { oldTree,
newTree
})
1792
foreach (var tree in new[] { oldTree,
newTree
})
1822
newTree
.OpenComponent<DisposableComponent>(30); // <DisposableComponent>
1823
newTree
.CloseComponent(); // </DisposableComponent>
1833
RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, oldTree.GetFrames(),
newTree
.GetFrames());
1844
newTree
.OpenElement(0, "My element");
1845
newTree
.AddElementReferenceCapture(1, capture1);
1846
newTree
.AddElementReferenceCapture(2, capture2);
1847
newTree
.CloseElement();
1887
newTree
.OpenElement(0, "My element");
1888
newTree
.AddElementReferenceCapture(1, capture1);
1889
newTree
.CloseElement();
1911
newTree
.OpenComponent<FakeComponent>(0);
1912
newTree
.AddComponentReferenceCapture(1, assigner1);
1913
newTree
.AddComponentReferenceCapture(2, assigner2);
1914
newTree
.CloseComponent();
1953
newTree
.OpenComponent<FakeComponent>(0);
1954
newTree
.AddComponentReferenceCapture(1, assigner);
1955
newTree
.CloseComponent();
1984
newTree
.OpenElement(0, "container");
1985
newTree
.SetKey("second key");
1986
newTree
.AddContent(1, "Second");
1987
newTree
.CloseElement();
1989
newTree
.AddContent(2, "Unkeyed item");
1991
newTree
.OpenElement(0, "container");
1992
newTree
.SetKey("first key");
1993
newTree
.AddContent(1, "First modified");
1994
newTree
.CloseElement();
2040
newTree
.OpenComponent<CaptureSetParametersComponent>(0);
2041
newTree
.SetKey("second key");
2042
newTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Second param");
2043
newTree
.CloseComponent();
2045
newTree
.AddContent(2, "Unkeyed item");
2047
newTree
.OpenComponent<CaptureSetParametersComponent>(0);
2048
newTree
.SetKey("first key");
2049
newTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "First param modified");
2050
newTree
.CloseComponent();
2057
var newComponents = GetComponents<CaptureSetParametersComponent>(
newTree
);
2081
AddWithKey(
newTree
, "will move");
2082
AddWithKey(
newTree
, "newly inserted");
2083
AddWithKey(
newTree
, "will retain");
2109
AddWithKey(
newTree
, "will move");
2110
AddWithKey(
newTree
, "will retain");
2130
AddWithKey(
newTree
, "newly inserted");
2131
AddWithKey(
newTree
, "will retain");
2132
AddWithKey(
newTree
, "will move");
2158
AddWithKey(
newTree
, "will retain");
2159
AddWithKey(
newTree
, "will move");
2179
newTree
.AddContent(0, "some text");
2201
newTree
.OpenElement(0, "some elem");
2202
newTree
.SetKey("my key");
2203
newTree
.CloseElement();
2226
newTree
.OpenElement(0, "existing");
2227
newTree
.AddAttribute(1, "attr1", "unrelated val1");
2228
newTree
.AddNamedEvent("someevent1", "added to existing element");
2229
newTree
.CloseElement();
2230
newTree
.OpenElement(2, "new element");
2231
newTree
.AddNamedEvent("someevent2", "added with new element");
2232
newTree
.CloseElement();
2261
newTree
.OpenElement(0, "retaining");
2262
newTree
.AddAttribute(1, "attr1", "unrelated val1");
2263
newTree
.CloseElement();
2283
newTree
.OpenElement(0, "elem");
2284
newTree
.AddAttribute(1, "attr1", "unrelated val1");
2285
newTree
.AddNamedEvent("eventname", "assigned name");
2286
newTree
.CloseElement();
2312
newTree
.OpenElement(0, "elem");
2313
newTree
.AddNamedEvent("eventname1", "changed name");
2314
newTree
.AddNamedEvent("eventname2", "will be left unchanged");
2315
newTree
.CloseElement();
2338
newTree
.OpenElement(0, "elem");
2339
for (var i = 0;
newTree
.GetFrames().Count <
newTree
.GetFrames().Array.Length; i++)
2341
newTree
.AddAttribute(1, $"myattribute_{i}", "value");
2345
newTree
.AddAttribute(1, $"myattribute_final", "value");
2349
newTree
.CloseElement();
2371
newTree
.OpenElement(0, "elem");
2372
for (var i = 0;
newTree
.GetFrames().Count <
newTree
.GetFrames().Array.Length; i++)
2374
newTree
.AddAttribute(1, $"myattribute_{i}", "value");
2382
newTree
.CloseElement();
2409
=> GetRenderedBatch(oldTree,
newTree
, initializeFromFrames, componentId);