~elachuni/lazr-js/treeview

« back to all changes in this revision

Viewing changes to src-js/lazrjs/treeview/tests/treeview.js

  • Committer: Anthony Lenton
  • Date: 2009-11-13 21:09:23 UTC
  • mfrom: (131.1.18 toolchain)
  • Revision ID: anthony.lenton@canonical.com-20091113210923-p1hzo13x2123q25n
Merging changes from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    test_dynamic_creation_html: function() {
68
68
        var theTree = new this.YAHOO.widget.TreeView('theTree');
69
69
        var root = theTree.getRoot();
70
 
        var two = new this.YAHOO.widget.HTMLNode('<i>second</i>', root, false, true);
 
70
        var two = new this.YAHOO.widget.HTMLNode('<i>second</i>', root,
 
71
                                                 false, true);
71
72
        Assert.areEqual(1, theTree.getNodeCount());
72
73
    },
73
74
 
74
75
    test_markup_creation: function() {
75
 
        Y.get('#theTree').set('innerHTML', '<ul><li>One</li><li>Two</li></ul>');
 
76
        Y.get('#theTree').set('innerHTML',
 
77
                              '<ul><li>One</li><li>Two</li></ul>');
76
78
        theTree = new this.YAHOO.widget.TreeView('theTree');
77
79
        Assert.areEqual(2, theTree.getNodeCount());
78
80
    },
79
81
 
80
82
    test_markup_creation_html: function() {
81
 
        Y.get('#theTree').set('innerHTML', '<ul><li>One</li>' +
82
 
                                           '    <li><b>Two (html)</b></li>' +
83
 
                                           '</ul>');
 
83
        Y.get('#theTree').set('innerHTML',
 
84
                              '<ul><li>One</li>' +
 
85
                              '    <li><b>Two (html)</b></li>' +
 
86
                              '</ul>');
84
87
        theTree = new this.YAHOO.widget.TreeView('theTree');
85
88
        Assert.areEqual(2, theTree.getNodeCount());
86
89
    },
87
90
 
88
91
    test_expand: function() {
89
 
        Y.get('#theTree').set('innerHTML', '<ul><li>One<ul><li>One a</li><li>One b</li></ul></li><li>Two</li></ul>');
 
92
        Y.get('#theTree').set('innerHTML',
 
93
                              '<ul><li>One' +
 
94
                              '    <ul><li>One a</li>' +
 
95
                              '        <li>One b</li>' +
 
96
                              '    </ul></li>' +
 
97
                              '    <li>Two</li>' +
 
98
                              '</ul>');
90
99
        theTree = new this.YAHOO.widget.TreeView('theTree');
91
100
        theTree.render();
92
101
        var cross = Y.get('.ygtvspacer');
93
102
        simulate(cross, 'click');
94
 
        Assert.areEqual('block', Y.all('.ygtvchildren').item(1).getStyle('display'));
 
103
        var display = Y.all('.ygtvchildren').item(1).getStyle('display');
 
104
        Assert.areEqual('block', display);
95
105
        simulate(cross, 'click');
96
 
        Assert.areEqual('none', Y.all('.ygtvchildren').item(1).getStyle('display'));
 
106
        display = Y.all('.ygtvchildren').item(1).getStyle('display');
 
107
        Assert.areEqual('none', display);
97
108
    },
98
109
 
99
110
    test_destroy: function() {