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([
1010 'use strict' ;
1111
1212 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>' ) ,
1420 prompt = element . prompt ( { } ) ;
21+ widget = element . prompt ( { } ) . data ( 'mage-prompt' ) ;
22+ } ) ;
23+
24+ afterEach ( function ( ) {
25+ $ ( '#element' ) . remove ( ) ;
26+ } ) ;
1527
1628 it ( 'Check for modal definition' , function ( ) {
1729 expect ( prompt ) . toBeDefined ( ) ;
@@ -23,5 +35,12 @@ define([
2335 it ( 'Integration: modal created on page' , function ( ) {
2436 expect ( prompt . length ) . toEqual ( 1 ) ;
2537 } ) ;
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+ } ) ;
2645 } ) ;
2746} ) ;
You can’t perform that action at this time.
0 commit comments