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

Unified Diff: remoting/webapp/crd/js/host_table_entry_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: Async test migration 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
Index: remoting/webapp/crd/js/host_table_entry_unittest.js
diff --git a/remoting/webapp/crd/js/host_table_entry_unittest.js b/remoting/webapp/crd/js/host_table_entry_unittest.js
index 9f36d78daf25048ced4c89d497e60ee599dcd62e..93c861f0ff8555fa7c6c77b5a5a7af01c73277c3 100644
--- a/remoting/webapp/crd/js/host_table_entry_unittest.js
+++ b/remoting/webapp/crd/js/host_table_entry_unittest.js
@@ -12,8 +12,8 @@ var onConnect_ = null;
var onRename_ = null;
var onDelete_ = null;
-module('HostTableEntry', {
- setup: function() {
+QUnit.module('HostTableEntry', {
+ beforeEach: function() {
onConnect_ = /** @type {function(string)} */ (sinon.spy());
onRename_ = /** @type {function(remoting.HostTableEntry)} */ (sinon.spy());
onDelete_ = /** @type {function(remoting.HostTableEntry)} */ (sinon.spy());
@@ -32,7 +32,7 @@ module('HostTableEntry', {
return tag;
});
},
- teardown: function() {
+ afterEach: function() {
hostTableEntry_.dispose();
hostTableEntry_ = null;
$testStub(chrome.i18n.getMessage).restore();
@@ -74,7 +74,8 @@ function verifyVisible(
'Element ' + opt_name + ' should be ' + expectedVisibility);
}
-test('Clicking on the confirm button in the confirm dialog deletes the host',
+QUnit.test(
+ 'Clicking on the confirm button in the confirm dialog deletes the host',
function() {
// Setup.
sinon.stub(remoting, 'setMode', function(/** remoting.AppMode */ mode) {
@@ -93,7 +94,7 @@ test('Clicking on the confirm button in the confirm dialog deletes the host',
$testStub(remoting.setMode).restore();
});
-test(
+QUnit.test(
'Clicking on the cancel button in the confirm dialog cancels host deletion',
function() {
// Setup.
@@ -113,7 +114,7 @@ test(
$testStub(remoting.setMode).restore();
});
-test('Clicking on the rename button shows the input field.', function() {
+QUnit.test('Clicking on the rename button shows the input field.', function() {
// Invoke.
hostTableEntry_.element().querySelector('.rename-button').click();
@@ -125,7 +126,7 @@ test('Clicking on the rename button shows the input field.', function() {
QUnit.equal(document.activeElement, inputField);
});
-test('Host renaming is canceled on ESCAPE key.', function() {
+QUnit.test('Host renaming is canceled on ESCAPE key.', function() {
// Invoke.
var inputField =
hostTableEntry_.element().querySelector('.host-rename-input');
@@ -138,7 +139,7 @@ test('Host renaming is canceled on ESCAPE key.', function() {
verifyVisible(inputField, false, 'inputField');
});
-test('Host renaming commits on ENTER.', function() {
+QUnit.test('Host renaming commits on ENTER.', function() {
// Invoke.
var inputField =
hostTableEntry_.element().querySelector('.host-rename-input');
@@ -155,19 +156,19 @@ test('Host renaming commits on ENTER.', function() {
sinon.assert.notCalled(onConnect_);
});
-test('HostTableEntry renders the host name correctly.', function() {
+QUnit.test('HostTableEntry renders the host name correctly.', function() {
var label = hostTableEntry_.element().querySelector('.host-name-label');
QUnit.equal(label.innerText, 'LocalHost');
});
-test('HostTableEntry renders an offline host correctly.', function() {
+QUnit.test('HostTableEntry renders an offline host correctly.', function() {
setHost('LocalHost', 'OFFLINE', 'INITIALIZATION_FAILED');
var label = hostTableEntry_.element().querySelector('.host-name-label');
QUnit.equal(label.innerText, 'OFFLINE');
QUnit.equal(label.title, 'OFFLINE_REASON_INITIALIZATION_FAILED');
});
-test('HostTableEntry renders an out-of-date host correctly', function() {
+QUnit.test('HostTableEntry renders an out-of-date host correctly', function() {
sinon.stub(remoting.Host, 'needsUpdate').returns(true);
setHost('LocalHost', 'ONLINE');
var warningOverlay =
@@ -177,19 +178,19 @@ test('HostTableEntry renders an out-of-date host correctly', function() {
QUnit.equal(label.innerText, 'UPDATE_REQUIRED');
});
-test('Clicking on an online host connects it', function() {
+QUnit.test('Clicking on an online host connects it', function() {
hostTableEntry_.element().querySelector('.host-name-label').click();
sinon.assert.calledWith(onConnect_,
encodeURIComponent(hostTableEntry_.host.hostId));
});
-test('Clicking on an offline host should be a no-op', function() {
+QUnit.test('Clicking on an offline host should be a no-op', function() {
setHost('LocalHost', 'OFFLINE');
hostTableEntry_.element().querySelector('.host-name-label').click();
sinon.assert.notCalled(onConnect_);
});
-test('HostTableEntry handles host that is null', function() {
+QUnit.test('HostTableEntry handles host that is null', function() {
hostTableEntry_.setHost(null);
hostTableEntry_.element().querySelector('.host-name-label').click();
sinon.assert.notCalled(onConnect_);

Powered by Google App Engine
This is Rietveld 408576698