| 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"); |
| + }); |
| })(); |