@@ -76,6 +76,7 @@ public async Task ListView_Ok()
7676 [ Fact ]
7777 public async Task Pageable_Ok ( )
7878 {
79+ var triggerByPage = false ;
7980 var items = Enumerable . Range ( 1 , 6 ) . Select ( i => new Product ( )
8081 {
8182 ImageUrl = $ "images/Pic{ i } .jpg",
@@ -84,26 +85,31 @@ public async Task Pageable_Ok()
8485 } ) ;
8586 var cut = Context . RenderComponent < ListView < Product > > ( pb =>
8687 {
87- pb . Add ( a => a . OnQueryAsync , Query ) ;
88- pb . Add ( a => a . Pageable , true ) ;
88+ pb . Add ( a => a . OnQueryAsync , option =>
89+ {
90+ triggerByPage = option . IsTriggerByPagination ;
91+ return Task . FromResult ( new QueryData < Product > ( )
92+ {
93+ Items = items ,
94+ TotalCount = 6
95+ } ) ;
96+ } ) ;
97+ pb . Add ( a => a . IsPagination , true ) ;
8998 pb . Add ( a => a . PageItems , 2 ) ;
9099 } ) ;
100+ Assert . False ( triggerByPage ) ;
91101
92102 var pages = cut . FindAll ( ".page-link" ) ;
93103 Assert . Equal ( 5 , pages . Count ) ;
94104 await cut . InvokeAsync ( ( ) => pages [ 2 ] . Click ( ) ) ;
95-
96- Task < QueryData < Product > > Query ( QueryPageOptions option ) => Task . FromResult ( new QueryData < Product > ( )
97- {
98- Items = items ,
99- TotalCount = 6
100- } ) ;
105+ Assert . True ( triggerByPage ) ;
101106 }
102107
103108 [ Fact ]
104- public void QueryAsync_Ok ( )
109+ public async Task QueryAsync_Ok ( )
105110 {
106111 bool query = false ;
112+ bool page = false ;
107113 var items = Enumerable . Range ( 1 , 6 ) . Select ( i => new Product ( )
108114 {
109115 ImageUrl = $ "images/Pic{ i } .jpg",
@@ -114,6 +120,7 @@ public void QueryAsync_Ok()
114120 {
115121 pb . Add ( a => a . OnQueryAsync , option =>
116122 {
123+ page = option . IsPage ;
117124 query = true ;
118125 var ret = new QueryData < Product > ( )
119126 {
@@ -122,11 +129,12 @@ public void QueryAsync_Ok()
122129 } ;
123130 return Task . FromResult ( ret ) ;
124131 } ) ;
125- pb . Add ( a => a . Pageable , true ) ;
132+ pb . Add ( a => a . IsPagination , true ) ;
126133 pb . Add ( a => a . PageItems , 2 ) ;
127134 } ) ;
128135 Assert . True ( query ) ;
129- cut . InvokeAsync ( ( ) => cut . Instance . QueryAsync ( ) ) ;
136+ Assert . True ( page ) ;
137+ await cut . InvokeAsync ( ( ) => cut . Instance . QueryAsync ( ) ) ;
130138 }
131139
132140 [ Fact ]
@@ -159,7 +167,7 @@ public void Collapsible_Ok()
159167 } ;
160168 return Task . FromResult ( ret ) ;
161169 } ) ;
162- pb . Add ( a => a . Pageable , true ) ;
170+ pb . Add ( a => a . IsPagination , true ) ;
163171 pb . Add ( a => a . PageItems , 2 ) ;
164172 pb . Add ( a => a . OnListViewItemClick , p =>
165173 {
@@ -209,7 +217,7 @@ public void IsAccordion_Ok()
209217 } ;
210218 return Task . FromResult ( ret ) ;
211219 } ) ;
212- pb . Add ( a => a . Pageable , true ) ;
220+ pb . Add ( a => a . IsPagination , true ) ;
213221 pb . Add ( a => a . PageItems , 2 ) ;
214222 } ) ;
215223 var collapse = cut . FindComponent < Collapse > ( ) ;
@@ -246,7 +254,7 @@ public void CollapsedGroupCallback_Ok()
246254 } ;
247255 return Task . FromResult ( ret ) ;
248256 } ) ;
249- pb . Add ( a => a . Pageable , true ) ;
257+ pb . Add ( a => a . IsPagination , true ) ;
250258 pb . Add ( a => a . PageItems , 2 ) ;
251259 } ) ;
252260 Assert . True ( callback ) ;
@@ -281,7 +289,7 @@ public void OnCollapseChanged_Ok()
281289 expect = item ;
282290 return Task . CompletedTask ;
283291 } ) ;
284- pb . Add ( a => a . Pageable , true ) ;
292+ pb . Add ( a => a . IsPagination , true ) ;
285293 pb . Add ( a => a . PageItems , 2 ) ;
286294 } ) ;
287295
0 commit comments