1 write to oldTree
Microsoft.AspNetCore.Components.Tests (1)
RenderTreeDiffBuilderTest.cs (1)
21
oldTree
= new RenderTreeBuilder();
335 references to oldTree
Microsoft.AspNetCore.Components.Tests (335)
RenderTreeDiffBuilderTest.cs (335)
28
((IDisposable)
oldTree
).Dispose();
38
appendFragment(
oldTree
);
74
oldTree
.AddContent(0, "text0");
75
oldTree
.AddContent(2, "text2");
97
oldTree
.AddContent(0, "text0");
98
oldTree
.AddContent(1, "text1");
99
oldTree
.AddContent(2, "text2");
115
oldTree
.OpenElement(0, "container");
116
oldTree
.SetKey("retained key");
117
oldTree
.AddContent(1, "Existing");
118
oldTree
.CloseElement();
150
oldTree
.OpenElement(0, "container");
151
oldTree
.SetKey("will delete");
152
oldTree
.AddContent(1, "First");
153
oldTree
.CloseElement();
155
oldTree
.OpenElement(0, "container");
156
oldTree
.SetKey("will retain");
157
oldTree
.AddContent(1, "Second");
158
oldTree
.CloseElement();
180
oldTree
.OpenElement(0, "container");
181
oldTree
.SetKey("original key");
182
oldTree
.AddContent(1, "Original");
183
oldTree
.CloseElement();
211
oldTree
.OpenComponent<CaptureSetParametersComponent>(0);
212
oldTree
.SetKey("retained key");
213
oldTree
.AddComponentParameter(1, "ParamName", "Param old value");
214
oldTree
.CloseComponent();
216
GetRenderedBatch(initial,
oldTree
, false); // Assign initial IDs
217
var oldComponent = GetComponents<CaptureSetParametersComponent>(
oldTree
).Single();
252
oldTree
.OpenComponent<FakeComponent>(0);
253
oldTree
.SetKey("will delete");
254
oldTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Anything");
255
oldTree
.CloseComponent();
257
oldTree
.OpenComponent<FakeComponent>(0);
258
oldTree
.SetKey("will retain");
259
oldTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Retained param value");
260
oldTree
.CloseComponent();
264
GetRenderedBatch(initial,
oldTree
, false);
265
var oldComponents = GetComponents(
oldTree
);
290
oldTree
.OpenComponent<FakeComponent>(0);
291
oldTree
.SetKey("will delete");
292
oldTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Will delete");
293
oldTree
.CloseComponent();
295
oldTree
.OpenComponent<FakeComponent>(2);
296
oldTree
.AddComponentParameter(3, nameof(FakeComponent.StringProperty), "Retained param value");
297
oldTree
.CloseComponent();
301
GetRenderedBatch(initial,
oldTree
, false);
302
var oldComponents = GetComponents(
oldTree
);
322
oldTree
.OpenComponent<FakeComponent>(1);
323
oldTree
.CloseComponent();
327
GetRenderedBatch(initial,
oldTree
, false);
328
var oldComponents = GetComponents(
oldTree
);
351
oldTree
.OpenComponent<FakeComponent>(0);
352
oldTree
.SetKey("original key");
353
oldTree
.CloseComponent();
357
GetRenderedBatch(renderTreeBuilder,
oldTree
, false);
358
var oldComponent = GetComponents(
oldTree
).Single();
389
AddWithKey(
oldTree
, "key1", "attrib1a");
390
AddWithKey(
oldTree
, "key2", "attrib2");
391
AddWithKey(
oldTree
, "key1", "attrib3");
406
AddWithKey(
oldTree
, "key1", "attrib1a");
407
AddWithKey(
oldTree
, "key2", "attrib2");
408
AddWithKey(
oldTree
, "key3", "attrib3");
425
AddWithKey(
oldTree
, "key1", "attrib1a");
426
AddWithKey(
oldTree
, "key1", "attrib1b");
444
oldTree
.OpenElement(1, "el");
445
oldTree
.SetKey("some key");
446
oldTree
.CloseElement();
475
oldTree
.OpenElement(2, "other");
476
oldTree
.CloseElement();
478
oldTree
.OpenElement(1, "el");
479
oldTree
.SetKey("some key");
480
oldTree
.CloseElement();
482
oldTree
.OpenElement(0, "other 2");
483
oldTree
.CloseElement();
506
oldTree
.OpenElement(0, "el");
507
oldTree
.CloseElement();
536
oldTree
.OpenElement(0, "el");
537
oldTree
.SetKey("some key");
538
oldTree
.CloseElement();
558
oldTree
.AddContent(0, "x"); // Loop start
559
oldTree
.AddContent(1, "x"); // Will be removed
560
oldTree
.AddContent(2, "x"); // Will be removed
561
oldTree
.AddContent(0, "x"); // Loop start
578
oldTree
.AddContent(10, "x"); // Loop start
579
oldTree
.AddContent(10, "x"); // Loop start
608
oldTree
.AddContent(0, "x");
609
oldTree
.AddContent(1, "x");
610
oldTree
.AddContent(0, "x"); // Will be removed
611
oldTree
.AddContent(1, "x"); // Will be removed
628
oldTree
.AddContent(10, "x");
629
oldTree
.AddContent(11, "x");
658
oldTree
.AddContent(12, "x");
659
oldTree
.AddContent(12, "x"); // Note that the '0' and '1' items are not present on this iteration
688
oldTree
.AddContent(2, "x");
689
oldTree
.AddContent(0, "x");
690
oldTree
.AddContent(1, "x");
691
oldTree
.AddContent(2, "x");
708
oldTree
.AddContent(0, "text");
724
oldTree
.AddContent(123, "old text 1");
725
oldTree
.AddContent(182, "old text 2");
750
oldTree
.AddMarkupContent(1, "preserved");
751
oldTree
.AddMarkupContent(3, "will be updated");
752
oldTree
.AddMarkupContent(4, "will be removed");
788
oldTree
.OpenElement(123, "old element");
789
oldTree
.CloseElement();
810
oldTree
.OpenComponent<FakeComponent>(123);
811
oldTree
.CloseComponent();
813
GetRenderedBatch(initial,
oldTree
, false); // Assign initial IDs
819
var diff = RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0,
oldTree
.GetFrames(), newTree.GetFrames());
836
oldTree
.OpenElement(0, "My element");
837
oldTree
.AddAttribute(1, "existing", "existing value");
838
oldTree
.CloseElement();
861
oldTree
.OpenElement(0, "My element");
862
oldTree
.AddAttribute(1, "will be removed", "will be removed value");
863
oldTree
.AddAttribute(2, "will survive", "surviving value");
864
oldTree
.CloseElement();
885
oldTree
.OpenElement(0, "My element");
886
oldTree
.AddAttribute(1, "will remain", "will remain value");
887
oldTree
.AddAttribute(2, "will change", "will change value");
888
oldTree
.CloseElement();
914
oldTree
.OpenElement(0, "My element");
915
oldTree
.AddAttribute(1, "onfoo", retainedHandler);
916
oldTree
.AddAttribute(2, "onbar", removedHandler);
917
oldTree
.CloseElement();
925
var removedEventHandlerFrame =
oldTree
.GetFrames().Array[2];
945
oldTree
.OpenElement(0, "My element");
946
oldTree
.AddAttribute(1, "oldname", "same value");
947
oldTree
.CloseElement();
974
oldTree
.OpenElement(0, "My element");
975
oldTree
.AddAttribute(0, "attr2", "value2");
976
oldTree
.AddAttribute(0, "attr3", "value3");
977
oldTree
.CloseElement();
1004
oldTree
.OpenElement(0, "My element");
1005
oldTree
.AddAttribute(0, "attr1", "value1");
1006
oldTree
.AddAttribute(0, "attr3", "value3");
1007
oldTree
.CloseElement();
1035
oldTree
.OpenElement(0, "My element");
1036
oldTree
.AddAttribute(0, "attr1", "value1");
1037
oldTree
.AddAttribute(0, "attr2", "value2");
1038
oldTree
.CloseElement();
1066
oldTree
.OpenElement(0, "My element");
1067
oldTree
.AddAttribute(2, "attr2", "value2");
1068
oldTree
.AddAttribute(3, "attr3", "value3");
1069
oldTree
.CloseElement();
1096
oldTree
.OpenElement(0, "My element");
1097
oldTree
.AddAttribute(1, "attr1", "value1");
1098
oldTree
.AddAttribute(3, "attr3", "value3");
1099
oldTree
.CloseElement();
1127
oldTree
.OpenElement(0, "My element");
1128
oldTree
.AddAttribute(1, "attr1", "value1");
1129
oldTree
.AddAttribute(2, "attr2", "value2");
1130
oldTree
.CloseElement();
1158
oldTree
.OpenElement(0, "My element");
1159
oldTree
.AddAttribute(0, "attr1", "value1");
1160
oldTree
.AddAttribute(0, "attr2", "value2");
1161
oldTree
.AddAttribute(0, "attr3", "value3");
1162
oldTree
.CloseElement();
1185
oldTree
.OpenElement(0, "My element");
1186
oldTree
.AddAttribute(0, "attr1", "value1");
1187
oldTree
.AddAttribute(0, "attr2", "value2");
1188
oldTree
.AddAttribute(0, "attr3", "value3");
1189
oldTree
.CloseElement();
1212
oldTree
.OpenElement(0, "My element");
1213
oldTree
.AddAttribute(0, "attr1", "value1");
1214
oldTree
.AddAttribute(0, "attr2", "value2");
1215
oldTree
.AddAttribute(0, "attr3", "value3");
1216
oldTree
.CloseElement();
1239
oldTree
.OpenElement(0, "My element");
1240
oldTree
.AddAttribute(1, "attr1", "value1");
1241
oldTree
.AddAttribute(2, "attr2", "value2");
1242
oldTree
.AddAttribute(3, "attr3", "value3");
1243
oldTree
.CloseElement();
1266
oldTree
.OpenElement(0, "My element");
1267
oldTree
.AddAttribute(1, "attr1", "value1");
1268
oldTree
.AddAttribute(2, "attr2", "value2");
1269
oldTree
.AddAttribute(3, "attr3", "value3");
1270
oldTree
.CloseElement();
1293
oldTree
.OpenElement(0, "My element");
1294
oldTree
.AddAttribute(1, "attr1", "value1");
1295
oldTree
.AddAttribute(2, "attr2", "value2");
1296
oldTree
.AddAttribute(3, "attr3", "value3");
1297
oldTree
.CloseElement();
1320
oldTree
.AddContent(09, "unrelated");
1321
oldTree
.OpenElement(10, "root");
1322
oldTree
.OpenElement(11, "child");
1323
oldTree
.OpenElement(12, "grandchild");
1324
oldTree
.AddContent(13, "grandchild old text");
1325
oldTree
.CloseElement();
1326
oldTree
.CloseElement();
1327
oldTree
.CloseElement();
1361
oldTree
.OpenElement(10, "root");
1362
oldTree
.AddContent(11, "Text that will change");
1363
oldTree
.OpenElement(12, "Subtree that will not change");
1364
oldTree
.OpenElement(13, "Another");
1365
oldTree
.AddContent(14, "Text that will not change");
1366
oldTree
.CloseElement();
1367
oldTree
.CloseElement();
1368
oldTree
.CloseElement();
1398
oldTree
.AddContent(10, "text1");
1399
oldTree
.AddContent(11, "text2");
1400
oldTree
.AddContent(12, "text3");
1401
oldTree
.AddContent(13, "text4");
1424
oldTree
.AddContent(0, "Will not change");
1452
oldTree
.AddContent(1, "Start");
1453
oldTree
.AddContent(3, "End");
1486
oldTree
.AddContent(1, "Start");
1487
oldTree
.OpenRegion(2);
1488
oldTree
.AddContent(4, "Text inside region"); // Sequence number is unrelated to outside the region
1489
oldTree
.OpenRegion(5);
1490
oldTree
.AddContent(6, "Text inside nested region");
1491
oldTree
.CloseRegion();
1492
oldTree
.CloseRegion();
1493
oldTree
.AddContent(3, "End");
1510
oldTree
.AddContent(1, "Start");
1511
oldTree
.OpenRegion(2);
1512
oldTree
.AddContent(4, "Text inside region");
1513
oldTree
.AddContent(5, "Text to move");
1514
oldTree
.OpenRegion(6);
1515
oldTree
.CloseRegion();
1516
oldTree
.CloseRegion();
1517
oldTree
.AddContent(3, "End");
1551
oldTree
.AddContent(10, "text1"); // 0: text1
1552
oldTree
.OpenElement(11, "container"); // 1: <container>
1553
oldTree
.CloseElement(); // </container>
1613
oldTree
.AddContent(10, "text1"); // 0: text1
1614
oldTree
.OpenElement(11, "container"); // 1: <container>
1615
oldTree
.OpenComponent<FakeComponent>(12); // 2: <FakeComponent>
1616
oldTree
.CloseComponent(); // </FakeComponent>
1617
oldTree
.OpenComponent<FakeComponent2>(13); // 3: <FakeComponent2>
1618
oldTree
.CloseComponent(); // </FakeComponent2>
1619
oldTree
.CloseElement(); // </container>
1630
RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTreeBuilder.GetFrames(),
oldTree
.GetFrames());
1631
var originalFakeComponentInstance =
oldTree
.GetFrames().Array[2].Component;
1632
var originalFakeComponent2Instance =
oldTree
.GetFrames().Array[3].Component;
1652
oldTree
.OpenElement(0, "My element");
1653
oldTree
.AddAttribute(1, "ontest", retainedHandler);
1654
oldTree
.CloseElement();
1661
var oldAttributeFrame =
oldTree
.GetFrames().Array[1];
1678
oldTree
.OpenElement(0, "My element");
1679
oldTree
.AddAttribute(0, "ontest", retainedHandler);
1680
oldTree
.CloseElement();
1688
var oldAttributeFrame =
oldTree
.GetFrames().Array[1];
1705
oldTree
.OpenComponent<FakeComponent>(12);
1706
oldTree
.AddComponentParameter(13, nameof(FakeComponent.StringProperty), "String will change");
1707
oldTree
.AddComponentParameter(14, nameof(FakeComponent.ObjectProperty), objectWillNotChange);
1708
oldTree
.CloseComponent();
1716
RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTree.GetFrames(),
oldTree
.GetFrames());
1717
var originalComponentInstance = (FakeComponent)
oldTree
.GetFrames().Array[0].Component;
1721
var newComponentInstance = (FakeComponent)
oldTree
.GetFrames().Array[0].Component;
1742
foreach (var tree in new[] {
oldTree
, newTree })
1771
RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTreeBuilder.GetFrames(),
oldTree
.GetFrames());
1772
var originalComponentInstance = (CaptureSetParametersComponent)
oldTree
.GetFrames().Array[0].Component;
1777
var newComponentInstance = (CaptureSetParametersComponent)
oldTree
.GetFrames().Array[0].Component;
1792
foreach (var tree in new[] {
oldTree
, newTree })
1801
RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTreeBuilder.GetFrames(),
oldTree
.GetFrames());
1802
var componentInstance = (CaptureSetParametersComponent)
oldTree
.GetFrames().Array[0].Component;
1816
oldTree
.OpenComponent<DisposableComponent>(10); // <DisposableComponent>
1817
oldTree
.CloseComponent(); // </DisposableComponent>
1818
oldTree
.OpenComponent<NonDisposableComponent>(20); // <NonDisposableComponent>
1819
oldTree
.CloseComponent(); // </NonDisposableComponent>
1820
oldTree
.OpenComponent<DisposableComponent>(30); // <DisposableComponent>
1821
oldTree
.CloseComponent(); // </DisposableComponent>
1827
RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTree.GetFrames(),
oldTree
.GetFrames());
1833
RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0,
oldTree
.GetFrames(), newTree.GetFrames());
1884
oldTree
.OpenElement(0, "My element");
1885
oldTree
.AddElementReferenceCapture(1, capture1);
1886
oldTree
.CloseElement();
1950
oldTree
.OpenComponent<FakeComponent>(0);
1951
oldTree
.AddComponentReferenceCapture(1, assigner);
1952
oldTree
.CloseComponent();
1972
oldTree
.OpenElement(0, "container");
1973
oldTree
.SetKey("first key");
1974
oldTree
.AddContent(1, "First");
1975
oldTree
.CloseElement();
1977
oldTree
.AddContent(2, "Unkeyed item");
1979
oldTree
.OpenElement(0, "container");
1980
oldTree
.SetKey("second key");
1981
oldTree
.AddContent(1, "Second");
1982
oldTree
.CloseElement();
2024
oldTree
.OpenComponent<CaptureSetParametersComponent>(0);
2025
oldTree
.SetKey("first key");
2026
oldTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "First param");
2027
oldTree
.CloseComponent();
2029
oldTree
.AddContent(2, "Unkeyed item");
2031
oldTree
.OpenComponent<CaptureSetParametersComponent>(0);
2032
oldTree
.SetKey("second key");
2033
oldTree
.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Second param");
2034
oldTree
.CloseComponent();
2037
GetRenderedBatch(renderTreeBuilder,
oldTree
, false); // Assign initial IDs
2038
var oldComponents = GetComponents<CaptureSetParametersComponent>(
oldTree
);
2078
AddWithKey(
oldTree
, "will retain");
2079
AddWithKey(
oldTree
, "will move");
2105
AddWithKey(
oldTree
, "will retain");
2106
AddWithKey(
oldTree
, "will delete");
2107
AddWithKey(
oldTree
, "will move");
2127
AddWithKey(
oldTree
, "will move");
2128
AddWithKey(
oldTree
, "will retain");
2154
AddWithKey(
oldTree
, "will move");
2155
AddWithKey(
oldTree
, "will delete");
2156
AddWithKey(
oldTree
, "will retain");
2175
oldTree
.OpenElement(0, "some elem");
2176
oldTree
.AddContent(1, "Hello!");
2177
oldTree
.CloseElement();
2198
oldTree
.OpenComponent<FakeComponent>(0);
2199
oldTree
.CloseComponent();
2222
oldTree
.OpenElement(0, "existing");
2223
oldTree
.AddAttribute(1, "attr1", "unrelated val1");
2224
oldTree
.CloseElement();
2253
oldTree
.OpenElement(0, "retaining");
2254
oldTree
.AddAttribute(1, "attr1", "unrelated val1");
2255
oldTree
.AddNamedEvent("someevent1", "removing from retained element");
2256
oldTree
.CloseElement();
2257
oldTree
.OpenElement(2, "removing");
2258
oldTree
.AddNamedEvent("someevent2", "removed because element was removed");
2259
oldTree
.CloseElement();
2279
oldTree
.OpenElement(0, "elem");
2280
oldTree
.AddNamedEvent("eventname", "assigned name");
2281
oldTree
.CloseElement();
2307
oldTree
.OpenElement(0, "elem");
2308
oldTree
.AddNamedEvent("eventname1", "original name");
2309
oldTree
.AddNamedEvent("eventname2", "will be left unchanged");
2310
oldTree
.CloseElement();
2333
oldTree
.OpenElement(0, "elem");
2334
for (var i = 0;
oldTree
.GetFrames().Count <
oldTree
.GetFrames().Array.Length; i++)
2336
oldTree
.AddAttribute(1, $"myattribute_{i}", "value");
2348
oldTree
.CloseElement();
2366
oldTree
.OpenElement(0, "elem");
2367
for (var i = 0;
oldTree
.GetFrames().Count <
oldTree
.GetFrames().Array.Length; i++)
2369
oldTree
.AddAttribute(1, $"myattribute_{i}", "value");
2378
oldTree
.AddAttribute(1, $"myattribute_final", "value");
2381
oldTree
.CloseElement();
2409
=> GetRenderedBatch(
oldTree
, newTree, initializeFromFrames, componentId);