@@ -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} ) ;
0 commit comments