File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,20 @@ define([
10
10
'use strict' ;
11
11
12
12
describe ( 'ui/js/modal/prompt' , function ( ) {
13
- var element = $ ( '<div>some element</div>' ) ,
13
+
14
+ var element ,
15
+ prompt ,
16
+ widget ;
17
+
18
+ beforeEach ( function ( ) {
19
+ element = $ ( '<div id="element">some element</div>' ) ,
14
20
prompt = element . prompt ( { } ) ;
21
+ widget = element . prompt ( { } ) . data ( 'mage-prompt' ) ;
22
+ } ) ;
23
+
24
+ afterEach ( function ( ) {
25
+ $ ( '#element' ) . remove ( ) ;
26
+ } ) ;
15
27
16
28
it ( 'Check for modal definition' , function ( ) {
17
29
expect ( prompt ) . toBeDefined ( ) ;
@@ -23,5 +35,12 @@ define([
23
35
it ( 'Integration: modal created on page' , function ( ) {
24
36
expect ( prompt . length ) . toEqual ( 1 ) ;
25
37
} ) ;
38
+ it ( 'Check cancel action' , function ( ) {
39
+ var cancel = spyOn ( widget . options . actions , 'cancel' ) ;
40
+
41
+ jQuery ( '.modals-overlay' ) . click ( ) ;
42
+ expect ( widget . options . outerClickHandler ) . toBeDefined ( ) ;
43
+ expect ( cancel ) . toHaveBeenCalled ( ) ;
44
+ } ) ;
26
45
} ) ;
27
46
} ) ;
You can’t perform that action at this time.
0 commit comments