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

Unified Diff: remoting/webapp/crd/js/l10n_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/identity_unittest.js ('k') | remoting/webapp/crd/js/menu_button_unittest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/l10n_unittest.js
diff --git a/remoting/webapp/crd/js/l10n_unittest.js b/remoting/webapp/crd/js/l10n_unittest.js
index 78ea48e2c36bf39d82d0e9daa700165e34daa97a..bbb1425e1779a6de20912f191bb8fb1dd975b605 100644
--- a/remoting/webapp/crd/js/l10n_unittest.js
+++ b/remoting/webapp/crd/js/l10n_unittest.js
@@ -6,46 +6,47 @@
'use strict';
-module('l10n', {
- setup: function() {
+QUnit.module('l10n', {
+ beforeEach: function() {
sinon.stub(chrome.i18n, 'getMessage');
},
- teardown: function() {
+ afterEach: function() {
$testStub(chrome.i18n.getMessage).restore();
}
});
-test('getTranslationOrError(tag) should return tag on error', function() {
+QUnit.test('getTranslationOrError(tag) should return tag on error',
+ function(assert) {
var translation = l10n.getTranslationOrError('non_existent_tag');
- equal(translation, 'non_existent_tag');
+ assert.equal(translation, 'non_existent_tag');
});
-test('localizeElementFromTag() should replace innerText by default',
- function() {
+QUnit.test('localizeElementFromTag() should replace innerText by default',
+ function(assert) {
var element = document.createElement('div');
$testStub(chrome.i18n.getMessage).withArgs('tag')
.returns('<b>Hello World</b>');
l10n.localizeElementFromTag(element, 'tag');
- equal(element.innerHTML, '&lt;b&gt;Hello World&lt;/b&gt;');
+ assert.equal(element.innerHTML, '&lt;b&gt;Hello World&lt;/b&gt;');
});
-test('localizeElementFromTag() should replace innerHTML if flag is set',
- function() {
+QUnit.test('localizeElementFromTag() should replace innerHTML if flag is set',
+ function(assert) {
var element = document.createElement('div');
$testStub(chrome.i18n.getMessage).withArgs('tag')
.returns('<b>Hello World</b>');
l10n.localizeElementFromTag(element, 'tag', null, true);
- equal(element.innerHTML, '<b>Hello World</b>');
+ assert.equal(element.innerHTML, '<b>Hello World</b>');
});
-test(
+QUnit.test(
'localizeElement() should replace innerText using the "i18n-content" ' +
'attribute as the tag',
- function() {
+ function(assert) {
var element = document.createElement('div');
element.setAttribute('i18n-content', 'tag');
$testStub(chrome.i18n.getMessage).withArgs('tag')
@@ -53,13 +54,13 @@ test(
l10n.localizeElement(element);
- equal(element.innerHTML, '&lt;b&gt;Hello World&lt;/b&gt;');
+ assert.equal(element.innerHTML, '&lt;b&gt;Hello World&lt;/b&gt;');
});
-test(
+QUnit.test(
'localize() should replace element title using the "i18n-title" ' +
'attribute as the tag',
- function() {
+ function(assert) {
var fixture = document.getElementById('qunit-fixture');
fixture.innerHTML = '<div class="target" i18n-title="tag"></div>';
$testStub(chrome.i18n.getMessage)
@@ -69,10 +70,10 @@ test(
l10n.localize();
var target = document.querySelector('.target');
- equal(target.title, 'localized title');
+ assert.equal(target.title, 'localized title');
});
-test('localize() should support string substitutions', function() {
+QUnit.test('localize() should support string substitutions', function(assert) {
var fixture = document.getElementById('qunit-fixture');
fixture.innerHTML =
'<div class="target" ' +
@@ -87,10 +88,10 @@ test('localize() should support string substitutions', function() {
l10n.localize();
var target = document.querySelector('.target');
- equal(target.innerText, 'localized');
+ assert.equal(target.innerText, 'localized');
});
-test('localize() should support tag substitutions', function() {
+QUnit.test('localize() should support tag substitutions', function(assert) {
var fixture = document.getElementById('qunit-fixture');
fixture.innerHTML =
'<div class="target" i18n-content="tag"' +
@@ -105,7 +106,7 @@ test('localize() should support tag substitutions', function() {
l10n.localize();
var target = document.querySelector('.target');
- equal(target.innerText, 'localized');
+ assert.equal(target.innerText, 'localized');
});
})();
« no previous file with comments | « remoting/webapp/crd/js/identity_unittest.js ('k') | remoting/webapp/crd/js/menu_button_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698