Skip to content

Commit 6f642ac

Browse files
author
ekaterina.pavlenko
committed
Add unit test for not loosing scope on language change
1 parent 6724d53 commit 6f642ac

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/unit/directive.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,17 @@ describe("Directive", function () {
188188
assert.equal(el.text(), "Hello");
189189
});
190190

191+
it("Changing language should translate again not loosing scope", function () {
192+
catalog.setCurrentLanguage("nl");
193+
$rootScope.name = "Ruben";
194+
var el = $compile("<div><div translate>Hello {{name}}!</div></div>")($rootScope);
195+
$rootScope.$digest();
196+
assert.equal(el.text(), "Hallo Ruben!");
197+
catalog.setCurrentLanguage("en");
198+
$rootScope.$digest();
199+
assert.equal(el.text(), "Hello Ruben!");
200+
});
201+
191202
it("Should warn if you forget to add attributes (n)", function () {
192203
assert.throws(function () {
193204
$compile("<div translate translate-plural=\"Hello {{name}} ({{count}} messages)!\">Hello {{name}} (one message)!</div>")($rootScope);

0 commit comments

Comments
 (0)