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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_listboxelement.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,117 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +
     1.8 +<!--
     1.9 +  listbox element
    1.10 +-->
    1.11 +
    1.12 +<window title="XUL Template Tests" width="500" height="600"
    1.13 +        onload="test_template();"
    1.14 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.15 +  <script type="application/javascript"
    1.16 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.17 +
    1.18 +  <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    1.19 +
    1.20 +  <data id="output">
    1.21 +    <listcols>
    1.22 +      <listcol flex="1"/>
    1.23 +      <listcol flex="1"/>
    1.24 +    </listcols>
    1.25 +    <listitem step="3" id="http://www.some-fictitious-zoo.com/birds/wren">
    1.26 +      <listcell label="Wren"/>
    1.27 +      <listcell label=""/>
    1.28 +    </listitem>
    1.29 +    <listitem id="http://www.some-fictitious-zoo.com/birds/emu">
    1.30 +      <listcell label="Emu"/>
    1.31 +      <listcell label="Dromaius novaehollandiae"/>
    1.32 +    </listitem>
    1.33 +    <listitem step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">
    1.34 +      <listcell label="Barn Owl"/>
    1.35 +      <listcell label="Tyto alba"/>
    1.36 +    </listitem>
    1.37 +    <listitem id="http://www.some-fictitious-zoo.com/birds/raven">
    1.38 +      <listcell label="Raven"/>
    1.39 +      <listcell label="Corvus corax"/>
    1.40 +    </listitem>
    1.41 +    <listitem step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
    1.42 +      <listcell label="Archaeopteryx"/>
    1.43 +      <listcell label=""/>
    1.44 +    </listitem>
    1.45 +    <listitem step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">
    1.46 +      <listcell label="Emperor Penguin"/>
    1.47 +      <listcell label=""/>
    1.48 +    </listitem>
    1.49 +  </data>
    1.50 +
    1.51 +<script src="templates_shared.js"/>
    1.52 +
    1.53 +<script>
    1.54 +<![CDATA[
    1.55 +SimpleTest.expectAssertions(4);
    1.56 +
    1.57 +SimpleTest.waitForExplicitFinish();
    1.58 +
    1.59 +var testid ="listbox element";
    1.60 +var queryType = "rdf";
    1.61 +var isTreeBuilder = false;
    1.62 +var needsOpen = false;
    1.63 +var notWorkingYet = false;
    1.64 +var notWorkingYetDynamic = false;
    1.65 +var expectedOutput = document.getElementById("output");
    1.66 +
    1.67 +var changes = [
    1.68 +  // step 1
    1.69 +  function(targetds, root) {
    1.70 +    var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
    1.71 +    targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    1.72 +                    RDF.GetLiteral('Emperor Penguin'), true);
    1.73 +    var container = ContainerUtils.MakeSeq(targetds,
    1.74 +                      RDF.GetResource(ZOO_NS + 'birds'));
    1.75 +    container.AppendElement(newnode);
    1.76 +  },
    1.77 +  // step 2
    1.78 +  function(targetds, root) {
    1.79 +    var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
    1.80 +    targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    1.81 +                    RDF.GetLiteral('Archaeopteryx'), true);
    1.82 +    var container = ContainerUtils.MakeSeq(targetds,
    1.83 +                      RDF.GetResource(ZOO_NS + 'birds'));
    1.84 +    container.InsertElementAt(newnode, '4', true);
    1.85 +  },
    1.86 +  // step 3
    1.87 +  function(targetds, root) {
    1.88 +    var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
    1.89 +    targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    1.90 +                    RDF.GetLiteral('Wren'), true);
    1.91 +    var container = ContainerUtils.MakeSeq(targetds,
    1.92 +                      RDF.GetResource(ZOO_NS + 'birds'));
    1.93 +    container.InsertElementAt(newnode, '1', true);
    1.94 +  },
    1.95 +  // step 4
    1.96 +  function(targetds, root) {
    1.97 +    var container = ContainerUtils.MakeSeq(targetds,
    1.98 +                      RDF.GetResource(ZOO_NS + 'birds'));
    1.99 +    var removednode = container.RemoveElementAt('3', true);
   1.100 +    targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
   1.101 +                      RDF.GetLiteral('Barn Owl'), true);
   1.102 +  }
   1.103 +];
   1.104 +]]>
   1.105 +</script>
   1.106 +
   1.107 +<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">
   1.108 +<listcols>
   1.109 +<listcol flex="1"/>
   1.110 +<listcol flex="1"/>
   1.111 +</listcols>
   1.112 +<template>
   1.113 +<listitem uri="rdf:*">
   1.114 +<listcell label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
   1.115 +<listcell label="rdf:http://www.some-fictitious-zoo.com/rdf#species"/>
   1.116 +</listitem>
   1.117 +</template>
   1.118 +</listbox>
   1.119 +
   1.120 +</window>

mercurial