4
4
*/
5
5
6
6
/* eslint max-nested-callbacks: 0 */
7
-
8
7
define ( [ 'squire' ] , function ( Squire ) {
9
8
'use strict' ;
10
9
11
10
var injector = new Squire ( ) ,
12
11
loginAction = jasmine . createSpy ( ) ,
13
12
mocks = {
14
13
'Magento_Customer/js/action/login' : loginAction ,
15
- 'Magento_Customer/js/customer-data' : { get : function ( ) { } } ,
14
+ 'Magento_Customer/js/customer-data' : {
15
+ get : jasmine . createSpy ( )
16
+ } ,
16
17
'Magento_Customer/js/model/authentication-popup' : {
17
18
createPopUp : jasmine . createSpy ( ) ,
18
19
modalWindow : null
@@ -22,13 +23,13 @@ define(['squire'], function (Squire) {
22
23
} ,
23
24
obj ;
24
25
25
- loginAction . registerLoginCallback = function ( ) { } ;
26
- window . authenticationPopup = {
27
- customerRegisterUrl : 'register_url' ,
28
- customerForgotPasswordUrl : 'forgot_password_url' ,
29
- autocomplete : 'autocomplete_flag' ,
30
- baseUrl : 'base_url'
31
- } ;
26
+ loginAction . registerLoginCallback = jasmine . createSpy ( ) ;
27
+ window . authenticationPopup = {
28
+ customerRegisterUrl : 'register_url' ,
29
+ customerForgotPasswordUrl : 'forgot_password_url' ,
30
+ autocomplete : 'autocomplete_flag' ,
31
+ baseUrl : 'base_url'
32
+ } ;
32
33
33
34
beforeEach ( function ( done ) {
34
35
injector . mock ( mocks ) ;
@@ -45,7 +46,9 @@ define(['squire'], function (Squire) {
45
46
describe ( 'Magento_Customer/js/view/authentication-popup' , function ( ) {
46
47
describe ( '"isActive" method' , function ( ) {
47
48
it ( 'Check for return value.' , function ( ) {
48
- spyOn ( mocks [ 'Magento_Customer/js/customer-data' ] , 'get' ) . and . returnValue ( function ( ) { return true ; } ) ;
49
+ mocks [ 'Magento_Customer/js/customer-data' ] . get . and . returnValue ( function ( ) {
50
+ return true ;
51
+ } ) ;
49
52
expect ( obj . isActive ( ) ) . toBeFalsy ( ) ;
50
53
} ) ;
51
54
} ) ;
@@ -67,8 +70,11 @@ define(['squire'], function (Squire) {
67
70
currentTarget : '<form><input type="text" name="username" value="customer"/></form>' ,
68
71
stopPropagation : jasmine . createSpy ( )
69
72
} ;
73
+
70
74
expect ( obj . login ( null , event ) ) . toBeFalsy ( ) ;
71
- expect ( mocks [ 'Magento_Customer/js/action/login' ] ) . toHaveBeenCalledWith ( { username : 'customer' } ) ;
75
+ expect ( mocks [ 'Magento_Customer/js/action/login' ] ) . toHaveBeenCalledWith ( {
76
+ username : 'customer'
77
+ } ) ;
72
78
} ) ;
73
79
} ) ;
74
80
} ) ;
0 commit comments