diff options
| -rw-r--r-- | i18n/e2e/i18n-e2e.js | 106 | ||||
| -rw-r--r-- | i18n/e2e/localeTest_cs.html | 4 | ||||
| -rw-r--r-- | i18n/e2e/localeTest_de.html | 4 | ||||
| -rw-r--r-- | i18n/e2e/localeTest_en.html | 29 | ||||
| -rw-r--r-- | i18n/e2e/localeTest_es.html | 4 | ||||
| -rw-r--r-- | i18n/e2e/localeTest_sk.html | 11 | ||||
| -rw-r--r-- | i18n/e2e/localeTest_zh.html | 26 |
7 files changed, 168 insertions, 16 deletions
diff --git a/i18n/e2e/i18n-e2e.js b/i18n/e2e/i18n-e2e.js index d47030b4..42bcd4e6 100644 --- a/i18n/e2e/i18n-e2e.js +++ b/i18n/e2e/i18n-e2e.js @@ -49,6 +49,48 @@ describe("localized filters", function() { expect(binding('input | number')).toBe('234,234,443,432'); expect(binding('input | currency')).toBe('$234,234,443,432.00'); }); + + + describe('ng:pluralize for en locale', function() { + it('should show pluralized strings', function() { + expect(element('.ng-pluralize:first').html()).toBe('You have one email!'); + + input('plInput').enter('0'); + expect(element('.ng-pluralize:first').html()).toBe('You have no email!'); + + input('plInput').enter('3'); + expect(element('.ng-pluralize:first').html()).toBe('You have 3 emails!'); + }); + + it('should show pluralized strings with offsets', function() { + expect(element('.ng-pluralize:last').html()).toBe('Shanjian is viewing!'); + + input('plInput2').enter('0'); + expect(element('.ng-pluralize:last').html()).toBe('Nobody is viewing!'); + + input('plInput2').enter('2'); + expect(element('.ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!'); + + input('plInput2').enter('3'); + expect(element('.ng-pluralize:last').html()). + toBe('Shanjian, Di and one other person are viewing!'); + + input('plInput2').enter('4'); + expect(element('.ng-pluralize:last').html()). + toBe('Shanjian, Di and 2 other people are viewing!'); + }); + + it('should show pluralized strings with correct data-binding', function() { + input('plInput2').enter('2'); + expect(element('.ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!'); + + input('person1').enter('Igor'); + expect(element('.ng-pluralize:last').html()).toBe('Igor and Di are viewing!'); + + input('person2').enter('Vojta'); + expect(element('.ng-pluralize:last').html()).toBe('Igor and Vojta are viewing!'); + }); + }) }); describe("sk locale", function() { @@ -62,6 +104,32 @@ describe("localized filters", function() { expect(binding('input | number')).toBe('234 234 443 432'); expect(binding('input | currency')).toBe('234 234 443 432,00 Sk'); }); + + + describe('ng:pluralize for sk locale', function() { + it('should show pluralized strings', function() { + expect(element('.ng-pluralize').html()).toBe('Mas jeden email!'); + + input('plInput').enter('0'); + expect(element('.ng-pluralize:first').html()).toBe('Mas 0 emailov!'); + + input('plInput').enter('3'); + expect(element('.ng-pluralize:first').html()).toBe('Mas 3 emaily!'); + + input('plInput').enter('4'); + expect(element('.ng-pluralize:first').html()).toBe('Mas 4 emaily!'); + + input('plInput').enter('6'); + expect(element('.ng-pluralize:first').html()).toBe('Mas 6 emailov!'); + }); + + it('should show pluralized strings with offsets', function() { + //TODO(Igor): add offsets for sk + }); + + it('should show pluralized strings with correct data-binding', function() { + }); + }) }); describe("zh locale", function() { @@ -75,5 +143,43 @@ describe("localized filters", function() { expect(binding('input | number')).toBe('234,234,443,432'); expect(binding('input | currency')).toBe('¥234,234,443,432.00'); }); + + + describe('ng:pluralize for zh locale', function() { + it('should show pluralized strings', function() { + expect(element('.ng-pluralize:first').html()).toBe('1人在浏览该文件!'); + + input('plInput').enter('0'); + expect(element('.ng-pluralize:first').html()).toBe('0人在浏览该文件!'); + + input('plInput').enter('3'); + expect(element('.ng-pluralize:first').html()).toBe('3人在浏览该文件!'); + }); + + it('should show pluralized strings with offsets', function() { + expect(element('.ng-pluralize:last').html()).toBe('Shanjian 在浏览该文件!'); + + input('plInput2').enter('0'); + expect(element('.ng-pluralize:last').html()).toBe('没有人在浏览该文件!'); + + input('plInput2').enter('2'); + expect(element('.ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!'); + + input('plInput2').enter('3'); + expect(element('.ng-pluralize:last').html()). + toBe('Shanjian, Di 还有其他1 人在浏览该文件!'); + }); + + it('should show pluralized strings with correct data-binding', function() { + input('plInput2').enter('2'); + expect(element('.ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!'); + + input('person1').enter('彭迪'); + expect(element('.ng-pluralize:last').html()).toBe('彭迪 和 Di 在浏览该文件!'); + + input('person2').enter('一哥'); + expect(element('.ng-pluralize:last').html()).toBe('彭迪 和 一哥 在浏览该文件!'); + }); + }) }); }); diff --git a/i18n/e2e/localeTest_cs.html b/i18n/e2e/localeTest_cs.html index d224642d..a2e1966e 100644 --- a/i18n/e2e/localeTest_cs.html +++ b/i18n/e2e/localeTest_cs.html @@ -1,6 +1,6 @@ <!document html> <html> - <head> + <head> <meta charset="utf-8"> <title>locale test</title> <script src="../../build/angular.js" ng:autobind></script> @@ -13,4 +13,4 @@ number: {{input | number}}<br> currency: {{input | currency }} </body> -</html> +</html> diff --git a/i18n/e2e/localeTest_de.html b/i18n/e2e/localeTest_de.html index 29e7e807..931c56dd 100644 --- a/i18n/e2e/localeTest_de.html +++ b/i18n/e2e/localeTest_de.html @@ -1,6 +1,6 @@ <!document html> <html> - <head> + <head> <meta charset="utf-8"> <title>locale test</title> <script src="../../build/angular.js" ng:autobind></script> @@ -13,4 +13,4 @@ number: {{input | number}}<br> currency: {{input | currency }} </body> -</html> +</html> diff --git a/i18n/e2e/localeTest_en.html b/i18n/e2e/localeTest_en.html index 1fe867fc..ca151c30 100644 --- a/i18n/e2e/localeTest_en.html +++ b/i18n/e2e/localeTest_en.html @@ -1,6 +1,6 @@ <!document html> <html> - <head> + <head> <meta charset="utf-8"> <title>locale test</title> <script src="../../build/angular.js" ng:autobind></script> @@ -9,10 +9,31 @@ --> </head> <body> + <h3>Datetime/Number/Currency filters demo:</h3> <input type="text" name="input" value="234234443432"><br> - date: {{input | date:"medium"}}<br> - date: {{input | date:"longDate"}}<br> + date(medium): {{input | date:"medium"}}<br> + date(longDate): {{input | date:"longDate"}}<br> number: {{input | number}}<br> currency: {{input | currency }} + <hr/> + <h3>Pluralization demo:</h3> + <input type="text" name="plInput" value="1"><br> + <ng:pluralize count="plInput" + when= "{ '0': 'You have no email!', + 'one': 'You have one email!', + 'other': 'You have {} emails!'}"> + </ng:pluralize> + <hr/> + <h3>Pluralization demo with offsets:</h3> + Name of person1:<input type="text" name="person1" value="Shanjian"/><br/> + Name of person2:<input type="text" name="person2" value="Di"/><br/> + <input type="text" name="plInput2" value="1"><br> + <ng:pluralize count="plInput2" offset=2 + when= "{'0':'Nobody is viewing!', + '1': '{{person1}} is viewing!', + '2': '{{person1}} and {{person2}} are viewing!', + '3': '{{person1}}, {{person2}} and one other person are viewing!', + 'other': '{{person1}}, {{person2}} and {} other people are viewing!'}"> + </ng:pluralize> </body> -</html> +</html> diff --git a/i18n/e2e/localeTest_es.html b/i18n/e2e/localeTest_es.html index c4f7a997..bb426923 100644 --- a/i18n/e2e/localeTest_es.html +++ b/i18n/e2e/localeTest_es.html @@ -1,6 +1,6 @@ <!document html> <html> - <head> + <head> <meta charset="utf-8"> <title>locale test</title> <script src="../../build/angular.js" ng:autobind></script> @@ -13,4 +13,4 @@ number: {{input | number}}<br> currency: {{input | currency }} </body> -</html> +</html> diff --git a/i18n/e2e/localeTest_sk.html b/i18n/e2e/localeTest_sk.html index 6652124b..f9ae87f7 100644 --- a/i18n/e2e/localeTest_sk.html +++ b/i18n/e2e/localeTest_sk.html @@ -1,6 +1,6 @@ <!document html> <html> - <head> + <head> <meta charset="utf-8"> <title>locale test</title> <script src="../../build/angular.js" ng:autobind></script> @@ -12,5 +12,12 @@ date: {{input | date:"longDate"}}<br> number: {{input | number}}<br> currency: {{input | currency }} + <hr/> + <input type="text" name="plInput" value="1"><br> + <ng:pluralize count="plInput" + when= "{ 'one': 'Mas jeden email!', + 'few': 'Mas {} emaily!', + 'other': 'Mas {} emailov!'}"> + </ng:pluralize> </body> -</html> +</html> diff --git a/i18n/e2e/localeTest_zh.html b/i18n/e2e/localeTest_zh.html index 0b2b504d..7e2feec5 100644 --- a/i18n/e2e/localeTest_zh.html +++ b/i18n/e2e/localeTest_zh.html @@ -1,16 +1,34 @@ <!document html> <html> - <head> + <head> <meta charset="utf-8"> <title>locale test</title> <script src="../../build/angular.js" ng:autobind></script> <script src="../../build/i18n/angular-locale_zh-cn.js"></script> </head> <body> + <h3>Datetime/Number/Currency filters demo:</h3> <input type="text" name="input" value="234234443432"><br> - date: {{input | date:"medium"}}<br> - date: {{input | date:"longDate"}}<br> + date(medium): {{input | date:"medium"}}<br> + date(longDate): {{input | date:"longDate"}}<br> number: {{input | number}}<br> currency: {{input | currency }} + <hr/> + <h3>Pluralization demo:</h3> + <input type="text" name="plInput" value="1"><br> + <ng:pluralize count="plInput" + when= "{'other':'{}人在浏览该文件!'}"> + </ng:pluralize> + <hr/> + <h3>Pluralization demo with offsets:</h3> + Name of person1:<input type="text" name="person1" value="Shanjian"/><br/> + Name of person2:<input type="text" name="person2" value="Di"/><br/> + <input type="text" name="plInput2" value="1"><br> + <ng:pluralize count="plInput2" offset=2 + when= "{'0':'没有人在浏览该文件!', + '1': '{{person1}} 在浏览该文件!', + '2': '{{person1}} 和 {{person2}} 在浏览该文件!', + 'other': '{{person1}}, {{person2}} 还有其他{} 人在浏览该文件!'}"> + </ng:pluralize> </body> -</html> +</html> |
