@@ -14,6 +14,7 @@ define([
14
14
var formEl ,
15
15
jQueryAjax ,
16
16
order ,
17
+ confirmSpy = jasmine . createSpy ( 'confirm' ) ,
17
18
tmpl = '<form id="edit_form" action="/">' +
18
19
'<section id="order-methods">' +
19
20
'<div id="order-billing_method"></div>' +
@@ -129,7 +130,7 @@ define([
129
130
mocks = {
130
131
'jquery' : $ ,
131
132
'Magento_Catalog/catalog/product/composite/configure' : jasmine . createSpy ( ) ,
132
- 'Magento_Ui/js/modal/confirm' : jasmine . createSpy ( ) ,
133
+ 'Magento_Ui/js/modal/confirm' : confirmSpy ,
133
134
'Magento_Ui/js/modal/alert' : jasmine . createSpy ( ) ,
134
135
'Magento_Ui/js/lib/view/utils/async' : jasmine . createSpy ( )
135
136
} ;
@@ -159,6 +160,22 @@ define([
159
160
jQueryAjax = undefined ;
160
161
} ) ;
161
162
163
+ describe ( 'Testing the process customer group change' , function ( ) {
164
+ it ( 'and confirm method is called' , function ( ) {
165
+ init ( ) ;
166
+ spyOn ( window , '$$' ) . and . returnValue ( [ 'testing' ] ) ;
167
+ order . processCustomerGroupChange (
168
+ 1 ,
169
+ 'testMsg' ,
170
+ 'customerGroupMsg' ,
171
+ 'errorMsg' ,
172
+ 1 ,
173
+ 'change'
174
+ ) ;
175
+ expect ( confirmSpy ) . toHaveBeenCalledTimes ( 1 ) ;
176
+ } ) ;
177
+ } ) ;
178
+
162
179
describe ( 'submit()' , function ( ) {
163
180
function testSubmit ( currentPaymentMethod , paymentMethod , ajaxParams ) {
164
181
$ . ajax = jasmine . createSpy ( '$.ajax' ) ;
0 commit comments