diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/base/test/unit/test_xml_parser.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 0000000000..0d6675fdab --- /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 Document"], + [test3, "ParseXML return value's documentElement is not Element"], + [test4, ""], + [test5, ""], + [test6, ""], + [null], +]; + +function test1() { + return ParseXML("<root/>"); +} + +function test2() { + return ChromeUtils.getClassName(ParseXML("<root/>")) === "XMLDocument"; +} + +function test3() { + return Element.isInstance(ParseXML("<root/>").documentElement); +} + +function test4() { + var doc = ParseXML("<root/>"); + Assert.equal(doc.documentElement.namespaceURI, null); + return true; +} + +function test5() { + var doc = ParseXML("<root xmlns=''/>"); + Assert.equal(doc.documentElement.namespaceURI, null); + return true; +} + +function test6() { + var doc = ParseXML("<root xmlns='ns1'/>"); + Assert.notEqual(doc.documentElement.namespaceURI, null); + Assert.equal(doc.documentElement.namespaceURI, "ns1"); + return true; +} |