content/xul/templates/tests/chrome/test_tmpl_storage_parameters.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_storage_parameters.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,160 @@
     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 +    storage listbox with query parameters
    1.10 +-->
    1.11 +
    1.12 +<window title="XUL Template Tests" width="500" height="600"
    1.13 +        onload="test_storage_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-birds">
    1.21 +    <listitem anyid="true" label="Barn Owl"/>
    1.22 +    <listitem anyid="true" label="Emu"/>
    1.23 +    <listitem anyid="true" label="Raven"/>
    1.24 +  </data>
    1.25 +
    1.26 +  <data id="output-L">
    1.27 +    <listitem anyid="true" label="LAMA"/>
    1.28 +    <listitem anyid="true" label="Lion"/>
    1.29 +  </data>
    1.30 +
    1.31 +<script src="templates_shared.js"/>
    1.32 +
    1.33 +<script>
    1.34 +<![CDATA[
    1.35 +
    1.36 +copyToProfile('animals.sqlite');
    1.37 +SimpleTest.waitForExplicitFinish();
    1.38 +
    1.39 +
    1.40 +function test_storage_template()
    1.41 +{
    1.42 +  var root = document.getElementById("root1");
    1.43 +  expectedOutput = document.getElementById("output-birds");
    1.44 +  checkResults(root, 0);
    1.45 +
    1.46 +root = document.getElementById("root2");
    1.47 +checkResults(root, 0);
    1.48 +
    1.49 +root = document.getElementById("root6");
    1.50 +checkResults(root, 0);
    1.51 +
    1.52 +root = document.getElementById("root3");
    1.53 +expectedOutput = document.getElementById("output-L");
    1.54 +checkResults(root, 0);
    1.55 +
    1.56 +root = document.getElementById("root4");
    1.57 +checkResults(root, 0);
    1.58 +
    1.59 +root = document.getElementById("root5");
    1.60 +checkResults(root, 0);
    1.61 +
    1.62 +SimpleTest.finish();
    1.63 +}
    1.64 +
    1.65 +
    1.66 +var testid ="storage listbox with query parameters";
    1.67 +var queryType = "storage";
    1.68 +var isTreeBuilder = false;
    1.69 +var needsOpen = false;
    1.70 +var notWorkingYet = false;
    1.71 +var notWorkingYetDynamic = false;
    1.72 +var expectedOutput;
    1.73 +
    1.74 +var changes = [];
    1.75 +]]>
    1.76 +</script>
    1.77 +
    1.78 +<listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root1" 
    1.79 +              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
    1.80 +    <template>
    1.81 +        <query>
    1.82 +            SELECT * FROM animals WHERE species_id = ? ORDER BY name
    1.83 +            <param>2</param>
    1.84 +        </query>
    1.85 +        <action>
    1.86 +            <listitem uri="?" label="?name"/>
    1.87 +        </action>
    1.88 +    </template>
    1.89 +</listbox>
    1.90 +
    1.91 +
    1.92 +<listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root2" 
    1.93 +              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
    1.94 +    <template>
    1.95 +        <query>
    1.96 +            SELECT * FROM animals WHERE species_id = ? ORDER BY name
    1.97 +            <param type="int32">2</param>
    1.98 +        </query>
    1.99 +        <action>
   1.100 +            <listitem uri="?" label="?name"/>
   1.101 +        </action>
   1.102 +    </template>
   1.103 +</listbox>
   1.104 +
   1.105 +
   1.106 +<listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root3" 
   1.107 +              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
   1.108 +    <template>
   1.109 +        <query>
   1.110 +                SELECT * FROM animals WHERE species_id = :spec AND name like ? ORDER BY name
   1.111 +            <param name="spec" type="int32">5</param>
   1.112 +            <param>L%</param>
   1.113 +        </query>
   1.114 +        <action>
   1.115 +            <listitem uri="?" label="?name"/>
   1.116 +        </action>
   1.117 +    </template>
   1.118 +</listbox>
   1.119 +
   1.120 +<listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root4" 
   1.121 +              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
   1.122 +    <template>
   1.123 +        <query>
   1.124 +                SELECT * FROM animals WHERE species_id = ?3 AND name like ?1 ORDER BY name
   1.125 +            <param index="3" type="int32">5</param>
   1.126 +            <param index="1">L%</param>
   1.127 +        </query>
   1.128 +        <action>
   1.129 +            <listitem uri="?" label="?name"/>
   1.130 +        </action>
   1.131 +    </template>
   1.132 +</listbox>
   1.133 +
   1.134 +<listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root5" 
   1.135 +              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
   1.136 +    <template>
   1.137 +        <query>
   1.138 +                SELECT * FROM animals WHERE species_id = ?3 AND name like :pattern ORDER BY name
   1.139 +            <param name="pattern">L%</param>
   1.140 +            <param index="3" type="int32">5</param>
   1.141 +        </query>
   1.142 +        <action>
   1.143 +            <listitem uri="?" label="?name"/>
   1.144 +        </action>
   1.145 +    </template>
   1.146 +</listbox>
   1.147 +
   1.148 +<listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root6" 
   1.149 +              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
   1.150 +    <template>
   1.151 +        <query>
   1.152 +            SELECT * FROM animals WHERE species_id = ? ORDER BY name
   1.153 +            <param type="int32">2qsdqsd</param>
   1.154 +        </query>
   1.155 +        <action>
   1.156 +            <listitem uri="?" label="?name"/>
   1.157 +        </action>
   1.158 +    </template>
   1.159 +</listbox>
   1.160 +
   1.161 +
   1.162 +
   1.163 +</window>

mercurial