[gxml] Fixed GomElement.remove_attribute()



commit 5ab97759afef6d0fc335904d0828ee88cb26bb9c
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Nov 2 17:45:26 2016 -0600

    Fixed GomElement.remove_attribute()

 gxml/GomElement.vala     |    3 ++-
 test/GomElementTest.vala |    9 +++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index 8233111..83843eb 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -420,7 +420,8 @@ public class GXml.GomElement : GomNode,
     }
   }
   public void remove_attribute (string name) {
-    (this as GomElement).remove_attribute (name);
+    if ((this as GomObject).remove_attribute (name)) return;
+    attributes.remove_named_item (name);
   }
   public void remove_attribute_ns (string? namespace_uri, string local_name) {
     attributes.remove_named_item_ns (namespace_uri, local_name);
diff --git a/test/GomElementTest.vala b/test/GomElementTest.vala
index 26411c9..da35012 100644
--- a/test/GomElementTest.vala
+++ b/test/GomElementTest.vala
@@ -107,16 +107,17 @@ class GomElementTest : GXmlTest  {
                                assert (elem.attributes.get_named_item ("alley").node_value == "Diagon");
                                assert (elem.attributes.get_named_item ("train").node_value == "Hogwarts 
Express");
 
-                               elem.set_attribute ("owl", "");
+                               elem.set_attribute ("owl", "Hedwig");
                                GomAttr attr = elem.attributes.get_named_item ("owl") as GomAttr;
                                assert (attr != null);
-                               attr.node_value = "Hedwig";
+                               assert (attr.node_value == "Hedwig");
 
                                assert (elem.attributes.size == 3);
-                               assert (elem.attributes.get_named_item ("owl").node_value == "Hedwig");
+                               assert (elem.get_attribute ("owl") == "Hedwig");
 
                                elem.attributes.remove_named_item ("alley");
-                               assert (elem.attributes.get_named_item ("alley") == null);
+
+                               assert (elem.get_attribute ("alley") == null);
                                assert (elem.attributes.size == 2);
                                elem.remove_attribute ("owl");
                                assert (elem.attributes.size == 1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]