diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/base/test/unit/test_xml_parser.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/base/test/unit/test_xml_parser.js')
-rw-r--r-- | dom/base/test/unit/test_xml_parser.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dom/base/test/unit/test_xml_parser.js b/dom/base/test/unit/test_xml_parser.js new file mode 100644 index 000000000..a87c21672 --- /dev/null +++ b/dom/base/test/unit/test_xml_parser.js @@ -0,0 +1,48 @@ +function run_test () { + for (var i = 0; i < tests.length && tests[i][0]; ++i) { + if (!tests[i][0].call()) { + do_throw(tests[i][1]); + } + } +} + +var tests = [ + [ test1, "Unable to parse basic XML document" ], + [ test2, "ParseXML doesn't return nsIDOMDocument" ], + [ test3, "ParseXML return value's documentElement is not nsIDOMElement" ], + [ test4, "" ], + [ test5, "" ], + [ test6, "" ], + [ null ] +]; + +function test1() { + return ParseXML("<root/>"); +} + +function test2() { + return (ParseXML("<root/>") instanceof nsIDOMDocument); +} + +function test3() { + return (ParseXML("<root/>").documentElement instanceof nsIDOMElement); +} + +function test4() { + var doc = ParseXML("<root/>"); + do_check_eq(doc.documentElement.namespaceURI, null); + return true; +} + +function test5() { + var doc = ParseXML("<root xmlns=''/>"); + do_check_eq(doc.documentElement.namespaceURI, null); + return true; +} + +function test6() { + var doc = ParseXML("<root xmlns='ns1'/>"); + do_check_neq(doc.documentElement.namespaceURI, null); + do_check_eq(doc.documentElement.namespaceURI, 'ns1'); + return true; +} |