|
1 <html> |
|
2 <head> |
|
3 <title>IconGrid test page</title> |
|
4 <meta name="viewport" content="initial-scale=1.0"/> |
|
5 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
|
6 <script type="application/javascript"> |
|
7 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); |
|
8 Components.utils.import("resource://gre/modules/Services.jsm"); |
|
9 Components.utils.import("resource://gre/modules/Prompt.jsm"); |
|
10 |
|
11 function start() { |
|
12 var test = location.hash.substring(1); |
|
13 window[test](); |
|
14 } |
|
15 |
|
16 function test1() { |
|
17 var p = new Prompt({ |
|
18 title: "Prompt 1", |
|
19 buttons: [ |
|
20 "OK" |
|
21 ], |
|
22 }).addIconGrid({ |
|
23 items: [ |
|
24 { iconUri: "drawable://alert_app", name: "Icon 1", selected: true }, |
|
25 { iconUri: "drawable://alert_download", name: "Icon 2" }, |
|
26 { iconUri: "drawable://alert_addon", name: "Icon 3" }, |
|
27 { iconUri: "drawable://alert_addon", name: "Icon 4" }, |
|
28 { iconUri: "drawable://alert_addon", name: "Icon 5" }, |
|
29 { iconUri: "drawable://alert_addon", name: "Icon 6" }, |
|
30 { iconUri: "drawable://alert_addon", name: "Icon 7" }, |
|
31 { iconUri: "drawable://alert_addon", name: "Icon 8" }, |
|
32 { iconUri: "drawable://alert_addon", name: "Icon 9" }, |
|
33 { iconUri: "drawable://alert_addon", name: "Icon 10" }, |
|
34 { iconUri: "drawable://alert_addon", name: "Icon 11" }, |
|
35 ] |
|
36 }); |
|
37 p.show(function(data) { |
|
38 sendResult(data.icongrid0 == 10, "Got result " + data.icongrid0); |
|
39 }); |
|
40 } |
|
41 |
|
42 function sendResult(pass, message) { |
|
43 setTimeout(function() { |
|
44 alert((pass ? "PASS " : "FAIL ") + message); |
|
45 }, 1000); |
|
46 } |
|
47 </script> |
|
48 </head> |
|
49 <body onload="start();"> |
|
50 </body> |
|
51 </html> |