File tree Expand file tree Collapse file tree 2 files changed +67
-4
lines changed
app/code/Magento/Catalog/view/frontend/web/js/product/list
dev/tests/js/jasmine/tests/app/code/Magento/Catalog/frontend/js/product/list Expand file tree Collapse file tree 2 files changed +67
-4
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,26 @@ define([
3535
3636 /** @inheritdoc */
3737 _create : function ( ) {
38- this . _bind ( $ ( this . options . modeControl ) , this . options . mode , this . options . modeDefault ) ;
39- this . _bind ( $ ( this . options . directionControl ) , this . options . direction , this . options . directionDefault ) ;
40- this . _bind ( $ ( this . options . orderControl ) , this . options . order , this . options . orderDefault ) ;
41- this . _bind ( $ ( this . options . limitControl ) , this . options . limit , this . options . limitDefault ) ;
38+ this . _bind (
39+ $ ( this . options . modeControl , this . element ) ,
40+ this . options . mode ,
41+ this . options . modeDefault
42+ ) ;
43+ this . _bind (
44+ $ ( this . options . directionControl , this . element ) ,
45+ this . options . direction ,
46+ this . options . directionDefault
47+ ) ;
48+ this . _bind (
49+ $ ( this . options . orderControl , this . element ) ,
50+ this . options . order ,
51+ this . options . orderDefault
52+ ) ;
53+ this . _bind (
54+ $ ( this . options . limitControl , this . element ) ,
55+ this . options . limit ,
56+ this . options . limitDefault
57+ ) ;
4258 } ,
4359
4460 /** @inheritdoc */
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright © Magento, Inc. All rights reserved.
3+ * See COPYING.txt for license details.
4+ */
5+
6+ define ( [
7+ 'jquery' ,
8+ 'Magento_Catalog/js/product/list/toolbar'
9+ ] , function ( $ ) {
10+ 'use strict' ;
11+
12+ describe ( 'Magento_Catalog/js/product/list/toolbar' , function ( ) {
13+ var widget ,
14+ toolbar ;
15+
16+ beforeEach ( function ( ) {
17+ toolbar = $ ( '<div class="toolbar"></div>' ) ;
18+ } ) ;
19+
20+ afterEach ( function ( ) {
21+ toolbar . remove ( ) ;
22+ } ) ;
23+
24+ it ( 'Widget extends jQuery object' , function ( ) {
25+ expect ( $ . mage . productListToolbarForm ) . toBeDefined ( ) ;
26+ } ) ;
27+
28+ it ( 'Toolbar is initialized' , function ( ) {
29+ spyOn ( $ . mage . productListToolbarForm . prototype , '_create' ) ;
30+
31+ toolbar . productListToolbarForm ( ) ;
32+
33+ expect ( $ . mage . productListToolbarForm . prototype . _create ) . toEqual ( jasmine . any ( Function ) ) ;
34+ expect ( $ . mage . productListToolbarForm . prototype . _create ) . toHaveBeenCalledTimes ( 1 ) ;
35+ } ) ;
36+
37+ it ( 'Toolbar receives options properly' , function ( ) {
38+ toolbar . productListToolbarForm ( ) ;
39+ expect ( toolbar . productListToolbarForm ( 'option' , 'page' ) ) . toBe ( 'p' ) ;
40+ } ) ;
41+
42+ it ( 'Toolbar receives element properly' , function ( ) {
43+ widget = toolbar . productListToolbarForm ( ) ;
44+ expect ( widget ) . toBe ( toolbar ) ;
45+ } ) ;
46+ } ) ;
47+ } ) ;
You can’t perform that action at this time.
0 commit comments