44 */
55
66/* eslint-disable max-nested-callbacks */
7+ /*jscs:disable jsDoc*/
78define ( [ 'Magento_Customer/js/form/components/insert-listing' ] , function ( Constr ) {
89 'use strict' ;
910
@@ -15,10 +16,18 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
1516 data : {
1617 selected : ids
1718 }
19+ } ,
20+ selectionsProvider = {
21+ selected : jasmine . createSpy ( ) . and . returnValue ( ids )
1822 } ;
1923
2024 beforeEach ( function ( ) {
21- obj = new Constr ( { } ) ;
25+ obj = new Constr ( {
26+ name : 'content_name' ,
27+ selections : function ( ) {
28+ return selectionsProvider ;
29+ }
30+ } ) ;
2231 } ) ;
2332
2433 describe ( 'Check delete massaction process' , function ( ) {
@@ -34,20 +43,14 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
3443 } ) ;
3544
3645 it ( 'Check ids are retrieved from selections provider if they are NOT in data' , function ( ) {
37- var selectionsProvider = {
38- selected : jasmine . createSpy ( ) . and . returnValue ( ids )
39- } ;
40-
41- obj . selections = function ( ) { // jscs:ignore jsDoc
42- return selectionsProvider ;
43- } ;
4446 obj . _delete = jasmine . createSpy ( ) ;
4547 obj . onMassAction ( {
4648 action : 'delete' ,
4749 data : { }
4850 } ) ;
4951
5052 expect ( selectionsProvider . selected ) . toHaveBeenCalled ( ) ;
53+ selectionsProvider . selected . calls . reset ( ) ;
5154 expect ( obj . _delete ) . toHaveBeenCalledWith ( [ 1 , 2 ] ) ;
5255 } ) ;
5356
@@ -58,6 +61,7 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
5861 } ;
5962 obj . onMassAction ( data ) ;
6063
64+ expect ( selectionsProvider . selected ) . not . toHaveBeenCalled ( ) ;
6165 expect ( obj . source . get . calls . count ( ) ) . toEqual ( 2 ) ;
6266 expect ( obj . source . set . calls . count ( ) ) . toEqual ( 1 ) ;
6367 } ) ;
0 commit comments