fix(i18n e2e tests):

This commit is contained in:
Misko Hevery 2012-03-28 11:16:10 -07:00
parent ba59ef4950
commit bb2fa6f63f
7 changed files with 84 additions and 84 deletions

View file

@ -8,7 +8,7 @@ describe("localized filters", function() {
expect(binding('input | date:"medium"')).toBe('03/06/1977 18:07:23'); expect(binding('input | date:"medium"')).toBe('03/06/1977 18:07:23');
expect(binding('input | date:"longDate"')).toBe("3 de junio de 1977"); expect(binding('input | date:"longDate"')).toBe("3 de junio de 1977");
expect(binding('input | number')).toBe('234.234.443.432'); expect(binding('input | number')).toBe('234.234.443.432');
expect(binding('input | currency')).toBe('€ 234.234.443.432,00'); expect(binding('input | currency')).toBe('€\u00a0234.234.443.432,00');
}); });
}); });
@ -20,8 +20,8 @@ describe("localized filters", function() {
it('should check filters for cs locale', function() { it('should check filters for cs locale', function() {
expect(binding('input | date:"medium"')).toBe('3.6.1977 18:07:23'); expect(binding('input | date:"medium"')).toBe('3.6.1977 18:07:23');
expect(binding('input | date:"longDate"')).toBe("3. června 1977"); expect(binding('input | date:"longDate"')).toBe("3. června 1977");
expect(binding('input | number')).toBe('234 234 443 432'); expect(binding('input | number')).toBe('234\u00a0234\u00a0443\u00a0432');
expect(binding('input | currency')).toBe('234 234 443 432,00 K\u010d'); expect(binding('input | currency')).toBe('234\u00a0234\u00a0443\u00a0432,00\u00a0K\u010d');
}); });
}); });
@ -34,7 +34,7 @@ describe("localized filters", function() {
expect(binding('input | date:"medium"')).toBe('03.06.1977 18:07:23'); expect(binding('input | date:"medium"')).toBe('03.06.1977 18:07:23');
expect(binding('input | date:"longDate"')).toBe("3. Juni 1977"); expect(binding('input | date:"longDate"')).toBe("3. Juni 1977");
expect(binding('input | number')).toBe('234.234.443.432'); expect(binding('input | number')).toBe('234.234.443.432');
expect(binding('input | currency')).toBe('234.234.443.432,00 €'); expect(binding('input | currency')).toBe('234.234.443.432,00\u00a0€');
}); });
}); });
@ -53,42 +53,42 @@ describe("localized filters", function() {
describe('ng:pluralize for en locale', function() { describe('ng:pluralize for en locale', function() {
it('should show pluralized strings', function() { it('should show pluralized strings', function() {
expect(element('.ng-pluralize:first').html()).toBe('You have one email!'); expect(element('ng-pluralize:first').html()).toBe('You have one email!');
input('plInput').enter('0'); input('plInput').enter('0');
expect(element('.ng-pluralize:first').html()).toBe('You have no email!'); expect(element('ng-pluralize:first').html()).toBe('You have no email!');
input('plInput').enter('3'); input('plInput').enter('3');
expect(element('.ng-pluralize:first').html()).toBe('You have 3 emails!'); expect(element('ng-pluralize:first').html()).toBe('You have 3 emails!');
}); });
it('should show pluralized strings with offsets', function() { it('should show pluralized strings with offsets', function() {
expect(element('.ng-pluralize:last').html()).toBe('Shanjian is viewing!'); expect(element('ng-pluralize:last').html()).toBe('Shanjian is viewing!');
input('plInput2').enter('0'); input('plInput2').enter('0');
expect(element('.ng-pluralize:last').html()).toBe('Nobody is viewing!'); expect(element('ng-pluralize:last').html()).toBe('Nobody is viewing!');
input('plInput2').enter('2'); input('plInput2').enter('2');
expect(element('.ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!'); expect(element('ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!');
input('plInput2').enter('3'); input('plInput2').enter('3');
expect(element('.ng-pluralize:last').html()). expect(element('ng-pluralize:last').html()).
toBe('Shanjian, Di and one other person are viewing!'); toBe('Shanjian, Di and one other person are viewing!');
input('plInput2').enter('4'); input('plInput2').enter('4');
expect(element('.ng-pluralize:last').html()). expect(element('ng-pluralize:last').html()).
toBe('Shanjian, Di and 2 other people are viewing!'); toBe('Shanjian, Di and 2 other people are viewing!');
}); });
it('should show pluralized strings with correct data-binding', function() { it('should show pluralized strings with correct data-binding', function() {
input('plInput2').enter('2'); input('plInput2').enter('2');
expect(element('.ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!'); expect(element('ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!');
input('person1').enter('Igor'); input('person1').enter('Igor');
expect(element('.ng-pluralize:last').html()).toBe('Igor and Di are viewing!'); expect(element('ng-pluralize:last').html()).toBe('Igor and Di are viewing!');
input('person2').enter('Vojta'); input('person2').enter('Vojta');
expect(element('.ng-pluralize:last').html()).toBe('Igor and Vojta are viewing!'); expect(element('ng-pluralize:last').html()).toBe('Igor and Vojta are viewing!');
}); });
}) })
}); });
@ -101,26 +101,26 @@ describe("localized filters", function() {
it('should check filters for sk locale', function() { it('should check filters for sk locale', function() {
expect(binding('input | date:"medium"')).toBe('3.6.1977 18:07:23'); expect(binding('input | date:"medium"')).toBe('3.6.1977 18:07:23');
expect(binding('input | date:"longDate"')).toBe("3. júna 1977"); expect(binding('input | date:"longDate"')).toBe("3. júna 1977");
expect(binding('input | number')).toBe('234 234 443 432'); expect(binding('input | number')).toBe('234\u00a0234\u00a0443\u00a0432');
expect(binding('input | currency')).toBe('234 234 443 432,00 Sk'); expect(binding('input | currency')).toBe('234\u00a0234\u00a0443\u00a0432,00\u00a0Sk');
}); });
describe('ng:pluralize for sk locale', function() { describe('ng:pluralize for sk locale', function() {
it('should show pluralized strings', function() { it('should show pluralized strings', function() {
expect(element('.ng-pluralize').html()).toBe('Mas jeden email!'); expect(element('ng-pluralize').html()).toBe('Mas jeden email!');
input('plInput').enter('0'); input('plInput').enter('0');
expect(element('.ng-pluralize:first').html()).toBe('Mas 0 emailov!'); expect(element('ng-pluralize:first').html()).toBe('Mas 0 emailov!');
input('plInput').enter('3'); input('plInput').enter('3');
expect(element('.ng-pluralize:first').html()).toBe('Mas 3 emaily!'); expect(element('ng-pluralize:first').html()).toBe('Mas 3 emaily!');
input('plInput').enter('4'); input('plInput').enter('4');
expect(element('.ng-pluralize:first').html()).toBe('Mas 4 emaily!'); expect(element('ng-pluralize:first').html()).toBe('Mas 4 emaily!');
input('plInput').enter('6'); input('plInput').enter('6');
expect(element('.ng-pluralize:first').html()).toBe('Mas 6 emailov!'); expect(element('ng-pluralize:first').html()).toBe('Mas 6 emailov!');
}); });
it('should show pluralized strings with offsets', function() { it('should show pluralized strings with offsets', function() {
@ -147,38 +147,38 @@ describe("localized filters", function() {
describe('ng:pluralize for zh locale', function() { describe('ng:pluralize for zh locale', function() {
it('should show pluralized strings', function() { it('should show pluralized strings', function() {
expect(element('.ng-pluralize:first').html()).toBe('1人在浏览该文件!'); expect(element('ng-pluralize:first').html()).toBe('1人在浏览该文件!');
input('plInput').enter('0'); input('plInput').enter('0');
expect(element('.ng-pluralize:first').html()).toBe('0人在浏览该文件!'); expect(element('ng-pluralize:first').html()).toBe('0人在浏览该文件!');
input('plInput').enter('3'); input('plInput').enter('3');
expect(element('.ng-pluralize:first').html()).toBe('3人在浏览该文件!'); expect(element('ng-pluralize:first').html()).toBe('3人在浏览该文件!');
}); });
it('should show pluralized strings with offsets', function() { it('should show pluralized strings with offsets', function() {
expect(element('.ng-pluralize:last').html()).toBe('Shanjian 在浏览该文件!'); expect(element('ng-pluralize:last').html()).toBe('Shanjian 在浏览该文件!');
input('plInput2').enter('0'); input('plInput2').enter('0');
expect(element('.ng-pluralize:last').html()).toBe('没有人在浏览该文件!'); expect(element('ng-pluralize:last').html()).toBe('没有人在浏览该文件!');
input('plInput2').enter('2'); input('plInput2').enter('2');
expect(element('.ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!'); expect(element('ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!');
input('plInput2').enter('3'); input('plInput2').enter('3');
expect(element('.ng-pluralize:last').html()). expect(element('ng-pluralize:last').html()).
toBe('Shanjian, Di 还有其他1 人在浏览该文件!'); toBe('Shanjian, Di 还有其他1 人在浏览该文件!');
}); });
it('should show pluralized strings with correct data-binding', function() { it('should show pluralized strings with correct data-binding', function() {
input('plInput2').enter('2'); input('plInput2').enter('2');
expect(element('.ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!'); expect(element('ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!');
input('person1').enter('彭迪'); input('person1').enter('彭迪');
expect(element('.ng-pluralize:last').html()).toBe('彭迪 和 Di 在浏览该文件!'); expect(element('ng-pluralize:last').html()).toBe('彭迪 和 Di 在浏览该文件!');
input('person2').enter('一哥'); input('person2').enter('一哥');
expect(element('.ng-pluralize:last').html()).toBe('彭迪 和 一哥 在浏览该文件!'); expect(element('ng-pluralize:last').html()).toBe('彭迪 和 一哥 在浏览该文件!');
}); });
}) })
}); });

View file

@ -6,13 +6,13 @@
<script src="../../build/angular.js"></script> <script src="../../build/angular.js"></script>
<script src="../../build/i18n/angular-locale_cs.js"></script> <script src="../../build/i18n/angular-locale_cs.js"></script>
<script> <script>
function AppCntl(){ function AppCntl($scope){
this.input = 234234443432; $scope.input = 234234443432;
} }
</script> </script>
</head> </head>
<body ng:controller="AppCntl"> <body ng-controller="AppCntl">
<input type="text" ng:model="input"><br> <input type="text" ng-model="input"><br>
date: {{input | date:"medium"}}<br> date: {{input | date:"medium"}}<br>
date: {{input | date:"longDate"}}<br> date: {{input | date:"longDate"}}<br>
number: {{input | number}}<br> number: {{input | number}}<br>

View file

@ -6,13 +6,13 @@
<script src="../../build/angular.js"></script> <script src="../../build/angular.js"></script>
<script src="../../build/i18n/angular-locale_de.js"></script> <script src="../../build/i18n/angular-locale_de.js"></script>
<script> <script>
function AppCntl(){ function AppCntl($scope){
this.input = 234234443432; $scope.input = 234234443432;
} }
</script> </script>
</head> </head>
<body ng:controller="AppCntl"> <body ng-controller="AppCntl">
<input type="text" ng:model="input"><br> <input type="text" ng-model="input"><br>
date: {{input | date:"medium"}}<br> date: {{input | date:"medium"}}<br>
date: {{input | date:"longDate"}}<br> date: {{input | date:"longDate"}}<br>
number: {{input | number}}<br> number: {{input | number}}<br>

View file

@ -8,41 +8,41 @@
<script src="../../build/i18n/angular-locale_en.js"></script> <script src="../../build/i18n/angular-locale_en.js"></script>
--> -->
<script> <script>
function AppCntl(){ function AppCntl($scope){
this.input = 234234443432; $scope.input = 234234443432;
this.plInput = 1; $scope.plInput = 1;
this.person1 = "Shanjian"; $scope.person1 = "Shanjian";
this.person2 = "Di"; $scope.person2 = "Di";
this.plInput2 = 1; $scope.plInput2 = 1;
} }
</script> </script>
</head> </head>
<body ng:controller="AppCntl"> <body ng-controller="AppCntl">
<h3>Datetime/Number/Currency filters demo:</h3> <h3>Datetime/Number/Currency filters demo:</h3>
<input type="text" ng:model="input" value="234234443432"><br> <input type="text" ng-model="input" value="234234443432"><br>
date(medium): {{input | date:"medium"}}<br> date(medium): {{input | date:"medium"}}<br>
date(longDate): {{input | date:"longDate"}}<br> date(longDate): {{input | date:"longDate"}}<br>
number: {{input | number}}<br> number: {{input | number}}<br>
currency: {{input | currency }} currency: {{input | currency }}
<hr/> <hr/>
<h3>Pluralization demo:</h3> <h3>Pluralization demo:</h3>
<input type="text" ng:model="plInput"><br> <input type="text" ng-model="plInput"><br>
<ng:pluralize count="plInput" <ng-pluralize count="plInput"
when= "{ '0': 'You have no email!', when= "{ '0': 'You have no email!',
'one': 'You have one email!', 'one': 'You have one email!',
'other': 'You have {} emails!'}"> 'other': 'You have {} emails!'}">
</ng:pluralize> </ng-pluralize>
<hr/> <hr/>
<h3>Pluralization demo with offsets:</h3> <h3>Pluralization demo with offsets:</h3>
Name of person1:<input type="text" ng:model="person1"/><br/> Name of person1:<input type="text" ng-model="person1"/><br/>
Name of person2:<input type="text" ng:model="person2"/><br/> Name of person2:<input type="text" ng-model="person2"/><br/>
<input type="text" ng:model="plInput2"><br> <input type="text" ng-model="plInput2"><br>
<ng:pluralize count="plInput2" offset=2 <ng-pluralize count="plInput2" offset=2
when= "{'0':'Nobody is viewing!', when= "{'0':'Nobody is viewing!',
'1': '{{person1}} is viewing!', '1': '{{person1}} is viewing!',
'2': '{{person1}} and {{person2}} are viewing!', '2': '{{person1}} and {{person2}} are viewing!',
'3': '{{person1}}, {{person2}} and one other person are viewing!', '3': '{{person1}}, {{person2}} and one other person are viewing!',
'other': '{{person1}}, {{person2}} and {} other people are viewing!'}"> 'other': '{{person1}}, {{person2}} and {} other people are viewing!'}">
</ng:pluralize> </ng-pluralize>
</body> </body>
</html> </html>

View file

@ -6,13 +6,13 @@
<script src="../../build/angular.js"></script> <script src="../../build/angular.js"></script>
<script src="../../build/i18n/angular-locale_es.js"></script> <script src="../../build/i18n/angular-locale_es.js"></script>
<script> <script>
function AppCntl(){ function AppCntl($scope){
this.input = 234234443432; $scope.input = 234234443432;
} }
</script> </script>
</head> </head>
<body ng:controller="AppCntl"> <body ng-controller="AppCntl">
<input type="text" ng:model="input" value="234234443432"><br> <input type="text" ng-model="input" value="234234443432"><br>
date: {{input | date:"medium"}}<br> date: {{input | date:"medium"}}<br>
date: {{input | date:"longDate"}}<br> date: {{input | date:"longDate"}}<br>
number: {{input | number}}<br> number: {{input | number}}<br>

View file

@ -6,24 +6,24 @@
<script src="../../build/angular.js"></script> <script src="../../build/angular.js"></script>
<script src="../../build/i18n/angular-locale_sk-sk.js"></script> <script src="../../build/i18n/angular-locale_sk-sk.js"></script>
<script> <script>
function AppCntl(){ function AppCntl($scope){
this.input = 234234443432; $scope.input = 234234443432;
this.plInput = 1; $scope.plInput = 1;
} }
</script> </script>
</head> </head>
<body ng:controller="AppCntl"> <body ng-controller="AppCntl">
<input type="text" ng:model="input" value="234234443432"><br> <input type="text" ng-model="input" value="234234443432"><br>
date: {{input | date:"medium"}}<br> date: {{input | date:"medium"}}<br>
date: {{input | date:"longDate"}}<br> date: {{input | date:"longDate"}}<br>
number: {{input | number}}<br> number: {{input | number}}<br>
currency: {{input | currency }} currency: {{input | currency }}
<hr/> <hr/>
<input type="text" ng:model="plInput"><br> <input type="text" ng-model="plInput"><br>
<ng:pluralize count="plInput" <ng-pluralize count="plInput"
when= "{ 'one': 'Mas jeden email!', when= "{ 'one': 'Mas jeden email!',
'few': 'Mas {} emaily!', 'few': 'Mas {} emaily!',
'other': 'Mas {} emailov!'}"> 'other': 'Mas {} emailov!'}">
</ng:pluralize> </ng-pluralize>
</body> </body>
</html> </html>

View file

@ -6,38 +6,38 @@
<script src="../../build/angular.js"></script> <script src="../../build/angular.js"></script>
<script src="../../build/i18n/angular-locale_zh-cn.js"></script> <script src="../../build/i18n/angular-locale_zh-cn.js"></script>
<script> <script>
function AppCntl(){ function AppCntl($scope){
this.input = 234234443432; $scope.input = 234234443432;
this.plInput = 1; $scope.plInput = 1;
this.person1 = "Shanjian"; $scope.person1 = "Shanjian";
this.person2 = "Di"; $scope.person2 = "Di";
this.plInput2 = 1; $scope.plInput2 = 1;
} }
</script> </script>
</head> </head>
<body ng:controller="AppCntl"> <body ng-controller="AppCntl">
<h3>Datetime/Number/Currency filters demo:</h3> <h3>Datetime/Number/Currency filters demo:</h3>
<input type="text" ng:model="input"><br> <input type="text" ng-model="input"><br>
date(medium): {{input | date:"medium"}}<br> date(medium): {{input | date:"medium"}}<br>
date(longDate): {{input | date:"longDate"}}<br> date(longDate): {{input | date:"longDate"}}<br>
number: {{input | number}}<br> number: {{input | number}}<br>
currency: {{input | currency }} currency: {{input | currency }}
<hr/> <hr/>
<h3>Pluralization demo:</h3> <h3>Pluralization demo:</h3>
<input type="text" ng:model="plInput"><br> <input type="text" ng-model="plInput"><br>
<ng:pluralize count="plInput" <ng-pluralize count="plInput"
when= "{'other':'{}人在浏览该文件!'}"> when= "{'other':'{}人在浏览该文件!'}">
</ng:pluralize> </ng-pluralize>
<hr/> <hr/>
<h3>Pluralization demo with offsets:</h3> <h3>Pluralization demo with offsets:</h3>
Name of person1:<input type="text" ng:model="person1"/><br/> Name of person1:<input type="text" ng-model="person1"/><br/>
Name of person2:<input type="text" ng:model="person2"/><br/> Name of person2:<input type="text" ng-model="person2"/><br/>
<input type="text" ng:model="plInput2"><br> <input type="text" ng-model="plInput2"><br>
<ng:pluralize count="plInput2" offset=2 <ng-pluralize count="plInput2" offset=2
when= "{'0':'没有人在浏览该文件!', when= "{'0':'没有人在浏览该文件!',
'1': '{{person1}} 在浏览该文件!', '1': '{{person1}} 在浏览该文件!',
'2': '{{person1}} 和 {{person2}} 在浏览该文件!', '2': '{{person1}} 和 {{person2}} 在浏览该文件!',
'other': '{{person1}}, {{person2}} 还有其他{} 人在浏览该文件!'}"> 'other': '{{person1}}, {{person2}} 还有其他{} 人在浏览该文件!'}">
</ng:pluralize> </ng-pluralize>
</body> </body>
</html> </html>