2
2
3
3
require ( '../global-masks' ) ;
4
4
5
- describe ( 'ui-credit-card ' , function ( ) {
5
+ describe ( 'uiCreditCardMask ' , function ( ) {
6
6
beforeEach ( angular . mock . module ( 'ui.utils.masks.global' ) ) ;
7
7
8
8
it ( 'should throw an error if used without ng-model' , function ( ) {
9
9
expect ( function ( ) {
10
- TestUtil . compile ( '<input ui-credit-card>' ) ;
10
+ TestUtil . compile ( '<input ui-credit-card-mask >' ) ;
11
11
} ) . toThrow ( ) ;
12
12
} ) ;
13
13
14
14
it ( 'should register a $parser and a $formatter' , function ( ) {
15
15
var input = TestUtil . compile ( '<input ng-model="model">' ) ;
16
16
var model = input . controller ( 'ngModel' ) ;
17
17
18
- var maskedInput = TestUtil . compile ( '<input ng-model="maskedModel" ui-credit-card>' ) ;
18
+ var maskedInput = TestUtil . compile ( '<input ng-model="maskedModel" ui-credit-card-mask >' ) ;
19
19
var maskedModel = maskedInput . controller ( 'ngModel' ) ;
20
20
21
21
expect ( maskedModel . $parsers . length ) . toBe ( model . $parsers . length + 1 ) ;
22
22
expect ( maskedModel . $formatters . length ) . toBe ( model . $formatters . length + 1 ) ;
23
23
} ) ;
24
24
25
25
it ( 'should format initial model values' , function ( ) {
26
- var input = TestUtil . compile ( '<input ng-model="model" ui-credit-card>' , {
26
+ var input = TestUtil . compile ( '<input ng-model="model" ui-credit-card-mask >' , {
27
27
model : '4242424242424242'
28
28
} ) ;
29
29
@@ -32,8 +32,7 @@ describe('ui-credit-card', function() {
32
32
} ) ;
33
33
34
34
it ( 'should ignore non digits' , function ( ) {
35
- var input = TestUtil . compile ( '<input ng-model="model" ng-model-options="{allowInvalid:true}"' +
36
- ' ui-credit-card>' ) ;
35
+ var input = TestUtil . compile ( '<input ng-model="model" ng-model-options="{allowInvalid:true}" ui-credit-card-mask>' ) ;
37
36
var model = input . controller ( 'ngModel' ) ;
38
37
39
38
var tests = [
@@ -54,7 +53,7 @@ describe('ui-credit-card', function() {
54
53
} ) ;
55
54
56
55
it ( 'should validate a credit card number' , function ( ) {
57
- var input = TestUtil . compile ( '<input ng-model="model" ui-credit-card>' , {
56
+ var input = TestUtil . compile ( '<input ng-model="model" ui-credit-card-mask >' , {
58
57
model : '417900'
59
58
} ) ;
60
59
@@ -65,7 +64,7 @@ describe('ui-credit-card', function() {
65
64
} ) ;
66
65
67
66
it ( 'should use the type of the model value (if initialized)' , function ( ) {
68
- var input = TestUtil . compile ( '<input ng-model="model" ui-credit-card>' , {
67
+ var input = TestUtil . compile ( '<input ng-model="model" ui-credit-card-mask >' , {
69
68
model : '7777333300008888'
70
69
} ) ;
71
70
0 commit comments