@@ -20,7 +20,7 @@ describe('uiMask', function () {
2020 var input = compileElement ( inputHtml ) ;
2121 scope . $apply ( "x = 'abc123'" ) ;
2222 expect ( input . val ( ) ) . toBe ( 'abc123' ) ;
23- scope . $apply ( "mask = '()_bcd--- '" ) ;
23+ scope . $apply ( "mask = '()_abc123 '" ) ;
2424 expect ( input . val ( ) ) . toBe ( 'abc123' ) ;
2525 } ) ;
2626
@@ -150,177 +150,6 @@ describe('uiMask', function () {
150150 input . triggerHandler ( 'blur' ) ;
151151 expect ( input . val ( ) ) . toBe ( '992' ) ;
152152 } ) ;
153-
154- it ( "should set the correct value for mask 'a'" , function ( ) {
155- var input = compileElement ( inputHtml ) ;
156- scope . $apply ( "x = ''" ) ;
157- scope . $apply ( "mask = 'a-'" ) ;
158- input . val ( 'z' ) . triggerHandler ( 'input' ) ;
159- input . triggerHandler ( 'blur' ) ;
160- expect ( input . val ( ) ) . toBe ( 'z-' ) ;
161- input . val ( 'Z' ) . triggerHandler ( 'input' ) ;
162- input . triggerHandler ( 'blur' ) ;
163- expect ( input . val ( ) ) . toBe ( '' ) ;
164- } ) ;
165-
166- it ( "should set the correct value for mask 'A'" , function ( ) {
167- var input = compileElement ( inputHtml ) ;
168- scope . $apply ( "x = ''" ) ;
169- scope . $apply ( "mask = 'A-'" ) ;
170- input . val ( 'A' ) . triggerHandler ( 'input' ) ;
171- input . triggerHandler ( 'blur' ) ;
172- expect ( input . val ( ) ) . toBe ( 'A-' ) ;
173- input . val ( 'a' ) . triggerHandler ( 'input' ) ;
174- input . triggerHandler ( 'blur' ) ;
175- expect ( input . val ( ) ) . toBe ( 'a-' ) ;
176- } ) ;
177-
178- it ( "should set the correct value for mask '9'" , function ( ) {
179- var input = compileElement ( inputHtml ) ;
180- scope . $apply ( "x = ''" ) ;
181- scope . $apply ( "mask = '9-'" ) ;
182- input . val ( '0' ) . triggerHandler ( 'input' ) ;
183- input . triggerHandler ( 'blur' ) ;
184- expect ( input . val ( ) ) . toBe ( '0-' ) ;
185- input . val ( '9' ) . triggerHandler ( 'input' ) ;
186- input . triggerHandler ( 'blur' ) ;
187- expect ( input . val ( ) ) . toBe ( '9-' ) ;
188- input . val ( 'a' ) . triggerHandler ( 'input' ) ;
189- input . triggerHandler ( 'blur' ) ;
190- expect ( input . val ( ) ) . toBe ( '' ) ;
191- } ) ;
192-
193- it ( "should set the correct value for mask '8'" , function ( ) {
194- var input = compileElement ( inputHtml ) ;
195- scope . $apply ( "x = ''" ) ;
196- scope . $apply ( "mask = '8-'" ) ;
197- input . val ( '0' ) . triggerHandler ( 'input' ) ;
198- input . triggerHandler ( 'blur' ) ;
199- expect ( input . val ( ) ) . toBe ( '0-' ) ;
200- input . val ( '8' ) . triggerHandler ( 'input' ) ;
201- input . triggerHandler ( 'blur' ) ;
202- expect ( input . val ( ) ) . toBe ( '8-' ) ;
203- input . val ( '9' ) . triggerHandler ( 'input' ) ;
204- input . triggerHandler ( 'blur' ) ;
205- expect ( input . val ( ) ) . toBe ( '' ) ;
206- } ) ;
207-
208- it ( "should set the correct value for mask '7'" , function ( ) {
209- var input = compileElement ( inputHtml ) ;
210- scope . $apply ( "x = ''" ) ;
211- scope . $apply ( "mask = '7-'" ) ;
212- input . val ( '0' ) . triggerHandler ( 'input' ) ;
213- input . triggerHandler ( 'blur' ) ;
214- expect ( input . val ( ) ) . toBe ( '0-' ) ;
215- input . val ( '7' ) . triggerHandler ( 'input' ) ;
216- input . triggerHandler ( 'blur' ) ;
217- expect ( input . val ( ) ) . toBe ( '7-' ) ;
218- input . val ( '8' ) . triggerHandler ( 'input' ) ;
219- input . triggerHandler ( 'blur' ) ;
220- expect ( input . val ( ) ) . toBe ( '' ) ;
221- } ) ;
222-
223- it ( "should set the correct value for mask '6'" , function ( ) {
224- var input = compileElement ( inputHtml ) ;
225- scope . $apply ( "x = ''" ) ;
226- scope . $apply ( "mask = '6-'" ) ;
227- input . val ( '0' ) . triggerHandler ( 'input' ) ;
228- input . triggerHandler ( 'blur' ) ;
229- expect ( input . val ( ) ) . toBe ( '0-' ) ;
230- input . val ( '6' ) . triggerHandler ( 'input' ) ;
231- input . triggerHandler ( 'blur' ) ;
232- expect ( input . val ( ) ) . toBe ( '6-' ) ;
233- input . val ( '7' ) . triggerHandler ( 'input' ) ;
234- input . triggerHandler ( 'blur' ) ;
235- expect ( input . val ( ) ) . toBe ( '' ) ;
236- } ) ;
237-
238- it ( "should set the correct value for mask '5'" , function ( ) {
239- var input = compileElement ( inputHtml ) ;
240- scope . $apply ( "x = ''" ) ;
241- scope . $apply ( "mask = '5-'" ) ;
242- input . val ( '0' ) . triggerHandler ( 'input' ) ;
243- input . triggerHandler ( 'blur' ) ;
244- expect ( input . val ( ) ) . toBe ( '0-' ) ;
245- input . val ( '5' ) . triggerHandler ( 'input' ) ;
246- input . triggerHandler ( 'blur' ) ;
247- expect ( input . val ( ) ) . toBe ( '5-' ) ;
248- input . val ( '6' ) . triggerHandler ( 'input' ) ;
249- input . triggerHandler ( 'blur' ) ;
250- expect ( input . val ( ) ) . toBe ( '' ) ;
251- } ) ;
252-
253- it ( "should set the correct value for mask '4'" , function ( ) {
254- var input = compileElement ( inputHtml ) ;
255- scope . $apply ( "x = ''" ) ;
256- scope . $apply ( "mask = '4-'" ) ;
257- input . val ( '0' ) . triggerHandler ( 'input' ) ;
258- input . triggerHandler ( 'blur' ) ;
259- expect ( input . val ( ) ) . toBe ( '0-' ) ;
260- input . val ( '4' ) . triggerHandler ( 'input' ) ;
261- input . triggerHandler ( 'blur' ) ;
262- expect ( input . val ( ) ) . toBe ( '4-' ) ;
263- input . val ( '5' ) . triggerHandler ( 'input' ) ;
264- input . triggerHandler ( 'blur' ) ;
265- expect ( input . val ( ) ) . toBe ( '' ) ;
266- } ) ;
267-
268- it ( "should set the correct value for mask '3'" , function ( ) {
269- var input = compileElement ( inputHtml ) ;
270- scope . $apply ( "x = ''" ) ;
271- scope . $apply ( "mask = '3-'" ) ;
272- input . val ( '0' ) . triggerHandler ( 'input' ) ;
273- input . triggerHandler ( 'blur' ) ;
274- expect ( input . val ( ) ) . toBe ( '0-' ) ;
275- input . val ( '3' ) . triggerHandler ( 'input' ) ;
276- input . triggerHandler ( 'blur' ) ;
277- expect ( input . val ( ) ) . toBe ( '3-' ) ;
278- input . val ( '4' ) . triggerHandler ( 'input' ) ;
279- input . triggerHandler ( 'blur' ) ;
280- expect ( input . val ( ) ) . toBe ( '' ) ;
281- } ) ;
282-
283- it ( "should set the correct value for mask '2'" , function ( ) {
284- var input = compileElement ( inputHtml ) ;
285- scope . $apply ( "x = ''" ) ;
286- scope . $apply ( "mask = '2-'" ) ;
287- input . val ( '0' ) . triggerHandler ( 'input' ) ;
288- input . triggerHandler ( 'blur' ) ;
289- expect ( input . val ( ) ) . toBe ( '0-' ) ;
290- input . val ( '2' ) . triggerHandler ( 'input' ) ;
291- input . triggerHandler ( 'blur' ) ;
292- expect ( input . val ( ) ) . toBe ( '2-' ) ;
293- input . val ( '3' ) . triggerHandler ( 'input' ) ;
294- input . triggerHandler ( 'blur' ) ;
295- expect ( input . val ( ) ) . toBe ( '' ) ;
296- } ) ;
297-
298- it ( "should set the correct value for mask '1'" , function ( ) {
299- var input = compileElement ( inputHtml ) ;
300- scope . $apply ( "x = ''" ) ;
301- scope . $apply ( "mask = '1-'" ) ;
302- input . val ( '0' ) . triggerHandler ( 'input' ) ;
303- input . triggerHandler ( 'blur' ) ;
304- expect ( input . val ( ) ) . toBe ( '0-' ) ;
305- input . val ( '1' ) . triggerHandler ( 'input' ) ;
306- input . triggerHandler ( 'blur' ) ;
307- expect ( input . val ( ) ) . toBe ( '1-' ) ;
308- input . val ( '2' ) . triggerHandler ( 'input' ) ;
309- input . triggerHandler ( 'blur' ) ;
310- expect ( input . val ( ) ) . toBe ( '' ) ;
311- } ) ;
312-
313- it ( "should set the correct value for mask '0'" , function ( ) {
314- var input = compileElement ( inputHtml ) ;
315- scope . $apply ( "x = ''" ) ;
316- scope . $apply ( "mask = '0-'" ) ;
317- input . val ( '0' ) . triggerHandler ( 'input' ) ;
318- input . triggerHandler ( 'blur' ) ;
319- expect ( input . val ( ) ) . toBe ( '0-' ) ;
320- input . val ( '1' ) . triggerHandler ( 'input' ) ;
321- input . triggerHandler ( 'blur' ) ;
322- expect ( input . val ( ) ) . toBe ( '' ) ;
323- } ) ;
324153 } ) ;
325154
326155 describe ( 'configuration' , function ( ) {
@@ -330,10 +159,10 @@ describe('uiMask', function () {
330159 var input = compileElement ( inputHtml ) ;
331160
332161 scope . $apply ( "x = ''" ) ;
333- scope . $apply ( "mask = '@123 '" ) ;
334- input . val ( 'f012 ' ) . triggerHandler ( 'input' ) ;
162+ scope . $apply ( "mask = '@193 '" ) ;
163+ input . val ( 'f123 ' ) . triggerHandler ( 'input' ) ;
335164 input . triggerHandler ( 'blur' ) ;
336- expect ( input . val ( ) ) . toBe ( 'f012 ' ) ;
165+ expect ( input . val ( ) ) . toBe ( 'f123 ' ) ;
337166 } ) ;
338167
339168 it ( "should accept the new mask definition set per element" , function ( ) {
@@ -345,7 +174,7 @@ describe('uiMask', function () {
345174
346175 var input = compileElement ( '<input type="text" ng-model="x" ui-mask="{{mask}}" ui-options="input.options">' ) ;
347176 scope . $apply ( "x = ''" ) ;
348- scope . $apply ( "mask = '@123 '" ) ;
177+ scope . $apply ( "mask = '@999 '" ) ;
349178 input . val ( 'f111' ) . triggerHandler ( 'input' ) ;
350179 input . triggerHandler ( 'blur' ) ;
351180 expect ( input . val ( ) ) . toBe ( 'f111' ) ;
0 commit comments