Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/tests/notification.js

Issue 11174072: Test Notification.getLocalizedTexts (Closed)
Patch Set: Created July 19, 2013, 1:53 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/tests/notification.js
===================================================================
--- a/chrome/content/tests/notification.js
+++ b/chrome/content/tests/notification.js
@@ -8,7 +8,7 @@
let originalAddonVersion;
let info = require("info");
- module("Notification",
+ module("Notification handling",
{
setup: function()
{
@@ -210,4 +210,31 @@
deepEqual(Notification.getNextToShow(), information, "Critical notification is ignored if maxVersion doesn't match");
deepEqual(Notification.getNextToShow(), null, "Critical notification still ignored even if no other notifications available");
});
+
+ module("Notification localization");
+
+ test("Language only", function()
+ {
+ let notification = {message: {en: "en"}};
+ let texts = Notification.getLocalizedTexts(notification, "en");
+ equal(texts.message, "en");
+ texts = Notification.getLocalizedTexts(notification, "en-GB");
+ equal(texts.message, "en");
+ });
+
+ test("Language and country", function()
+ {
+ let notification = {message: {en: "en", "en-GB": "en-GB"}};
+ let texts = Notification.getLocalizedTexts(notification, "en-GB");
+ equal(texts.message, "en-GB");
+ texts = Notification.getLocalizedTexts(notification, "en");
+ equal(texts.message, "en");
+ });
+
+ test("Missing translation", function()
+ {
+ let notification = {message: {en: "en"}};
+ let texts = Notification.getLocalizedTexts(notification, "fr");
+ equal(texts.message, "en");
+ });
})();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld