File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments