Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(77)

Side by Side Diff: test/test_utils.js

Issue 16940043: Remove bootstrap (Closed)
Patch Set: Remove bootstrap Created 11 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/test_environment_view.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 This file is part of the Juju GUI, which lets users view and manage Juju 2 This file is part of the Juju GUI, which lets users view and manage Juju
3 environments within a graphical interface (https://launchpad.net/juju-gui). 3 environments within a graphical interface (https://launchpad.net/juju-gui).
4 Copyright (C) 2012-2013 Canonical Ltd. 4 Copyright (C) 2012-2013 Canonical Ltd.
5 5
6 This program is free software: you can redistribute it and/or modify it under 6 This program is free software: you can redistribute it and/or modify it under
7 the terms of the GNU Affero General Public License version 3, as published by 7 the terms of the GNU Affero General Public License version 3, as published by
8 the Free Software Foundation. 8 the Free Software Foundation.
9 9
10 This program is distributed in the hope that it will be useful, but WITHOUT 10 This program is distributed in the hope that it will be useful, but WITHOUT
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 function() { 59 function() {
60 var confirmed = false; 60 var confirmed = false;
61 var panel = views.createModalPanel( 61 var panel = views.createModalPanel(
62 'Description', 62 'Description',
63 '#main', 63 '#main',
64 'Action Label', 64 'Action Label',
65 function() {confirmed = true;} 65 function() {confirmed = true;}
66 ); 66 );
67 panel.show(); 67 panel.show();
68 var panel_node = panel.get('boundingBox'), 68 var panel_node = panel.get('boundingBox'),
69 button = panel_node.one('.btn-danger'); 69 button = panel_node.all('.button').item(0);
70 button.getHTML().should.equal('Action Label'); 70 button.getHTML().should.equal('Action Label');
71 button.simulate('click'); 71 button.simulate('click');
72 confirmed.should.equal(true); 72 confirmed.should.equal(true);
73 panel.destroy(); 73 panel.destroy();
74 }); 74 });
75 75
76 it('should hide the panel when the Cancel button is clicked', 76 it('should hide the panel when the Cancel button is clicked',
77 function() { 77 function() {
78 var confirmed = false; 78 var confirmed = false;
79 var panel = views.createModalPanel( 79 var panel = views.createModalPanel(
80 'Description', 80 'Description',
81 '#main', 81 '#main',
82 'Action Label', 82 'Action Label',
83 function() {confirmed = true;}); 83 function() {confirmed = true;});
84 panel.show(); 84 panel.show();
85 var panel_node = panel.get('boundingBox'), 85 var panel_node = panel.get('boundingBox'),
86 button = panel_node.one('.btn:not(.btn-danger)'); 86 button = panel_node.all('.button').item(1);
87 button.getHTML().should.equal('Cancel'); 87 button.getHTML().should.equal('Cancel');
88 button.simulate('click'); 88 button.simulate('click');
89 confirmed.should.equal(false); 89 confirmed.should.equal(false);
90 panel.destroy(); 90 panel.destroy();
91 }); 91 });
92 92
93 it('should allow you to reset the buttons', function() { 93 it('should allow you to reset the buttons', function() {
94 var confirmed = false; 94 var confirmed = false;
95 var panel = views.createModalPanel( 95 var panel = views.createModalPanel(
96 'Description', 96 'Description',
97 '#main', 97 '#main',
98 'First Action Label', 98 'First Action Label',
99 function() {confirmed = false;}); 99 function() {confirmed = false;});
100 panel.get('buttons').footer.length.should.equal(2); 100 panel.get('buttons').footer.length.should.equal(2);
101 views.setModalButtons( 101 views.setModalButtons(
102 panel, 'Second Action Label', function() { confirmed = true; }); 102 panel, 'Second Action Label', function() { confirmed = true; });
103 panel.get('buttons').footer.length.should.equal(2); 103 panel.get('buttons').footer.length.should.equal(2);
104 panel.show(); 104 panel.show();
105 var panel_node = panel.get('boundingBox'), 105 var panel_node = panel.get('boundingBox'),
106 button = panel_node.one('.btn-danger'); 106 button = panel_node.all('.button').item(0);
107 button.getHTML().should.equal('Second Action Label'); 107 button.getHTML().should.equal('Second Action Label');
108 button.simulate('click'); 108 button.simulate('click');
109 confirmed.should.equal(true); 109 confirmed.should.equal(true);
110 panel.destroy(); 110 panel.destroy();
111 }); 111 });
112 112
113 }); 113 });
114 }) (); 114 }) ();
115 115
116 describe('utilities', function() { 116 describe('utilities', function() {
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 it('creates a notification if bundle import if not successful', 1423 it('creates a notification if bundle import if not successful',
1424 function(done) { 1424 function(done) {
1425 utils.deployBundleCallback({ 1425 utils.deployBundleCallback({
1426 add: function() { 1426 add: function() {
1427 done(); 1427 done();
1428 }}, {err: true}); 1428 }}, {err: true});
1429 }); 1429 });
1430 }); 1430 });
1431 1431
1432 })(); 1432 })();
OLDNEW
« no previous file with comments | « test/test_environment_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b