Update QUnit syntax in strings tests

This commit is contained in:
nein09 2017-12-01 16:52:34 -08:00
parent 2af7db43a4
commit c29715cbe8

View File

@ -1,44 +1,44 @@
/* global module, asyncTest, $, ok, equal, notEqual, start, test, Util, testLog */ /* global QUnit, testLog */
(function() { (function() {
module("strings", { QUnit.module("strings", {
setup: function () { beforeEach: function () {
testLog.reset(); testLog.reset();
} }
}); });
test("getSubString", function() { QUnit.test("getSubString", function(assert) {
equal(OpenSeadragon.getString("Errors.Dzi"), assert.equal(OpenSeadragon.getString("Errors.Dzi"),
"Hmm, this doesn't appear to be a valid Deep Zoom Image.", "Hmm, this doesn't appear to be a valid Deep Zoom Image.",
"Read sub-string"); "Read sub-string");
}); });
test("getStringWithPlaceholders", function() { QUnit.test("getStringWithPlaceholders", function(assert) {
equal(OpenSeadragon.getString("Errors.OpenFailed", "foo", "bar"), assert.equal(OpenSeadragon.getString("Errors.OpenFailed", "foo", "bar"),
"Unable to open foo: bar", "Unable to open foo: bar",
"String placeholder replacement"); "String placeholder replacement");
}); });
test("getInvalidString", function() { QUnit.test("getInvalidString", function(assert) {
equal(OpenSeadragon.getString("Greeting"), "", "Handled unset string key"); assert.equal(OpenSeadragon.getString("Greeting"), "", "Handled unset string key");
ok(testLog.log.contains('["Untranslated source string:","Greeting"]'), assert.ok(testLog.log.contains('["Untranslated source string:","Greeting"]'),
'Invalid string keys are logged'); 'Invalid string keys are logged');
equal(OpenSeadragon.getString("Errors"), "", "Handled requesting parent key"); assert.equal(OpenSeadragon.getString("Errors"), "", "Handled requesting parent key");
ok(testLog.log.contains('["Untranslated source string:","Errors"]'), assert.ok(testLog.log.contains('["Untranslated source string:","Errors"]'),
'Invalid string parent keys are logged'); 'Invalid string parent keys are logged');
}); });
test("setString", function() { QUnit.test("setString", function(assert) {
OpenSeadragon.setString("Greeting", "Hello world"); OpenSeadragon.setString("Greeting", "Hello world");
equal(OpenSeadragon.getString("Greeting"), "Hello world", assert.equal(OpenSeadragon.getString("Greeting"), "Hello world",
"Set a string"); "Set a string");
}); });
test("setSubString", function() { QUnit.test("setSubString", function(assert) {
OpenSeadragon.setString("CustomGreeting.Hello", "Hello world"); OpenSeadragon.setString("CustomGreeting.Hello", "Hello world");
equal(OpenSeadragon.getString("CustomGreeting.Hello"), "Hello world", assert.equal(OpenSeadragon.getString("CustomGreeting.Hello"), "Hello world",
"Set a sub-string"); "Set a sub-string");
}); });