Exemplo n.º 1
0
        public void AttributesClearedAfterLoadXml()
        {
            // Make sure some attributes are showing.
            treeViewContainer.ShowAttributes(doc.DocumentElement.Attributes);

            Assert.IsTrue(doc.DocumentElement.HasAttributes, "Sanity check that the root element has some attributes");
            Assert.IsNotNull(attributesGrid.SelectedObject);

            // Loading new xml should clear the attributes grid.
            treeViewContainer.LoadXml("<html/>", provider);

            Assert.IsNull(attributesGrid.SelectedObject,
                          "Should be no SelectedObject in the attributes grid after loading new xml.");
        }
Exemplo n.º 2
0
        public void ClassAttributeSelected()
        {
            treeView.SelectedNode = bodyTreeNode;
            treeViewContainer.ShowAttributes(treeView.SelectedElement.Attributes);

            Assert.IsNotNull(treeViewContainer.AttributesGrid.SelectedGridItem,
                             "Sanity check - should have a grid item selected.");

            Assert.AreEqual(XmlTreeViewContainerControl.XmlTreeViewContainerControlStates.ElementSelected | XmlTreeViewContainerControl.XmlTreeViewContainerControlStates.AttributeSelected,
                            treeViewContainer.InternalState,
                            "OwnerState should be ElementSelected and AttributeSelected.");
        }
        public void RemoveAttribute()
        {
            AddAttribute();

            treeView.SelectedNode = bodyTreeNode;
            treeViewContainer.ShowAttributes(treeView.SelectedElement.Attributes);

            Assert.IsNotNull(treeViewContainer.AttributesGrid.SelectedGridItem,
                             "Sanity check - should have a grid item selected.");

            RemoveAttributeCommand command = new RemoveAttributeCommand();

            command.Owner = treeViewContainer;
            command.Run();

            Assert.IsFalse(bodyElement.HasAttribute("class"));
        }