public void ChangeChild() { XmlElement sect = doc.CreateElement("sect"); XmlElement title = doc.CreateElement("title"); sect.AppendChild(title); sect.AppendChild(doc.CreateElement("para")); doc.DocumentElement.AppendChild(sect); doc.DocumentElement.AppendChild(sect.CloneNode(true)); XmlElement n = doc.CreateElement("title"); Assert.AreEqual(0, v.InvalidNodes.AllErrors.Length, "Unexpected errors after setup"); SelectionManager.Change(Selection.Empty, sect, n); // title in wrong place plus two invalid child nodes Assert.AreEqual(3, v.InvalidNodes.AllErrors.Length, "Wrong number of errors after change"); }
public void BugRedoNodeChanged() { XmlElement x = doc.CreateElement("x"); XmlElement y = doc.CreateElement("y"); x.AppendChild(y); doc.DocumentElement.AppendChild(x); u = new UndoManager(this); u.Attach(doc); u.Mark(null); XmlElement z = doc.CreateElement("z"); SelectionManager.Change(Selection.Empty, x, z); u.Undo(null); u.Redo(); Assert.AreEqual(1, z.ChildNodes.Count, "Expected z to still have one node after redo"); }
public override Selection Perform(SelectionManager sm) { return(SelectionManager.Change(Selection.Empty, (XmlElement)node, XmlUtil.CreateElement(name, node.OwnerDocument))); }