content/xul/templates/tests/chrome/test_tmpl_storage_dynamicparameters.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_dynamicparameters.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,86 @@
     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 dynamic 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"/>
    1.21 +
    1.22 +  <data id="rebuilt-output">
    1.23 +    <listitem anyid="true" label="Barn Owl"/>
    1.24 +    <listitem anyid="true" label="Emu"/>
    1.25 +    <listitem anyid="true" label="Raven"/>
    1.26 +  </data>
    1.27 +
    1.28 +<script src="templates_shared.js"/>
    1.29 +
    1.30 +<script>
    1.31 +<![CDATA[
    1.32 +SimpleTest.expectAssertions(1, 2);
    1.33 +
    1.34 +SimpleTest.waitForExplicitFinish();
    1.35 +
    1.36 +copyToProfile('animals.sqlite');
    1.37 +
    1.38 +function test_storage_template()
    1.39 +{
    1.40 +  var root = document.getElementById("root");
    1.41 +  expectedOutput = document.getElementById("output");
    1.42 +  checkResults(root, 0);
    1.43 +
    1.44 +  document.getElementById("species-id").textContent = '2';
    1.45 +  root.builder.addListener(myBuilderListener);
    1.46 +  root.builder.rebuild();
    1.47 +}
    1.48 +
    1.49 +var myBuilderListener = {
    1.50 +
    1.51 +   willRebuild: function(aBuilder) {
    1.52 +
    1.53 +   },
    1.54 +   didRebuild: function (aBuilder) {
    1.55 +        var root = document.getElementById("root");
    1.56 +        expectedOutput = document.getElementById("rebuilt-output");
    1.57 +        checkResults(root, 0);
    1.58 +        SimpleTest.finish();
    1.59 +   }
    1.60 +}
    1.61 +
    1.62 +var testid ="storage listbox with dynamic query parameters";
    1.63 +var queryType = "storage";
    1.64 +var isTreeBuilder = false;
    1.65 +var needsOpen = false;
    1.66 +var notWorkingYet = false;
    1.67 +var notWorkingYetDynamic = false;
    1.68 +var expectedOutput = document.getElementById("output");
    1.69 +
    1.70 +var changes = [];
    1.71 +]]>
    1.72 +</script>
    1.73 +
    1.74 +<listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
    1.75 +              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
    1.76 +    <template>
    1.77 +        <query>
    1.78 +             SELECT * FROM animals WHERE species_id = :spec ORDER BY name
    1.79 +            <param id="species-id" name="spec" type="int32" />
    1.80 +        </query>
    1.81 +        <action>
    1.82 +            <listitem uri="?" label="?name"/>
    1.83 +        </action>
    1.84 +    </template>
    1.85 +</listbox>
    1.86 +
    1.87 +
    1.88 +
    1.89 +</window>

mercurial