~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/javascript/tests/test_personpicker.js

[r=deryck][no-qa] Fix the person picker JS test to clean up the DOM
        after running each test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
    }).use('test', 'console', 'plugin', 'lp.app.widgets',
10
10
           'node-event-simulate', function(Y) {
11
11
 
12
 
    var suite = new Y.Test.Suite("lp.app.widgets.PersonPicker Tests");
 
12
    var suite = new Y.Test.Suite("PersonPicker Tests");
13
13
 
14
14
    suite.add(new Y.Test.Case({
15
 
        name: 'personpicker',
 
15
        name: 'Basic Functions',
16
16
 
17
17
        setUp: function() {
18
18
            window.LP = {
30
30
            Y.Assert.isNotNull(Y.one('.extra-form-buttons'));
31
31
            Y.Assert.isNotUndefined(personpicker.assign_me_button);
32
32
            Y.Assert.isNotUndefined(personpicker.remove_button);
 
33
            personpicker.destroy();
33
34
        },
34
35
 
35
36
        test_search_field_focus: function () {
43
44
            });
44
45
            personpicker.show();
45
46
            Y.Assert.isTrue(got_focus, "search input did not get focus.");
 
47
            personpicker.destroy();
46
48
        },
47
49
 
48
50
        test_buttons: function () {
74
76
            personpicker = new Y.lp.app.widgets.PersonPicker(cfg);
75
77
            personpicker.render();
76
78
            personpicker.show();
77
 
            
 
79
 
78
80
            Y.Assert.isNotNull(Y.one('.extra-form-buttons'));
79
81
            Y.Assert.isUndefined(personpicker.remove_button);
80
82
            Y.Assert.isUndefined(personpicker.assign_me_button);
81
 
 
 
83
            personpicker.destroy();
82
84
        }
83
85
    }));
84
86
 
85
 
    // Lock, stock, and two smoking barrels.
 
87
    // Hook for the test runner to get test results.
86
88
    var handle_complete = function(data) {
87
89
        window.status = '::::' + JSON.stringify(data);
88
90
    };