2222 HTMLImports . whenReady ( function ( ) {
2323 PageTest = Polymer ( {
2424 is :"test-pageable" ,
25- behaviors :[ StrandTraits . Pageable ]
25+ behaviors :[ StrandTraits . Pageable ] ,
26+ created : function ( ) {
27+ this . _def = { resolve :null , reject :null } ;
28+ this . testReady = new Promise ( function ( res , rej ) {
29+ this . _def . resolve = res ;
30+ this . _def . reject = rej ;
31+ } . bind ( this ) ) ;
32+ } ,
33+ ready :function ( ) {
34+ this . _def . resolve ( true ) ;
35+ }
2636 } ) ;
2737 } ) ;
28-
38+
2939 /** begin tests **/
3040
3141 describe ( "Pageable" , function ( ) {
4454 } ;
4555
4656 var page = new PageTest ( ) ;
47- page . autoDebounce = 0 ;
57+ page . testReady . then ( function ( ) {
4858
49- flush ( function ( ) {
50- page . nextPage ( ) ;
51- page . page . should . equal ( 1 ) ;
52- flush ( function ( ) {
53- request . url . should . contain ( "page_offset=10" ) ;
54- request . url . should . contain ( "page_limit=10" ) ;
55- xhr . restore ( ) ;
56- done ( ) ;
57- } ) ;
58- } . bind ( this ) ) ;
59+ page . usePaging = true ;
60+ page . autoDebounce = 0 ;
5961
62+ flush ( function ( ) {
63+ page . nextPage ( ) ;
64+ page . page . should . equal ( 1 ) ;
65+ flush ( function ( ) {
66+ request . url . should . contain ( "page_offset=10" ) ;
67+ request . url . should . contain ( "page_limit=10" ) ;
68+ xhr . restore ( ) ;
69+ done ( ) ;
70+ } ) ;
71+ } . bind ( this ) ) ;
72+ } ) ;
6073 } ) ;
6174
6275 it ( "should update on index change" , function ( done ) {
6780 } ;
6881
6982 var page = new PageTest ( ) ;
70- page . autoDebounce = 0 ;
83+ page . testReady . then ( function ( ) {
84+
85+ page . usePaging = true ;
86+ page . autoDebounce = 0 ;
7187
72- flush ( function ( ) {
73- page . index = 20 ;
74- page . page . should . equal ( 20 ) ;
7588 flush ( function ( ) {
76- request . url . should . contain ( "page_offset=20" ) ;
77- request . url . should . contain ( "page_limit=10" ) ;
78- xhr . restore ( ) ;
79- done ( ) ;
80- } ) ;
81- } . bind ( this ) ) ;
89+ page . index = 20 ;
90+ page . page . should . equal ( 20 ) ;
91+ flush ( function ( ) {
92+ request . url . should . contain ( "page_offset=20" ) ;
93+ request . url . should . contain ( "page_limit=10" ) ;
94+ xhr . restore ( ) ;
95+ done ( ) ;
96+ } ) ;
97+ } . bind ( this ) ) ;
98+ } ) ;
8299 } ) ;
83100
84101 it ( "should update on index change" , function ( done ) {
90107
91108 var page = new PageTest ( ) ;
92109 page . autoDebounce = 0 ;
110+ page . usePaging = true ;
93111 page . pageOptions = { pageType : page . PAGE_TYPE_INDEX } ;
94112
95113 flush ( function ( ) {
108126 </ script >
109127<!-- <test-pageable id="test" auto="true"></test-pageable> -->
110128</ body >
111- </ html >
129+ </ html >
0 commit comments