File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
dev/tests/js/jasmine/tests/lib/mage/adminhtml Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ /************************************************************************
2
+ *
3
+ * Copyright 2024 Adobe
4
+ * All Rights Reserved.
5
+ *
6
+ * ************************************************************************
7
+ */
8
+ define ( [ 'mage/adminhtml/grid' ] , function ( ) {
9
+ 'use strict' ;
10
+ describe ( 'mage/adminhtml/grid' , function ( ) {
11
+ let gridInstance ;
12
+
13
+ beforeEach ( function ( ) {
14
+ // Create an instance of varienGrid
15
+ gridInstance = new varienGrid ( ) ;
16
+
17
+ spyOn ( gridInstance , 'reload' ) ;
18
+ // eslint-disable-next-line max-nested-callbacks
19
+ spyOn ( gridInstance , 'addVarToUrl' ) . and . callFake ( function ( filterVar , value ) {
20
+ return `https://test.com/${ filterVar } /${ value } /` ;
21
+ } ) ;
22
+ gridInstance . filterVar = 'filter' ;
23
+ } ) ;
24
+
25
+ it ( 'should reset the filter, clean the URL, and reload with the correct URL' , function ( ) {
26
+ let callback = jasmine . createSpy ( 'callback' ) ,
27
+ expectedUrl = 'https://test.com/filter/' ;
28
+
29
+ gridInstance . resetFilter ( callback ) ;
30
+ expect ( gridInstance . addVarToUrl ) . toHaveBeenCalledWith ( 'filter' , '' ) ;
31
+ expect ( gridInstance . reload ) . toHaveBeenCalledWith ( expectedUrl , callback ) ;
32
+ expect ( gridInstance . reload . calls . count ( ) ) . toBe ( 1 ) ;
33
+ } ) ;
34
+ } ) ;
35
+ } ) ;
You can’t perform that action at this time.
0 commit comments