Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: remoting/webapp/unittests/menu_button_unittest.js

Issue 339613003: Remove the blue tool-bar for apps v2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made unit-tests side-effect-free. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/toolbar.js ('k') | remoting/webapp/window_frame.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/unittests/menu_button_unittest.js
diff --git a/remoting/webapp/unittests/menu_button_unittest.js b/remoting/webapp/unittests/menu_button_unittest.js
index 9e687a4504656bd047d10a99bd1ecb8ae209de06..48728f8a0f47948e546fcc1f0a756e21273168f0 100644
--- a/remoting/webapp/unittests/menu_button_unittest.js
+++ b/remoting/webapp/unittests/menu_button_unittest.js
@@ -6,8 +6,9 @@
'use strict';
+var onShow = null;
+var onHide = null;
var menuButton = null;
-var menuShown = false;
module('MenuButton', {
setup: function() {
@@ -19,12 +20,16 @@ module('MenuButton', {
'<li id="menu-option-1">Option 1</li>' +
'</ul>' +
'</span>';
+ onShow = sinon.spy();
+ onHide = sinon.spy();
menuButton = new remoting.MenuButton(
document.getElementById('menu-button-container'),
- function() { menuShown = true; });
- menuShown = false;
+ onShow, onHide);
},
teardown: function() {
+ onShow = null;
+ onHide = null;
+ menuButton = null;
}
});
@@ -57,10 +62,13 @@ test('should dismiss when menu item is clicked', function() {
ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
});
-test('should invoke callback', function() {
- ok(!menuShown);
+test('should invoke callbacks', function() {
+ ok(!onShow.called);
menuButton.button().click();
- ok(menuShown);
+ ok(onShow.called);
+ ok(!onHide.called);
+ document.body.click();
+ ok(onHide.called);
});
test('select method should set/unset background image', function() {
« no previous file with comments | « remoting/webapp/toolbar.js ('k') | remoting/webapp/window_frame.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698