Debian Codegraph @

rhino/testsrc/tests/e4x/XMLList/13.5.4.12.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.12.js';
8
9 START("13.5.4.12 - XMLList hasComplexContent()");
10
11 TEST(1, true, XMLList.prototype.hasOwnProperty("hasComplexContent"));
12
13 // One element should be same as XML case
14 x =
15 <>
16 <alpha attr1="value1">
17 <bravo>one</bravo>
18 <charlie>
19 two
20 three
21 <echo>four</echo>
22 </charlie>
23 <delta />
24 <foxtrot attr2="value2">five</foxtrot>
25 <golf attr3="value3" />
26 <hotel>
27 six
28 seven
29 </hotel>
30 <india><juliet /></india>
31 </alpha>;
32 </>;
33
34 TEST(2, true, x.hasComplexContent());
35 TEST(3, false, x.bravo.hasComplexContent());
36 TEST(4, true, x.charlie.hasComplexContent());
37 TEST(5, false, x.delta.hasComplexContent());
38 TEST(6, false, x.foxtrot.hasComplexContent());
39 TEST(7, false, x.golf.hasComplexContent());
40 TEST(8, false, x.hotel.hasComplexContent());
41 TEST(9, false, x.@attr1.hasComplexContent());
42 TEST(10, false, x.bravo.child(0).hasComplexContent());
43 TEST(11, true, x.india.hasComplexContent());
44
45 // More than one element is complex if one or more things in the list are elements.
46 x =
47 <>
48 <alpha>one</alpha>
49 <bravo>two</bravo>
50 </>;
51
52 TEST(12, true, x.hasComplexContent());
53
54 x =
55 <root>
56 one
57 <alpha>one</alpha>
58 </root>;
59
60 TEST(13, true, x.*.hasComplexContent());
61
62 x =
63 <root attr1="value1" attr2="value2">
64 one
65 </root>;
66
67 TEST(14, false, x.@*.hasComplexContent());
68
69 END();