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(); 1739foreach (var tree in new[] { oldTree, newTree }) 1787foreach (var tree in new[] { oldTree, newTree }) 1817newTree.OpenComponent<DisposableComponent>(30); // <DisposableComponent> 1818newTree.CloseComponent(); // </DisposableComponent> 1828RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, oldTree.GetFrames(), newTree.GetFrames()); 1839newTree.OpenElement(0, "My element"); 1840newTree.AddElementReferenceCapture(1, capture1); 1841newTree.AddElementReferenceCapture(2, capture2); 1842newTree.CloseElement(); 1882newTree.OpenElement(0, "My element"); 1883newTree.AddElementReferenceCapture(1, capture1); 1884newTree.CloseElement(); 1906newTree.OpenComponent<FakeComponent>(0); 1907newTree.AddComponentReferenceCapture(1, assigner1); 1908newTree.AddComponentReferenceCapture(2, assigner2); 1909newTree.CloseComponent(); 1948newTree.OpenComponent<FakeComponent>(0); 1949newTree.AddComponentReferenceCapture(1, assigner); 1950newTree.CloseComponent(); 1979newTree.OpenElement(0, "container"); 1980newTree.SetKey("second key"); 1981newTree.AddContent(1, "Second"); 1982newTree.CloseElement(); 1984newTree.AddContent(2, "Unkeyed item"); 1986newTree.OpenElement(0, "container"); 1987newTree.SetKey("first key"); 1988newTree.AddContent(1, "First modified"); 1989newTree.CloseElement(); 2035newTree.OpenComponent<CaptureSetParametersComponent>(0); 2036newTree.SetKey("second key"); 2037newTree.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Second param"); 2038newTree.CloseComponent(); 2040newTree.AddContent(2, "Unkeyed item"); 2042newTree.OpenComponent<CaptureSetParametersComponent>(0); 2043newTree.SetKey("first key"); 2044newTree.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "First param modified"); 2045newTree.CloseComponent(); 2052var newComponents = GetComponents<CaptureSetParametersComponent>(newTree); 2076AddWithKey(newTree, "will move"); 2077AddWithKey(newTree, "newly inserted"); 2078AddWithKey(newTree, "will retain"); 2104AddWithKey(newTree, "will move"); 2105AddWithKey(newTree, "will retain"); 2125AddWithKey(newTree, "newly inserted"); 2126AddWithKey(newTree, "will retain"); 2127AddWithKey(newTree, "will move"); 2153AddWithKey(newTree, "will retain"); 2154AddWithKey(newTree, "will move"); 2174newTree.AddContent(0, "some text"); 2196newTree.OpenElement(0, "some elem"); 2197newTree.SetKey("my key"); 2198newTree.CloseElement(); 2221newTree.OpenElement(0, "existing"); 2222newTree.AddAttribute(1, "attr1", "unrelated val1"); 2223newTree.AddNamedEvent("someevent1", "added to existing element"); 2224newTree.CloseElement(); 2225newTree.OpenElement(2, "new element"); 2226newTree.AddNamedEvent("someevent2", "added with new element"); 2227newTree.CloseElement(); 2256newTree.OpenElement(0, "retaining"); 2257newTree.AddAttribute(1, "attr1", "unrelated val1"); 2258newTree.CloseElement(); 2278newTree.OpenElement(0, "elem"); 2279newTree.AddAttribute(1, "attr1", "unrelated val1"); 2280newTree.AddNamedEvent("eventname", "assigned name"); 2281newTree.CloseElement(); 2307newTree.OpenElement(0, "elem"); 2308newTree.AddNamedEvent("eventname1", "changed name"); 2309newTree.AddNamedEvent("eventname2", "will be left unchanged"); 2310newTree.CloseElement(); 2333newTree.OpenElement(0, "elem"); 2334for (var i = 0; newTree.GetFrames().Count < newTree.GetFrames().Array.Length; i++) 2336newTree.AddAttribute(1, $"myattribute_{i}", "value"); 2340newTree.AddAttribute(1, $"myattribute_final", "value"); 2344newTree.CloseElement(); 2366newTree.OpenElement(0, "elem"); 2367for (var i = 0; newTree.GetFrames().Count < newTree.GetFrames().Array.Length; i++) 2369newTree.AddAttribute(1, $"myattribute_{i}", "value"); 2377newTree.CloseElement(); 2404=> GetRenderedBatch(oldTree, newTree, initializeFromFrames, componentId);