summaryrefslogtreecommitdiffstats
path: root/dom/xul/templates/tests/chrome/test_bug476634.xul
blob: cee01d41a2e4dfb2d2a3fd0645270e16c0e01c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet 
  href="chrome://mochikit/content/tests/SimpleTest/test.css"
  type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=476634
-->
<window title="Mozilla Bug 476634" onload="startup()"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/javascript" 
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      

<body  xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" 
   href="https://bugzilla.mozilla.org/show_bug.cgi?id=304188">Mozilla Bug 476634</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<template id="test-template">
  <query>SELECT id,value FROM test</query>
  <action>
    <label uri="?" id="?id" value="?value"/>
  </action>
</template>
<vbox id="results-list" datasources="rdf:null" querytype="storage" ref="*"
      template="test-template"/>

<script class="testbody" type="application/javascript">
<![CDATA[
function startup() {
  var ss = Components.classes["@mozilla.org/storage/service;1"]
                     .getService(Components.interfaces.mozIStorageService);
  var db = ss.openSpecialDatabase("memory");
  
  db.createTable("test", "id TEXT, value INTEGER");
  var stmt = db.createStatement("INSERT INTO test (id, value) VALUES (?,?)");
  stmt.bindByIndex(0, "test1");
  stmt.bindByIndex(1, 0);
  stmt.execute();
  stmt.bindByIndex(0, "test2");
  stmt.bindByIndex(1, 2147483647);
  stmt.execute();
  stmt.bindByIndex(0, "test3");
  stmt.bindByIndex(1, -2147483648);
  stmt.execute();
  stmt.bindByIndex(0, "test4");
  stmt.bindByIndex(1, 0);
  stmt.execute();
  stmt.bindByIndex(0, "test5");
  stmt.bindByIndex(1, 3147483647);
  stmt.execute();
  stmt.bindByIndex(0, "test6");
  stmt.bindByIndex(1, -3147483648);
  stmt.execute();
  stmt.finalize();

  var list = document.getElementById("results-list");
  list.builder.datasource = db;

  is(list.childNodes.length, 6, "Should be 6 generated elements");
  is(list.childNodes[0].value, "0", "Should have seen the correct value");
  is(list.childNodes[1].value, "2147483647", "Should have seen the correct value");
  is(list.childNodes[2].value, "-2147483648", "Should have seen the correct value");
  is(list.childNodes[3].value, "0", "Should have seen the correct value");
  is(list.childNodes[4].value, "3147483647", "Should have seen the correct value");
  is(list.childNodes[5].value, "-3147483648", "Should have seen the correct value");
}
]]>
</script>

</window>