3 describe('Scroll forward should not advance beyond end', function() {
7 // [first, last, pageSize, count, setting, expectFirst, expectLast, expectRefresh]
8 data = [ [ 0, 19 , 20, 100, 20, 20 , 39 , true ],
9 [ 0, 19 , 20, 100, 100, 80 , 99 , true ],
10 [ 0, 19 , 20, 100, 80, 80 , 99 , true ],
11 [ 0, 19 , 20, 100, 79, 79 , 98 , true ],
12 [ 79, 99 , 20, 100, 50, 50 , 69 , true ],
13 [ 0, 11 , 20, 12, 19, 0 , 11 , false ],
14 [ 0, (-1), 20, 0, 20, 0 , (-1), false ]
17 function doTest(datum) {
20 bm.pageSize = datum[2];
23 var oldFunc = bm.refreshData;
24 calledRefreshData = false;
26 bm.refreshData = function() {
27 calledRefreshData = true;
30 bm.adjustPos(datum[4]);
33 bm.refreshData = oldFunc;
37 it('should stay within valid range, and call refreshData() if bm.first changes', function() {
39 for (i = 0; i < data.length; i += 1) {
42 expect(bm.first).toBe(datum[5]);
43 expect(bm.last).toBe(datum[6]);
44 expect(calledRefreshData).toBe(datum[7]);