OSDN Git Service

Add Spec for Core::Document
authordhrname <dhrname@users.sourceforge.jp>
Sun, 16 Sep 2012 14:34:00 +0000 (23:34 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sun, 16 Sep 2012 14:34:00 +0000 (23:34 +0900)
org/w3c/core.js
tool/Spec/spec/SvgDomSpec.js

index 347294c..8eed1e2 100644 (file)
@@ -213,7 +213,7 @@ DOMImplementation = {
           s = new Document();
         }
         s.implementation = this;
-        s.doctype = doctype;
+        s.doctype = doctype || null;
         s.documentElement = s.createElementNS(ns,qname); //ルート要素を作る
         return s;
       } catch(e){}
index 0d21db2..92e252b 100644 (file)
@@ -1717,27 +1717,58 @@ describe("SVG Spec in JavaScript", function() {
     });
     /*appendChildメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
     it("should be this for the value, when it calls a appendChild method (the invalid partion)", function() {
+      var sn = function() {
+        s.appendChild(t);
+        /*HIERARCHY_REQUEST_ERR DOMException */
+        t.appendChild(s);
+      },
+      tn = function() {
+        /*WRONG_DOCUMENT_ERR DOMException*/
+        s.appendChild(DOMImplementation.createDocument("svg", "svg").createElementNS("o","n"));
+      };
+      expect(sn).toThrow();
+      expect(tn).toThrow();
     });
     /*removeChildメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
     it("should be this for the value, when it calls a removeChild method (the invalid partion)", function() {
+      var sn = function() {
+        s.removeChild(s.cloneNode(false));
+      },
+      tn = function() {
+        /*NOT_FOUND_ERR DOMException*/
+        s.removeChild(DOMImplementation.createDocument("svg", "svg").createElementNS("o","n"));
+      };
+      expect(sn).toThrow();
+      expect(tn).toThrow();
     });
     /*replaceChildメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
     it("should be this for the value, when it calls a replaceChild method (the invalid partion)", function() {
+      s.appendChild(t);
+      t.appendChild(t.cloneNode(false))
+      var sn = function() {
+        /*HIERARCHY_REQUEST_ERR DOMException */
+        t.replaceChild(s, t.firstChild);
+      },
+      tn = function() {
+        /*WRONG_DOCUMENT_ERR DOMException*/
+        s.replaceChild(DOMImplementation.createDocument("svg", "svg").createElementNS("o","n"), s.firstChild);
+      },
+      un = function() {
+        /*NOT_FOUND_ERR DOMException*/
+        s.replaceChild(t, t.cloneNode(false));
+      };
+      expect(sn).toThrow();
+      expect(tn).toThrow();
+      expect(un).toThrow();
     });
-    /*hasChildNodesメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
-    it("should be this for the value, when it calls a hasChildNodes method (the invalid partion)", function() {
-    });
-    /*cloneNodeメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
-    it("should be this for the value, when it calls a cloneNode method (the invalid partion)", function() {
-    });
-    /*normalizeメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
-    it("should be this for the value, when it calls a normalize method (the invalid partion)", function() {
-    });
-    /*isSupportedメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
-    it("should be this for the value, when it calls a isSupported method (the invalid partion)", function() {
-    });
-    /*hasAttributesメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/
-    it("should be this for the value, when it calls a hasAttributes method (the invalid partion)", function() {
+  });
+  describe("DOM level 2 Core :: Document", function() {
+    /*まずは、あるべきデフォルト値かどうかをチェックしていく(Checking the default value of a Document interface.)*/
+    it("for the default value on the property of Document", function() {
+      expect(doc.doctype).toBeNull();
+      expect(svg.ownerDocument).toEqual(doc);
+      expect(svg.nodeName).toEqual("svg");
+      expect(svg.namespaceURI).toEqual("http://www.w3.org/2000/svg");
     });
   });
 });
\ No newline at end of file