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

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

Issue 1017613002: Migrate Remoting Webapp Unittests to use QUnit 2.0 syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Migrate to assert Created 5 years, 9 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/crd/js/l10n_unittest.js ('k') | remoting/webapp/crd/js/xhr_unittest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/menu_button_unittest.js
diff --git a/remoting/webapp/crd/js/menu_button_unittest.js b/remoting/webapp/crd/js/menu_button_unittest.js
index 1367b0da40b42c62eeae3573814eed7f58b26fe7..c6646188ab0a398eb3dd24350293d6dd8e11510a 100644
--- a/remoting/webapp/crd/js/menu_button_unittest.js
+++ b/remoting/webapp/crd/js/menu_button_unittest.js
@@ -13,8 +13,8 @@ var onHide = null;
/** @type {remoting.MenuButton} */
var menuButton = null;
-module('MenuButton', {
- setup: function() {
+QUnit.module('MenuButton', {
+ beforeEach: function() {
var fixture = document.getElementById('qunit-fixture');
fixture.innerHTML =
'<span class="menu-button" id="menu-button-container">' +
@@ -30,28 +30,29 @@ module('MenuButton', {
/** @type {function():void} */ (onShow),
/** @type {function():void} */ (onHide));
},
- teardown: function() {
+ afterEach: function() {
onShow = null;
onHide = null;
menuButton = null;
}
});
-test('should display on click', function() {
+QUnit.test('should display on click', function(assert) {
var menu = menuButton.menu();
- ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
+ assert.ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
menuButton.button().click();
- ok(menu.offsetWidth != 0 && menu.offsetHeight != 0);
+ assert.ok(menu.offsetWidth != 0 && menu.offsetHeight != 0);
});
-test('should dismiss when the menu is clicked', function() {
+QUnit.test('should dismiss when the menu is clicked', function(assert) {
var menu = menuButton.menu();
menuButton.button().click();
menu.click();
- ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
+ assert.ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
});
-test('should dismiss when anything outside the menu is clicked', function() {
+QUnit.test('should dismiss when anything outside the menu is clicked',
+ function(assert) {
var menu = menuButton.menu();
menuButton.button().click();
var x = menu.offsetRight + 1;
@@ -59,36 +60,36 @@ test('should dismiss when anything outside the menu is clicked', function() {
var notMenu = document.elementFromPoint(x, y);
base.debug.assert(notMenu != menu);
notMenu.click();
- ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
+ assert.ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
});
-test('should dismiss when menu item is clicked', function() {
+QUnit.test('should dismiss when menu item is clicked', function(assert) {
var menu = menuButton.menu();
menuButton.button().click();
var element = document.getElementById('menu-option-1');
element.click();
- ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
+ assert.ok(menu.offsetWidth == 0 && menu.offsetHeight == 0);
});
-test('should invoke callbacks', function() {
- ok(!onShow.called);
+QUnit.test('should invoke callbacks', function(assert) {
+ assert.ok(!onShow.called);
menuButton.button().click();
- ok(onShow.called);
- ok(!onHide.called);
+ assert.ok(onShow.called);
+ assert.ok(!onHide.called);
menuButton.menu().click();
- ok(onHide.called);
+ assert.ok(onHide.called);
});
-test('select method should set/unset background image', function() {
+QUnit.test('select method should set/unset background image', function(assert) {
var element = document.getElementById('menu-option-1');
var style = window.getComputedStyle(element);
- ok(style.backgroundImage == 'none');
+ assert.ok(style.backgroundImage == 'none');
remoting.MenuButton.select(element, true);
style = window.getComputedStyle(element);
- ok(style.backgroundImage != 'none');
+ assert.ok(style.backgroundImage != 'none');
remoting.MenuButton.select(element, false);
style = window.getComputedStyle(element);
- ok(style.backgroundImage == 'none');
+ assert.ok(style.backgroundImage == 'none');
});
}());
« no previous file with comments | « remoting/webapp/crd/js/l10n_unittest.js ('k') | remoting/webapp/crd/js/xhr_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698