rhino1.7.6.testsrc.tests.e4x.Expressions.11.2.1.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhino Show documentation
Show all versions of rhino Show documentation
Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically
embedded into Java applications to provide scripting to end users.
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
gTestfile = '11.2.1.js';
START("11.2.1 - Property Accessors");
order =
John
Doe
-
Big Screen Television
1299.99
1
;
correct =
John
Doe
;
TEST(1, correct, order.customer);
TEST_XML(2, 123456, order.@id);
correct =
-
Big Screen Television
1299.99
1
TEST(3, correct, order.children()[1]);
correct =
John
Doe
+
-
Big Screen Television
1299.99
1
;
TEST(4, correct, order.*);
correct = new XMLList();
correct += new XML("123456");
correct += new XML("Mon Mar 10 2003 16:03:25 GMT-0800 (PST)");
TEST(5, correct, order.@*);
order =
John
Doe
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
correct =
Big Screen Television +
DVD Player ;
TEST(6, correct, order.item.description);
correct = new XMLList();
correct += new XML("3456");
correct += new XML("56789");
TEST(7, correct, order.item.@id);
correct =
-
DVD Player
399.99
1
TEST(8, correct, order.item[1]);
correct =
Big Screen Television +
1299.99 +
1 +
DVD Player +
399.99 +
1 ;
TEST(9, correct, order.item.*);
correct=
1299.99 ;
TEST(10, correct, order.item.*[1]);
// get the first (and only) order [treating single element as a list]
order =
John
Doe
-
Big Screen Television
1299.99
1
-
DVD Player
399.99
1
;
TEST(11, order, order[0]);
// Any other index should return undefined
TEST(12, undefined, order[1]);
END();
© 2015 - 2024 Weber Informatics LLC | Privacy Policy