~launchpad-pqm/launchpad/devel

13885.3.4 by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate.
1
/* Copyright (c) 2011, Canonical Ltd. All rights reserved. */
2
3
YUI({
4
    base: '../../../../canonical/launchpad/icing/yui/',
5
    filter: 'raw',
6
    combine: false,
7
    fetchCSS: false
8
9
// Don't forget to add the module under test to the use() clause.
10
11
      }).use('event', 'lp.client', 'node', 'test', 'widget-stack',
12
             'console', function(Y) {
13
14
// Local aliases
15
var Assert = Y.Assert,
16
    ArrayAssert = Y.ArrayAssert;
17
18
var suite = new Y.Test.Suite("YOUR TEST SUITE NAME");
19
20
suite.add(new Y.Test.Case({
21
22
    name: 'A TEST CASE NAME',
23
24
    setUp: function() {
25
        // Monkeypatch LP to avoid network traffic and to make
26
        // some things work as expected.
27
        Y.lp.client.Launchpad.prototype.named_post =
28
          function(url, func, config) {
29
            config.on.success();
30
          };
31
        LP = {
32
          'cache': {
33
            'bug': {
34
              self_link: "http://bugs.example.com/bugs/1234"
35
          }}};
36
    },
37
38
    tearDown: function() {
39
    },
40
41
    /**
42
     * The choice edit should be displayed inline.
43
     */
44
    test_something: function() {
45
        // Test something
46
    },
47
48
}));
49
50
var handle_complete = function(data) {
51
    window.status = '::::' + JSON.stringify(data);
52
    };
53
Y.Test.Runner.on('complete', handle_complete);
54
Y.Test.Runner.add(suite);
55
56
var yconsole = new Y.Console({
57
    newestOnTop: false
58
});
59
yconsole.render('#log');
60
61
Y.on('domready', function() {
62
    Y.Test.Runner.run();
63
});
64
65
});