~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/javascript/testing/testrunner.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-08 19:26:35 UTC
  • mfrom: (13314.12.13 yui-test-cleanup-807294)
  • Revision ID: launchpad@pqm.canonical.com-20110708192635-acgqrciig42izbsh
[r=jtv][bug=807294] Consolidate duplicate code copied throughout the
        lp yui tests into a common module.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2011, Canonical Ltd. All rights reserved. */
 
2
 
 
3
var YUI_config = {
 
4
    filter: 'raw',
 
5
    combine: false,
 
6
    fetchCSS: false
 
7
};
 
8
 
 
9
YUI.add("lp.testing.runner", function(Y) {
 
10
 
 
11
/**
 
12
 * Testing utilities.
 
13
 *
 
14
 * @module lp.testing
 
15
 * @namespace lp
 
16
 */
 
17
 
 
18
var Runner = Y.namespace("lp.testing.Runner");
 
19
 
 
20
Runner.run = function(suite) {
 
21
 
 
22
    // Lock, stock, and two smoking barrels.
 
23
    var handle_complete = function(data) {
 
24
        window.status = '::::' + JSON.stringify(data);
 
25
        };
 
26
    Y.Test.Runner.on('complete', handle_complete);
 
27
    Y.Test.Runner.add(suite);
 
28
 
 
29
    Y.on("domready", function() {
 
30
        var log = Y.Node.create('<div></div>');
 
31
        Y.one(document.body).appendChild(log);
 
32
        var yconsole = new Y.Console({
 
33
            newestOnTop: false,
 
34
            useBrowserConsole: true
 
35
        });
 
36
        yconsole.render(log);
 
37
        Y.Test.Runner.run();
 
38
    });
 
39
};
 
40
 
 
41
}, "0.1", {"requires": ["oop", "test", "console"]});