Additional tests by Martin Honnen, Bug 290481
git-svn-id: svn://10.0.0.236/trunk@172400 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
* Igor Bukanov
|
||||
* Ethan Hugg
|
||||
* Milen Nankov
|
||||
* Martin Honnen
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@@ -43,6 +44,39 @@
|
||||
START("13.5.4.9 - XMLList descendants()");
|
||||
|
||||
TEST(1, true, XMLList.prototype.hasOwnProperty("descendants"));
|
||||
|
||||
|
||||
END();
|
||||
// From Martin Honnen
|
||||
|
||||
var gods = <gods>
|
||||
<god>
|
||||
<name>Kibo</name>
|
||||
</god>
|
||||
<god>
|
||||
<name>Xibo</name>
|
||||
</god>
|
||||
</gods>;
|
||||
|
||||
var godList = gods.god;
|
||||
|
||||
var expect;
|
||||
var actual;
|
||||
var node;
|
||||
var descendants = godList.descendants();
|
||||
|
||||
expect = 4;
|
||||
actual = descendants.length();
|
||||
TEST(2, expect, actual)
|
||||
|
||||
expect = 'nodeKind(): element, name(): name;\n' +
|
||||
'nodeKind(): text, name(): null;\n' +
|
||||
'nodeKind(): element, name(): name;\n' +
|
||||
'nodeKind(): text, name(): null;\n';
|
||||
|
||||
actual = '';
|
||||
|
||||
for each (var xml in descendants) {
|
||||
actual += 'nodeKind(): ' + xml.nodeKind() + ', name(): ' + xml.name() + ';\n';
|
||||
}
|
||||
TEST(4, expect, actual);
|
||||
|
||||
END();
|
||||
|
||||
Reference in New Issue
Block a user