Debian Codegraph @

rhino/testsrc/tests/e4x/XML/13.4.4.33.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.4.4.33.js';
8
9 START("13.4.4.33 - XML setChildren()");
10
11 TEST(1, true, XML.prototype.hasOwnProperty("setChildren"));
12
13 x =
14 <alpha>
15 <bravo>one</bravo>
16 </alpha>;
17
18 correct =
19 <alpha>
20 <charlie>two</charlie>
21 </alpha>;
22
23 x.setChildren(<charlie>two</charlie>);
24
25 TEST(2, correct, x);
26
27 // Replace the entire contents of Jim's employee element
28 emps =
29 <employees>
30 <employee id="0"><name>Jim</name><age>25</age></employee>
31 <employee id="1"><name>Joe</name><age>20</age></employee>
32 </employees>;
33
34 correct =
35 <employees>
36 <employee id="0"><name>John</name><age>35</age></employee>
37 <employee id="1"><name>Joe</name><age>20</age></employee>
38 </employees>;
39
40 emps.employee.(name == "Jim").setChildren(<name>John</name> + <age>35</age>);
41
42 TEST(3, correct, emps);
43
44 END();