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