Skip to content

Commit 4a9ccc0

Browse files
Di PengIgorMinar
authored andcommitted
test(i18n): Update some i18n/e2e tests
1 parent bceadd8 commit 4a9ccc0

7 files changed

Lines changed: 168 additions & 16 deletions

File tree

i18n/e2e/i18n-e2e.js

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,48 @@ describe("localized filters", function() {
4949
expect(binding('input | number')).toBe('234,234,443,432');
5050
expect(binding('input | currency')).toBe('$234,234,443,432.00');
5151
});
52+
53+
54+
describe('ng:pluralize for en locale', function() {
55+
it('should show pluralized strings', function() {
56+
expect(element('.ng-pluralize:first').html()).toBe('You have one email!');
57+
58+
input('plInput').enter('0');
59+
expect(element('.ng-pluralize:first').html()).toBe('You have no email!');
60+
61+
input('plInput').enter('3');
62+
expect(element('.ng-pluralize:first').html()).toBe('You have 3 emails!');
63+
});
64+
65+
it('should show pluralized strings with offsets', function() {
66+
expect(element('.ng-pluralize:last').html()).toBe('Shanjian is viewing!');
67+
68+
input('plInput2').enter('0');
69+
expect(element('.ng-pluralize:last').html()).toBe('Nobody is viewing!');
70+
71+
input('plInput2').enter('2');
72+
expect(element('.ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!');
73+
74+
input('plInput2').enter('3');
75+
expect(element('.ng-pluralize:last').html()).
76+
toBe('Shanjian, Di and one other person are viewing!');
77+
78+
input('plInput2').enter('4');
79+
expect(element('.ng-pluralize:last').html()).
80+
toBe('Shanjian, Di and 2 other people are viewing!');
81+
});
82+
83+
it('should show pluralized strings with correct data-binding', function() {
84+
input('plInput2').enter('2');
85+
expect(element('.ng-pluralize:last').html()).toBe('Shanjian and Di are viewing!');
86+
87+
input('person1').enter('Igor');
88+
expect(element('.ng-pluralize:last').html()).toBe('Igor and Di are viewing!');
89+
90+
input('person2').enter('Vojta');
91+
expect(element('.ng-pluralize:last').html()).toBe('Igor and Vojta are viewing!');
92+
});
93+
})
5294
});
5395

5496
describe("sk locale", function() {
@@ -62,6 +104,32 @@ describe("localized filters", function() {
62104
expect(binding('input | number')).toBe('234 234 443 432');
63105
expect(binding('input | currency')).toBe('234 234 443 432,00 Sk');
64106
});
107+
108+
109+
describe('ng:pluralize for sk locale', function() {
110+
it('should show pluralized strings', function() {
111+
expect(element('.ng-pluralize').html()).toBe('Mas jeden email!');
112+
113+
input('plInput').enter('0');
114+
expect(element('.ng-pluralize:first').html()).toBe('Mas 0 emailov!');
115+
116+
input('plInput').enter('3');
117+
expect(element('.ng-pluralize:first').html()).toBe('Mas 3 emaily!');
118+
119+
input('plInput').enter('4');
120+
expect(element('.ng-pluralize:first').html()).toBe('Mas 4 emaily!');
121+
122+
input('plInput').enter('6');
123+
expect(element('.ng-pluralize:first').html()).toBe('Mas 6 emailov!');
124+
});
125+
126+
it('should show pluralized strings with offsets', function() {
127+
//TODO(Igor): add offsets for sk
128+
});
129+
130+
it('should show pluralized strings with correct data-binding', function() {
131+
});
132+
})
65133
});
66134

67135
describe("zh locale", function() {
@@ -75,5 +143,43 @@ describe("localized filters", function() {
75143
expect(binding('input | number')).toBe('234,234,443,432');
76144
expect(binding('input | currency')).toBe('¥234,234,443,432.00');
77145
});
146+
147+
148+
describe('ng:pluralize for zh locale', function() {
149+
it('should show pluralized strings', function() {
150+
expect(element('.ng-pluralize:first').html()).toBe('1人在浏览该文件!');
151+
152+
input('plInput').enter('0');
153+
expect(element('.ng-pluralize:first').html()).toBe('0人在浏览该文件!');
154+
155+
input('plInput').enter('3');
156+
expect(element('.ng-pluralize:first').html()).toBe('3人在浏览该文件!');
157+
});
158+
159+
it('should show pluralized strings with offsets', function() {
160+
expect(element('.ng-pluralize:last').html()).toBe('Shanjian 在浏览该文件!');
161+
162+
input('plInput2').enter('0');
163+
expect(element('.ng-pluralize:last').html()).toBe('没有人在浏览该文件!');
164+
165+
input('plInput2').enter('2');
166+
expect(element('.ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!');
167+
168+
input('plInput2').enter('3');
169+
expect(element('.ng-pluralize:last').html()).
170+
toBe('Shanjian, Di 还有其他1 人在浏览该文件!');
171+
});
172+
173+
it('should show pluralized strings with correct data-binding', function() {
174+
input('plInput2').enter('2');
175+
expect(element('.ng-pluralize:last').html()).toBe('Shanjian 和 Di 在浏览该文件!');
176+
177+
input('person1').enter('彭迪');
178+
expect(element('.ng-pluralize:last').html()).toBe('彭迪 和 Di 在浏览该文件!');
179+
180+
input('person2').enter('一哥');
181+
expect(element('.ng-pluralize:last').html()).toBe('彭迪 和 一哥 在浏览该文件!');
182+
});
183+
})
78184
});
79185
});

i18n/e2e/localeTest_cs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!document html>
22
<html>
3-
<head>
3+
<head>
44
<meta charset="utf-8">
55
<title>locale test</title>
66
<script src="../../build/angular.js" ng:autobind></script>
@@ -13,4 +13,4 @@
1313
number: {{input | number}}<br>
1414
currency: {{input | currency }}
1515
</body>
16-
</html>
16+
</html>

i18n/e2e/localeTest_de.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!document html>
22
<html>
3-
<head>
3+
<head>
44
<meta charset="utf-8">
55
<title>locale test</title>
66
<script src="../../build/angular.js" ng:autobind></script>
@@ -13,4 +13,4 @@
1313
number: {{input | number}}<br>
1414
currency: {{input | currency }}
1515
</body>
16-
</html>
16+
</html>

i18n/e2e/localeTest_en.html

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!document html>
22
<html>
3-
<head>
3+
<head>
44
<meta charset="utf-8">
55
<title>locale test</title>
66
<script src="../../build/angular.js" ng:autobind></script>
@@ -9,10 +9,31 @@
99
-->
1010
</head>
1111
<body>
12+
<h3>Datetime/Number/Currency filters demo:</h3>
1213
<input type="text" name="input" value="234234443432"><br>
13-
date: {{input | date:"medium"}}<br>
14-
date: {{input | date:"longDate"}}<br>
14+
date(medium): {{input | date:"medium"}}<br>
15+
date(longDate): {{input | date:"longDate"}}<br>
1516
number: {{input | number}}<br>
1617
currency: {{input | currency }}
18+
<hr/>
19+
<h3>Pluralization demo:</h3>
20+
<input type="text" name="plInput" value="1"><br>
21+
<ng:pluralize count="plInput"
22+
when= "{ '0': 'You have no email!',
23+
'one': 'You have one email!',
24+
'other': 'You have {} emails!'}">
25+
</ng:pluralize>
26+
<hr/>
27+
<h3>Pluralization demo with offsets:</h3>
28+
Name of person1:<input type="text" name="person1" value="Shanjian"/><br/>
29+
Name of person2:<input type="text" name="person2" value="Di"/><br/>
30+
<input type="text" name="plInput2" value="1"><br>
31+
<ng:pluralize count="plInput2" offset=2
32+
when= "{'0':'Nobody is viewing!',
33+
'1': '{{person1}} is viewing!',
34+
'2': '{{person1}} and {{person2}} are viewing!',
35+
'3': '{{person1}}, {{person2}} and one other person are viewing!',
36+
'other': '{{person1}}, {{person2}} and {} other people are viewing!'}">
37+
</ng:pluralize>
1738
</body>
18-
</html>
39+
</html>

i18n/e2e/localeTest_es.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!document html>
22
<html>
3-
<head>
3+
<head>
44
<meta charset="utf-8">
55
<title>locale test</title>
66
<script src="../../build/angular.js" ng:autobind></script>
@@ -13,4 +13,4 @@
1313
number: {{input | number}}<br>
1414
currency: {{input | currency }}
1515
</body>
16-
</html>
16+
</html>

i18n/e2e/localeTest_sk.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!document html>
22
<html>
3-
<head>
3+
<head>
44
<meta charset="utf-8">
55
<title>locale test</title>
66
<script src="../../build/angular.js" ng:autobind></script>
@@ -12,5 +12,12 @@
1212
date: {{input | date:"longDate"}}<br>
1313
number: {{input | number}}<br>
1414
currency: {{input | currency }}
15+
<hr/>
16+
<input type="text" name="plInput" value="1"><br>
17+
<ng:pluralize count="plInput"
18+
when= "{ 'one': 'Mas jeden email!',
19+
'few': 'Mas {} emaily!',
20+
'other': 'Mas {} emailov!'}">
21+
</ng:pluralize>
1522
</body>
16-
</html>
23+
</html>

i18n/e2e/localeTest_zh.html

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
<!document html>
22
<html>
3-
<head>
3+
<head>
44
<meta charset="utf-8">
55
<title>locale test</title>
66
<script src="../../build/angular.js" ng:autobind></script>
77
<script src="../../build/i18n/angular-locale_zh-cn.js"></script>
88
</head>
99
<body>
10+
<h3>Datetime/Number/Currency filters demo:</h3>
1011
<input type="text" name="input" value="234234443432"><br>
11-
date: {{input | date:"medium"}}<br>
12-
date: {{input | date:"longDate"}}<br>
12+
date(medium): {{input | date:"medium"}}<br>
13+
date(longDate): {{input | date:"longDate"}}<br>
1314
number: {{input | number}}<br>
1415
currency: {{input | currency }}
16+
<hr/>
17+
<h3>Pluralization demo:</h3>
18+
<input type="text" name="plInput" value="1"><br>
19+
<ng:pluralize count="plInput"
20+
when= "{'other':'{}人在浏览该文件!'}">
21+
</ng:pluralize>
22+
<hr/>
23+
<h3>Pluralization demo with offsets:</h3>
24+
Name of person1:<input type="text" name="person1" value="Shanjian"/><br/>
25+
Name of person2:<input type="text" name="person2" value="Di"/><br/>
26+
<input type="text" name="plInput2" value="1"><br>
27+
<ng:pluralize count="plInput2" offset=2
28+
when= "{'0':'没有人在浏览该文件!',
29+
'1': '{{person1}} 在浏览该文件!',
30+
'2': '{{person1}} 和 {{person2}} 在浏览该文件!',
31+
'other': '{{person1}}, {{person2}} 还有其他{} 人在浏览该文件!'}">
32+
</ng:pluralize>
1533
</body>
16-
</html>
34+
</html>

0 commit comments

Comments
 (0)