~gary/juju-gui/service-header

« back to all changes in this revision

Viewing changes to test/test_utils.js

  • Committer: Gary Poster
  • Date: 2012-09-21 03:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 107.
  • Revision ID: gary.poster@canonical.com-20120921035356-dv7ws5so3ceafw88
now with more linting and less lint!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
'use strict';
2
2
 
3
 
(function () {
 
3
(function() {
4
4
  describe('juju-views-utils', function() {
5
 
      var views, Y;
6
 
      before(function (done) {
7
 
          Y = YUI(GlobalConfig).use(
8
 
              'juju-view-utils', 'node-event-simulate',
9
 
              function(Y) {
10
 
                  views = Y.namespace('juju.views');
11
 
                  done();
12
 
              });
13
 
      });
 
5
    var views, Y;
 
6
    before(function(done) {
 
7
      Y = YUI(GlobalConfig).use(
 
8
          'juju-view-utils', 'node-event-simulate',
 
9
          function(Y) {
 
10
            views = Y.namespace('juju.views');
 
11
            done();
 
12
          });
 
13
    });
14
14
 
15
 
      it('should create a confirmation panel',
16
 
      function() {
 
15
    it('should create a confirmation panel',
 
16
       function() {
17
17
          var confirmed = false;
18
18
          var panel = views.createModalPanel(
19
19
              'Description',
20
20
              '#main',
21
21
              'Action Label',
22
22
              function() {confirmed = true;}
23
 
          );
 
23
         );
24
24
          panel.show();
25
25
          var panel_node = panel.get('boundingBox'),
26
26
              button = panel_node.one('.btn-danger');
28
28
          button.simulate('click');
29
29
          confirmed.should.equal(true);
30
30
          panel.destroy();
31
 
    });
 
31
       });
32
32
 
33
33
    it('should hide the panel when the Cancel button is clicked',
34
 
      function() {
 
34
       function() {
35
35
          var confirmed = false;
36
36
          var panel = views.createModalPanel(
37
37
              'Description',
38
38
              '#main',
39
39
              'Action Label',
40
40
              function() {confirmed = true;}
41
 
          );
 
41
         );
42
42
          panel.show();
43
43
          var panel_node = panel.get('boundingBox'),
44
44
              button = panel_node.one('.btn:not(.btn-danger)');
46
46
          button.simulate('click');
47
47
          confirmed.should.equal(false);
48
48
          panel.destroy();
49
 
      });
 
49
       });
50
50
 
51
51
  });
52
52
}) ();