1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-08-31 13:32:46 +00:00
TiddlyWiki5/tw2/source/tiddlywiki/tests/jsspec/XML.jsspec.js
Jeremy Ruston a1c8ac624f Added first pass at support for building TiddlyWiki 2.6.x with TW5
There are still some whitespace and attribute ordering issues, but the
result runs correctly.
2012-05-29 22:02:38 +01:00

39 lines
1.8 KiB
JavaScript
Executable File

// <![CDATA[
describe('XML: testing framework XML functions', {
'parsing XML returns an object' : function() {
xml = tests_xml.parse('<foo><bar></bar></foo>');
value_of(typeof xml).should_match('object');
},
'documentElement should be an object' : function() {
xml = tests_xml.parse('<foo><bar></bar></foo>');
value_of(typeof xml.documentElement).should_be("object");
},
'DOM should be able to access documentElement nodeName' : function() {
xml = tests_xml.parse('<foo><bar></bar></foo>');
value_of(xml.documentElement.nodeName).should_be("foo");
},
'DOM should be able to access documentElement nodeName from empty document' : function() {
xml = tests_xml.parse('<foo/>');
value_of(xml.documentElement.nodeName).should_be("foo");
},
'DOM should be able to access attribute on document node' : function() {
xml = tests_xml.parse('<foo version="2.0"></foo>');
value_of(xml.documentElement.getAttribute("version")).should_be("2.0");
},
'XPath should be able to access the documentElement' : function() {
xml = tests_xml.parse('<foo>hello</foo>');
value_of(xml.xpath("/foo", "string")).should_be("hello");
},
'XPath should be able to access the documentElement' : function() {
xml = tests_xml.parse('<foo>hello<bar>world</bar></foo>');
value_of(xml.xpath("/foo/bar", "string")).should_be("world");
},
'XPath count of nodeset containing elements' : function() {
xml = tests_xml.parse('<foo><bar/><bar/><bar/></foo>');
value_of(xml.xpath("count(/foo/bar)", "number")).should_be(3);
}
});
// ]]>