content/xul/templates/tests/chrome/test_tmpl_listboxelement.xul

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:a425e9961b59
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4
5 <!--
6 listbox element
7 -->
8
9 <window title="XUL Template Tests" width="500" height="600"
10 onload="test_template();"
11 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
12 <script type="application/javascript"
13 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
14
15 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
16
17 <data id="output">
18 <listcols>
19 <listcol flex="1"/>
20 <listcol flex="1"/>
21 </listcols>
22 <listitem step="3" id="http://www.some-fictitious-zoo.com/birds/wren">
23 <listcell label="Wren"/>
24 <listcell label=""/>
25 </listitem>
26 <listitem id="http://www.some-fictitious-zoo.com/birds/emu">
27 <listcell label="Emu"/>
28 <listcell label="Dromaius novaehollandiae"/>
29 </listitem>
30 <listitem step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">
31 <listcell label="Barn Owl"/>
32 <listcell label="Tyto alba"/>
33 </listitem>
34 <listitem id="http://www.some-fictitious-zoo.com/birds/raven">
35 <listcell label="Raven"/>
36 <listcell label="Corvus corax"/>
37 </listitem>
38 <listitem step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
39 <listcell label="Archaeopteryx"/>
40 <listcell label=""/>
41 </listitem>
42 <listitem step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">
43 <listcell label="Emperor Penguin"/>
44 <listcell label=""/>
45 </listitem>
46 </data>
47
48 <script src="templates_shared.js"/>
49
50 <script>
51 <![CDATA[
52 SimpleTest.expectAssertions(4);
53
54 SimpleTest.waitForExplicitFinish();
55
56 var testid ="listbox element";
57 var queryType = "rdf";
58 var isTreeBuilder = false;
59 var needsOpen = false;
60 var notWorkingYet = false;
61 var notWorkingYetDynamic = false;
62 var expectedOutput = document.getElementById("output");
63
64 var changes = [
65 // step 1
66 function(targetds, root) {
67 var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
68 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
69 RDF.GetLiteral('Emperor Penguin'), true);
70 var container = ContainerUtils.MakeSeq(targetds,
71 RDF.GetResource(ZOO_NS + 'birds'));
72 container.AppendElement(newnode);
73 },
74 // step 2
75 function(targetds, root) {
76 var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
77 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
78 RDF.GetLiteral('Archaeopteryx'), true);
79 var container = ContainerUtils.MakeSeq(targetds,
80 RDF.GetResource(ZOO_NS + 'birds'));
81 container.InsertElementAt(newnode, '4', true);
82 },
83 // step 3
84 function(targetds, root) {
85 var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
86 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
87 RDF.GetLiteral('Wren'), true);
88 var container = ContainerUtils.MakeSeq(targetds,
89 RDF.GetResource(ZOO_NS + 'birds'));
90 container.InsertElementAt(newnode, '1', true);
91 },
92 // step 4
93 function(targetds, root) {
94 var container = ContainerUtils.MakeSeq(targetds,
95 RDF.GetResource(ZOO_NS + 'birds'));
96 var removednode = container.RemoveElementAt('3', true);
97 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
98 RDF.GetLiteral('Barn Owl'), true);
99 }
100 ];
101 ]]>
102 </script>
103
104 <listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/birds">
105 <listcols>
106 <listcol flex="1"/>
107 <listcol flex="1"/>
108 </listcols>
109 <template>
110 <listitem uri="rdf:*">
111 <listcell label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
112 <listcell label="rdf:http://www.some-fictitious-zoo.com/rdf#species"/>
113 </listitem>
114 </template>
115 </listbox>
116
117 </window>

mercurial