source: Dev/trunk/src/client/dojox/wire/tests/programmatic/XmlWire.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.0 KB
Line 
1dojo.provide("dojox.wire.tests.programmatic.XmlWire");
2
3dojo.require("dojox.wire.XmlWire");
4
5tests.register("dojox.wire.tests.programmatic.XmlWire", [
6
7        function test_XmlWire_path(t){
8                var object = {};
9                var wire = dojox.wire.create({object: object, property: "element"});
10                new dojox.wire.XmlWire({object: wire, path: "/x/y/text()"}).setValue("Y");
11                var value = new dojox.wire.XmlWire({object: object, property: "element", path: "y/text()"}).getValue();
12                t.assertEqual("Y", value);
13
14                // attribute
15                new dojox.wire.XmlWire({object: object, property: "element", path: "y/@z"}).setValue("Z");
16                value = new dojox.wire.XmlWire({object: wire, path: "/x/y/@z"}).getValue();
17                t.assertEqual("Z", value);
18
19                // with index
20                var document = object.element.ownerDocument;
21                var element = document.createElement("y");
22                element.appendChild(document.createTextNode("Y2"));
23                object.element.appendChild(element);
24                value = new dojox.wire.XmlWire({object: object.element, path: "y[2]/text()"}).getValue();
25                t.assertEqual("Y2", value);
26        }
27
28]);
Note: See TracBrowser for help on using the repository browser.