File tree Expand file tree Collapse file tree 3 files changed +64
-0
lines changed Expand file tree Collapse file tree 3 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -207,4 +207,27 @@ var config = {
207
207
'</li>' ,
208
208
'{{/options}}'
209
209
] . join ( '' )
210
+ , pageSizeContainerSelector : '.page_size_container'
211
+ , pageSizeOptions : [ {
212
+ name : '12' ,
213
+ value : '12'
214
+ } , {
215
+ name : '24' ,
216
+ value : '24'
217
+ } , {
218
+ name : '36' ,
219
+ value : '36'
220
+ } ]
221
+ , pageSizeContainerType : 'select'
222
+ , pageSizeContainerTemp : [
223
+ '<select>' ,
224
+ '{{#options}}' ,
225
+ '{{#if selected}}' ,
226
+ '<option value="{{value}}" selected unbxdpageSize="{{value}}">{{name}}</option>' ,
227
+ '{{else}}' ,
228
+ '<option value="{{value}}" unbxdpageSize="{{value}}">{{name}}</option>' ,
229
+ '{{/if}}' ,
230
+ '{{/options}}' ,
231
+ '</select>'
232
+ ] . join ( '' )
210
233
} ;
Original file line number Diff line number Diff line change 13
13
< div class ="search-container ">
14
14
< div class ="row clearfix ">
15
15
< div id ="pagination_container "> </ div >
16
+ < div class ="page_size_container "> </ div >
16
17
< div class ="view_type_select "> </ div >
17
18
< div class ="banner "> </ div >
18
19
< div class ="lt search-facet-column " id ="facets_container ">
Original file line number Diff line number Diff line change
1
+ describe ( 'PageSize' , function ( ) {
2
+ var expect = window . expect ;
3
+ fixture . setBase ( 'mock' ) ;
4
+ var searchTest = fixture . load ( 'searchTestResponse.json' ) ;
5
+
6
+ before ( function ( ) {
7
+
8
+ //setup document to hold search results
9
+ document . body . innerHTML = __html__ [ 'index.html' ] ;
10
+
11
+ window . config . isAutoScroll = false ;
12
+ window . config . isPagination = true ;
13
+
14
+ //initialize search
15
+ window . searchobj = new window . Unbxd . setSearch ( window . config ) ;
16
+
17
+ //stub search ajax call with mock response
18
+ this . stub = sinon . stub ( jQuery , 'ajax' ) . yieldsTo ( 'success' , searchTest ) ;
19
+ } ) ;
20
+
21
+ after ( function ( ) {
22
+ this . stub . restore ( ) ;
23
+ } ) ;
24
+
25
+ beforeEach ( function ( ) {
26
+ //reset filters applied
27
+ window . searchobj . reset ( ) ;
28
+ window . searchobj . callResults ( window . searchobj . paintResultSet ) ;
29
+ } ) ;
30
+
31
+ it ( 'Should update the PageSize' , function ( ) {
32
+
33
+ var pageSize = window . searchobj . options . pageSizeOptions [ 2 ] . value ;
34
+ searchTest . searchMetaData . queryParams . rows = pageSize ;
35
+ this . stub . yieldsTo ( 'success' , searchTest ) ;
36
+ jQuery ( window . searchobj . options . pageSizeContainerSelector + ' select' )
37
+ . val ( pageSize ) . change ( ) ;
38
+ expect ( window . searchobj . getPageSize ( ) ) . to . be . equal ( pageSize ) ;
39
+ } ) ;
40
+ } ) ;
You can’t perform that action at this time.
0 commit comments