Debian Codegraph @

rhino/testsrc/tests/e4x/XMLList/13.5.4.5.js

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 gTestfile = '13.5.4.5.js';
8
9 START("13.5.4.5 - XMLList children()");
10
11 TEST(1, true, XMLList.prototype.hasOwnProperty("children"));
12
13 // Test with XMLList of size 0
14 x = new XMLList()
15 TEST(2, "xml", typeof(x.children()));
16 TEST_XML(3, "", x.children());
17
18 // Test with XMLList of size 1
19 x += <alpha>one<bravo>two</bravo></alpha>;
20 TEST(4, "xml", typeof(x.children()));
21
22 correct = <>one<bravo>two</bravo></>;
23 TEST(5, correct, x.children());
24
25 // Test with XMLList of size > 1
26 x += <charlie><bravo>three</bravo></charlie>;
27 TEST(6, "xml", typeof(x.children()));
28
29 correct = <>one<bravo>two</bravo><bravo>three</bravo></>;
30 TEST(7, correct, x.children());
31
32 // Test no children
33 x = new XMLList();
34 x += <alpha></alpha>;
35 x += <bravo></bravo>;
36 TEST(8, "xml", typeof(x.children()));
37 TEST_XML(9, "", x.children());
38
39 //get all grandchildren of the order that have the name price
40
41 order =
42 <order>
43 <customer>
44 <name>John Smith</name>
45 </customer>
46 <item id="1">
47 <description>Big Screen Television</description>
48 <price>1299.99</price>
49 </item>
50 <item id="2">
51 <description>DVD Player</description>
52 <price>399.99</price>
53 </item>
54 </order>;
55
56 correct= <price>1299.99</price> + <price>399.99</price>;
57
58 TEST(10, correct, order.children().price);
59
60 END();