~smagoun/whoopsie/whoopsie-lp1017637

« back to all changes in this revision

Viewing changes to backend/stats/static/js/yui/tests/datatable/tests/src/datatable-message.js

  • Committer: Evan Dandrea
  • Date: 2012-05-09 05:53:45 UTC
  • Revision ID: evan.dandrea@canonical.com-20120509055345-z2j41tmcbf4as5uf
The backend now lives in lp:daisy and the website (errors.ubuntu.com) now lives in lp:errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
var suite = new Y.Test.Suite("datatable-message");
2
 
 
3
 
suite.add(new Y.Test.Case({
4
 
    name: "lifecycle and instantiation",
5
 
 
6
 
    "Y.DataTable should be augmented": function () {
7
 
        Y.Assert.isTrue(
8
 
            new Y.DataTable().hasImpl(Y.DataTable.Message));
9
 
    },
10
 
 
11
 
    "Y.DataTable.Base should not be augmented": function () {
12
 
        Y.Assert.isFalse(
13
 
            new Y.DataTable.Base().hasImpl(Y.DataTable.Message));
14
 
    },
15
 
 
16
 
    "Y.DataTable constructor should not error": function () {
17
 
        var table = new Y.DataTable({
18
 
            columns: ['a'],
19
 
            data: [{a:1}]
20
 
        });
21
 
 
22
 
        Y.Assert.isInstanceOf(Y.DataTable, table);
23
 
        Y.Assert.isTrue(table.hasImpl(Y.DataTable.Message));
24
 
    },
25
 
 
26
 
    "test showMessaegs values": function () {
27
 
        var config = {
28
 
                columns: ['a'],
29
 
                data: [{a:1}]
30
 
            }, table;
31
 
 
32
 
        table = new Y.DataTable(config);
33
 
 
34
 
        Y.Assert.isTrue(table.get('showMessages'));
35
 
 
36
 
        config.showMessages = false;
37
 
        table = new Y.DataTable(config);
38
 
 
39
 
        Y.Assert.isFalse(table.get('showMessages'));
40
 
 
41
 
        config.showMessages = true;
42
 
        table = new Y.DataTable(config);
43
 
 
44
 
        Y.Assert.isTrue(table.get('showMessages'));
45
 
 
46
 
        config.showMessages = 'bogus';
47
 
        table = new Y.DataTable(config);
48
 
 
49
 
        Y.Assert.isTrue(table.get('showMessages'));
50
 
 
51
 
        config.showMessages = { create: true, update: true, 'delete': false };
52
 
        table = new Y.DataTable(config);
53
 
 
54
 
        Y.Assert.isTrue(table.get('showMessages'));
55
 
    },
56
 
 
57
 
    "test set('showMessages')": function () {
58
 
        var table = new Y.DataTable({
59
 
                columns: ['a'],
60
 
                data: [{a:1}]
61
 
            });
62
 
 
63
 
        Y.Assert.isTrue(table.get('showMessages'));
64
 
 
65
 
        table.set('showMessages', false);
66
 
        Y.Assert.isFalse(table.get('showMessages'));
67
 
 
68
 
        table.set('showMessages', true);
69
 
        Y.Assert.isTrue(table.get('showMessages'));
70
 
 
71
 
        table.set('showMessages', 'empty');
72
 
        Y.Assert.isTrue(table.get('showMessages'));
73
 
 
74
 
        table.set('showMessages', { empty: true, loading: false });
75
 
        Y.Assert.isTrue(table.get('showMessages'));
76
 
    }
77
 
}));
78
 
suite.add(new Y.Test.Case({
79
 
    name: "datatable-message",
80
 
 
81
 
    "test showMessage()": function () {
82
 
        
83
 
    },
84
 
 
85
 
    "test showMessage(string)": function () {
86
 
        
87
 
    },
88
 
 
89
 
    "test showMessage(intlString)": function () {
90
 
        
91
 
    },
92
 
 
93
 
    "test hideMessage()": function () {
94
 
    },
95
 
 
96
 
    "adding rows should hide the message": function () {
97
 
 
98
 
    },
99
 
 
100
 
    "removing all rows should show the emptyMessage": function () {
101
 
 
102
 
    }
103
 
}));
104
 
 
105
 
Y.Test.Runner.add(suite);