Mercurial > bugzilla-dashboard
annotate js/black-box.js @ 102:00b02ba5236c
made all delegates have a dotted name (namespaced), modified black-box.js a bit
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Wed, 28 Apr 2010 20:06:26 -0700 |
parents | 106a0018e601 |
children | a994fc89f341 |
rev | line source |
---|---|
99
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
1 function onDashboardLoaded(dashboard, options) { |
100
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
2 var require = Require.build(Require.modules, {window: window}); |
99
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
3 |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
4 // Needed for Firebug, which won't log iframe errors to the console. |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
5 $(dashboard).error( |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
6 function(event) { |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
7 console.warn("An error occurred in the dashboard iframe."); |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
8 }); |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
9 |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
10 var moduleExports = {}; |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
11 var dbrequire = dashboard.Require.build(dashboard.Require.modules, |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
12 moduleExports); |
100
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
13 |
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
14 function delegate(method, args) { |
102
00b02ba5236c
made all delegates have a dotted name (namespaced), modified black-box.js a bit
Atul Varma <avarma@mozilla.com>
parents:
101
diff
changeset
|
15 console.log(method, args); |
100
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
16 } |
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
17 |
101
106a0018e601
Get rid of any form values cached by the browser.
Atul Varma <avarma@mozilla.com>
parents:
100
diff
changeset
|
18 // Get rid of any form values cached by the browser. |
106a0018e601
Get rid of any form values cached by the browser.
Atul Varma <avarma@mozilla.com>
parents:
100
diff
changeset
|
19 options.jQuery("input[type=text], input[type=password]").val(""); |
106a0018e601
Get rid of any form values cached by the browser.
Atul Varma <avarma@mozilla.com>
parents:
100
diff
changeset
|
20 |
100
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
21 var ajaxImpl = require("mocks/bugzilla/trivial").makeAjaxImpl(); |
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
22 options.cache = require("mocks/cache").create(delegate); |
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
23 options.Bugzilla = require("mocks/bugzilla").create(options.Bugzilla, |
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
24 ajaxImpl, |
c486d35fad27
added more mocks; black-box now talks to a really simple fake bugzilla 'server'.
Atul Varma <avarma@mozilla.com>
parents:
99
diff
changeset
|
25 delegate); |
99
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
26 dbrequire("date-utils").now = function() { |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
27 return new Date("Tue Apr 27 2010 09:00:00 GMT"); |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
28 }; |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
29 dbrequire("app/loader").init(moduleExports, options); |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
30 } |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
31 |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
32 $(window).ready( |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
33 function() { |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
34 var iframe = $("#dashboard").get(0); |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
35 iframe.src = "index.html?testing=1"; |
544d339d2b4c
Added the beginnings of a black-box app that can be used to generate/run functional tests.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
36 }); |