@memberjunction/ng-pagination 5.21.0 → 5.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +7 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/__tests__/pagination.test.d.ts +2 -0
- package/dist/__tests__/pagination.test.d.ts.map +1 -0
- package/dist/__tests__/pagination.test.js +258 -0
- package/dist/__tests__/pagination.test.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect } from 'vitest';\n\ndescribe('@memberjunction/ng-pagination', () => {\n it('should have a passing test', () => {\n expect(true).toBe(true);\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/pagination.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
/**
|
|
3
|
+
* We test PaginationComponent as a plain TypeScript class.
|
|
4
|
+
* Angular decorators are no-ops at test time; we only exercise the pure logic.
|
|
5
|
+
*/
|
|
6
|
+
// Minimal stub so the @Component / @Input / @Output decorators don't explode at import time.
|
|
7
|
+
vi.mock('@angular/core', () => ({
|
|
8
|
+
Component: () => () => { },
|
|
9
|
+
Input: () => () => { },
|
|
10
|
+
Output: () => () => { },
|
|
11
|
+
EventEmitter: class {
|
|
12
|
+
listeners = [];
|
|
13
|
+
emit(value) {
|
|
14
|
+
for (const fn of this.listeners)
|
|
15
|
+
fn(value);
|
|
16
|
+
}
|
|
17
|
+
subscribe(fn) {
|
|
18
|
+
this.listeners.push(fn);
|
|
19
|
+
return { unsubscribe: () => { this.listeners = this.listeners.filter(l => l !== fn); } };
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
vi.mock('@angular/common', () => ({ CommonModule: {} }));
|
|
24
|
+
import { PaginationComponent } from '../lib/pagination.component';
|
|
25
|
+
function createComponent(overrides = {}) {
|
|
26
|
+
const c = new PaginationComponent();
|
|
27
|
+
if (overrides.TotalRowCount !== undefined)
|
|
28
|
+
c.TotalRowCount = overrides.TotalRowCount;
|
|
29
|
+
if (overrides.PageNumber !== undefined)
|
|
30
|
+
c.PageNumber = overrides.PageNumber;
|
|
31
|
+
if (overrides.PageSize !== undefined)
|
|
32
|
+
c.PageSize = overrides.PageSize;
|
|
33
|
+
if (overrides.IsLoading !== undefined)
|
|
34
|
+
c.IsLoading = overrides.IsLoading;
|
|
35
|
+
return c;
|
|
36
|
+
}
|
|
37
|
+
describe('PaginationComponent', () => {
|
|
38
|
+
// ------------------------------------------------------------------ TotalPages
|
|
39
|
+
describe('TotalPages', () => {
|
|
40
|
+
it('returns 0 when TotalRowCount is 0', () => {
|
|
41
|
+
const c = createComponent({ TotalRowCount: 0, PageSize: 10 });
|
|
42
|
+
expect(c.TotalPages).toBe(0);
|
|
43
|
+
});
|
|
44
|
+
it('returns 0 when TotalRowCount is negative', () => {
|
|
45
|
+
const c = createComponent({ TotalRowCount: -5, PageSize: 10 });
|
|
46
|
+
expect(c.TotalPages).toBe(0);
|
|
47
|
+
});
|
|
48
|
+
it('returns 0 when PageSize is 0', () => {
|
|
49
|
+
const c = createComponent({ TotalRowCount: 50, PageSize: 0 });
|
|
50
|
+
expect(c.TotalPages).toBe(0);
|
|
51
|
+
});
|
|
52
|
+
it('returns 0 when PageSize is negative', () => {
|
|
53
|
+
const c = createComponent({ TotalRowCount: 50, PageSize: -1 });
|
|
54
|
+
expect(c.TotalPages).toBe(0);
|
|
55
|
+
});
|
|
56
|
+
it('returns 1 when rows fit exactly in one page', () => {
|
|
57
|
+
const c = createComponent({ TotalRowCount: 10, PageSize: 10 });
|
|
58
|
+
expect(c.TotalPages).toBe(1);
|
|
59
|
+
});
|
|
60
|
+
it('rounds up for partial last page', () => {
|
|
61
|
+
const c = createComponent({ TotalRowCount: 11, PageSize: 10 });
|
|
62
|
+
expect(c.TotalPages).toBe(2);
|
|
63
|
+
});
|
|
64
|
+
it('handles large datasets', () => {
|
|
65
|
+
const c = createComponent({ TotalRowCount: 1_000_000, PageSize: 100 });
|
|
66
|
+
expect(c.TotalPages).toBe(10_000);
|
|
67
|
+
});
|
|
68
|
+
it('handles PageSize=1', () => {
|
|
69
|
+
const c = createComponent({ TotalRowCount: 5, PageSize: 1 });
|
|
70
|
+
expect(c.TotalPages).toBe(5);
|
|
71
|
+
});
|
|
72
|
+
it('handles single row with default PageSize', () => {
|
|
73
|
+
const c = createComponent({ TotalRowCount: 1 });
|
|
74
|
+
expect(c.TotalPages).toBe(1);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
// ---------------------------------------------------------- DisplayFrom / DisplayTo
|
|
78
|
+
describe('DisplayFrom', () => {
|
|
79
|
+
it('returns 0 when TotalRowCount is 0', () => {
|
|
80
|
+
const c = createComponent({ TotalRowCount: 0 });
|
|
81
|
+
expect(c.DisplayFrom).toBe(0);
|
|
82
|
+
});
|
|
83
|
+
it('returns 1 on the first page', () => {
|
|
84
|
+
const c = createComponent({ TotalRowCount: 50, PageNumber: 1, PageSize: 10 });
|
|
85
|
+
expect(c.DisplayFrom).toBe(1);
|
|
86
|
+
});
|
|
87
|
+
it('returns correct start for second page', () => {
|
|
88
|
+
const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10 });
|
|
89
|
+
expect(c.DisplayFrom).toBe(11);
|
|
90
|
+
});
|
|
91
|
+
it('returns correct start for last page', () => {
|
|
92
|
+
const c = createComponent({ TotalRowCount: 25, PageNumber: 3, PageSize: 10 });
|
|
93
|
+
expect(c.DisplayFrom).toBe(21);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
describe('DisplayTo', () => {
|
|
97
|
+
it('returns 0 when TotalRowCount is 0', () => {
|
|
98
|
+
const c = createComponent({ TotalRowCount: 0, PageSize: 10 });
|
|
99
|
+
expect(c.DisplayTo).toBe(0);
|
|
100
|
+
});
|
|
101
|
+
it('caps at TotalRowCount on last partial page', () => {
|
|
102
|
+
const c = createComponent({ TotalRowCount: 25, PageNumber: 3, PageSize: 10 });
|
|
103
|
+
expect(c.DisplayTo).toBe(25);
|
|
104
|
+
});
|
|
105
|
+
it('equals PageSize * PageNumber on a full page', () => {
|
|
106
|
+
const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10 });
|
|
107
|
+
expect(c.DisplayTo).toBe(20);
|
|
108
|
+
});
|
|
109
|
+
it('equals TotalRowCount on single-page dataset', () => {
|
|
110
|
+
const c = createComponent({ TotalRowCount: 7, PageNumber: 1, PageSize: 10 });
|
|
111
|
+
expect(c.DisplayTo).toBe(7);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
// -------------------------------------------------------- CanGoBack / CanGoForward
|
|
115
|
+
describe('CanGoBack', () => {
|
|
116
|
+
it('returns false on first page', () => {
|
|
117
|
+
const c = createComponent({ TotalRowCount: 50, PageNumber: 1 });
|
|
118
|
+
expect(c.CanGoBack).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
it('returns true on page > 1', () => {
|
|
121
|
+
const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10 });
|
|
122
|
+
expect(c.CanGoBack).toBe(true);
|
|
123
|
+
});
|
|
124
|
+
it('returns false when IsLoading even on page > 1', () => {
|
|
125
|
+
const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10, IsLoading: true });
|
|
126
|
+
expect(c.CanGoBack).toBe(false);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
describe('CanGoForward', () => {
|
|
130
|
+
it('returns false on last page', () => {
|
|
131
|
+
const c = createComponent({ TotalRowCount: 20, PageNumber: 2, PageSize: 10 });
|
|
132
|
+
expect(c.CanGoForward).toBe(false);
|
|
133
|
+
});
|
|
134
|
+
it('returns true when not on last page', () => {
|
|
135
|
+
const c = createComponent({ TotalRowCount: 30, PageNumber: 2, PageSize: 10 });
|
|
136
|
+
expect(c.CanGoForward).toBe(true);
|
|
137
|
+
});
|
|
138
|
+
it('returns false when IsLoading even if not on last page', () => {
|
|
139
|
+
const c = createComponent({ TotalRowCount: 30, PageNumber: 1, PageSize: 10, IsLoading: true });
|
|
140
|
+
expect(c.CanGoForward).toBe(false);
|
|
141
|
+
});
|
|
142
|
+
it('returns false when TotalRowCount is 0', () => {
|
|
143
|
+
const c = createComponent({ TotalRowCount: 0, PageNumber: 1, PageSize: 10 });
|
|
144
|
+
expect(c.CanGoForward).toBe(false);
|
|
145
|
+
});
|
|
146
|
+
it('returns false on single-page dataset', () => {
|
|
147
|
+
const c = createComponent({ TotalRowCount: 5, PageNumber: 1, PageSize: 10 });
|
|
148
|
+
expect(c.CanGoForward).toBe(false);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
// ----------------------------------------------------------------- Navigation
|
|
152
|
+
describe('Navigation methods', () => {
|
|
153
|
+
let comp;
|
|
154
|
+
let emitted;
|
|
155
|
+
beforeEach(() => {
|
|
156
|
+
comp = createComponent({ TotalRowCount: 50, PageNumber: 3, PageSize: 10 });
|
|
157
|
+
emitted = [];
|
|
158
|
+
comp.PageChange.subscribe((e) => emitted.push(e));
|
|
159
|
+
});
|
|
160
|
+
describe('GoToFirst', () => {
|
|
161
|
+
it('emits page 1 when CanGoBack is true', () => {
|
|
162
|
+
comp.GoToFirst();
|
|
163
|
+
expect(emitted).toHaveLength(1);
|
|
164
|
+
expect(emitted[0]).toEqual({ PageNumber: 1, PageSize: 10, StartRow: 0 });
|
|
165
|
+
});
|
|
166
|
+
it('does nothing on page 1', () => {
|
|
167
|
+
comp.PageNumber = 1;
|
|
168
|
+
comp.GoToFirst();
|
|
169
|
+
expect(emitted).toHaveLength(0);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
describe('GoToPrevious', () => {
|
|
173
|
+
it('emits previous page', () => {
|
|
174
|
+
comp.GoToPrevious();
|
|
175
|
+
expect(emitted).toHaveLength(1);
|
|
176
|
+
expect(emitted[0]).toEqual({ PageNumber: 2, PageSize: 10, StartRow: 10 });
|
|
177
|
+
});
|
|
178
|
+
it('does nothing on page 1', () => {
|
|
179
|
+
comp.PageNumber = 1;
|
|
180
|
+
comp.GoToPrevious();
|
|
181
|
+
expect(emitted).toHaveLength(0);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
describe('GoToNext', () => {
|
|
185
|
+
it('emits next page', () => {
|
|
186
|
+
comp.GoToNext();
|
|
187
|
+
expect(emitted).toHaveLength(1);
|
|
188
|
+
expect(emitted[0]).toEqual({ PageNumber: 4, PageSize: 10, StartRow: 30 });
|
|
189
|
+
});
|
|
190
|
+
it('does nothing on last page', () => {
|
|
191
|
+
comp.PageNumber = 5; // last page of 50/10
|
|
192
|
+
comp.GoToNext();
|
|
193
|
+
expect(emitted).toHaveLength(0);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
describe('GoToLast', () => {
|
|
197
|
+
it('emits last page', () => {
|
|
198
|
+
comp.GoToLast();
|
|
199
|
+
expect(emitted).toHaveLength(1);
|
|
200
|
+
expect(emitted[0]).toEqual({ PageNumber: 5, PageSize: 10, StartRow: 40 });
|
|
201
|
+
});
|
|
202
|
+
it('does nothing when already on last page', () => {
|
|
203
|
+
comp.PageNumber = 5;
|
|
204
|
+
comp.GoToLast();
|
|
205
|
+
expect(emitted).toHaveLength(0);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
// ------------------------------------------------------------ PageChangeEvent shape
|
|
210
|
+
describe('PageChangeEvent', () => {
|
|
211
|
+
it('StartRow is always (PageNumber - 1) * PageSize', () => {
|
|
212
|
+
const comp = createComponent({ TotalRowCount: 500, PageNumber: 1, PageSize: 25 });
|
|
213
|
+
const events = [];
|
|
214
|
+
comp.PageChange.subscribe((e) => events.push(e));
|
|
215
|
+
comp.GoToNext(); // page 2
|
|
216
|
+
expect(events[0].StartRow).toBe(25);
|
|
217
|
+
comp.PageNumber = 10;
|
|
218
|
+
comp.GoToNext(); // page 11
|
|
219
|
+
expect(events[1].StartRow).toBe(250);
|
|
220
|
+
});
|
|
221
|
+
it('carries the current PageSize', () => {
|
|
222
|
+
const comp = createComponent({ TotalRowCount: 100, PageNumber: 1, PageSize: 42 });
|
|
223
|
+
const events = [];
|
|
224
|
+
comp.PageChange.subscribe((e) => events.push(e));
|
|
225
|
+
comp.GoToNext();
|
|
226
|
+
expect(events[0].PageSize).toBe(42);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
// ----------------------------------------------------------------- Edge cases
|
|
230
|
+
describe('Edge cases', () => {
|
|
231
|
+
it('does not emit when IsLoading blocks all navigation', () => {
|
|
232
|
+
const comp = createComponent({ TotalRowCount: 100, PageNumber: 3, PageSize: 10, IsLoading: true });
|
|
233
|
+
const events = [];
|
|
234
|
+
comp.PageChange.subscribe((e) => events.push(e));
|
|
235
|
+
comp.GoToFirst();
|
|
236
|
+
comp.GoToPrevious();
|
|
237
|
+
comp.GoToNext();
|
|
238
|
+
comp.GoToLast();
|
|
239
|
+
expect(events).toHaveLength(0);
|
|
240
|
+
});
|
|
241
|
+
it('handles PageSize=1 navigation correctly', () => {
|
|
242
|
+
const comp = createComponent({ TotalRowCount: 3, PageNumber: 2, PageSize: 1 });
|
|
243
|
+
expect(comp.TotalPages).toBe(3);
|
|
244
|
+
expect(comp.DisplayFrom).toBe(2);
|
|
245
|
+
expect(comp.DisplayTo).toBe(2);
|
|
246
|
+
expect(comp.CanGoBack).toBe(true);
|
|
247
|
+
expect(comp.CanGoForward).toBe(true);
|
|
248
|
+
});
|
|
249
|
+
it('works with very large PageSize', () => {
|
|
250
|
+
const comp = createComponent({ TotalRowCount: 5, PageNumber: 1, PageSize: 10000 });
|
|
251
|
+
expect(comp.TotalPages).toBe(1);
|
|
252
|
+
expect(comp.DisplayFrom).toBe(1);
|
|
253
|
+
expect(comp.DisplayTo).toBe(5);
|
|
254
|
+
expect(comp.CanGoForward).toBe(false);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
//# sourceMappingURL=pagination.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.test.js","sourceRoot":"","sources":["../../src/__tests__/pagination.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE9D;;;GAGG;AAEH,6FAA6F;AAC7F,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;IACzB,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;IACrB,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;IACtB,YAAY,EAAE;QACF,SAAS,GAA2B,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAQ;YACT,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,SAAS;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AAC;QAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;YACtC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YACnF,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect, vi, beforeEach } from 'vitest';\n\n/**\n * We test PaginationComponent as a plain TypeScript class.\n * Angular decorators are no-ops at test time; we only exercise the pure logic.\n */\n\n// Minimal stub so the @Component / @Input / @Output decorators don't explode at import time.\nvi.mock('@angular/core', () => ({\n Component: () => () => {},\n Input: () => () => {},\n Output: () => () => {},\n EventEmitter: class<T = unknown> {\n private listeners: ((value: T) => void)[] = [];\n emit(value: T): void {\n for (const fn of this.listeners) fn(value);\n }\n subscribe(fn: (value: T) => void): { unsubscribe: () => void } {\n this.listeners.push(fn);\n return { unsubscribe: () => { this.listeners = this.listeners.filter(l => l !== fn); } };\n }\n },\n}));\nvi.mock('@angular/common', () => ({ CommonModule: {} }));\n\nimport { PaginationComponent, PageChangeEvent } from '../lib/pagination.component';\n\nfunction createComponent(overrides: Partial<Pick<PaginationComponent, 'TotalRowCount' | 'PageNumber' | 'PageSize' | 'IsLoading'>> = {}): PaginationComponent {\n const c = new PaginationComponent();\n if (overrides.TotalRowCount !== undefined) c.TotalRowCount = overrides.TotalRowCount;\n if (overrides.PageNumber !== undefined) c.PageNumber = overrides.PageNumber;\n if (overrides.PageSize !== undefined) c.PageSize = overrides.PageSize;\n if (overrides.IsLoading !== undefined) c.IsLoading = overrides.IsLoading;\n return c;\n}\n\ndescribe('PaginationComponent', () => {\n // ------------------------------------------------------------------ TotalPages\n describe('TotalPages', () => {\n it('returns 0 when TotalRowCount is 0', () => {\n const c = createComponent({ TotalRowCount: 0, PageSize: 10 });\n expect(c.TotalPages).toBe(0);\n });\n\n it('returns 0 when TotalRowCount is negative', () => {\n const c = createComponent({ TotalRowCount: -5, PageSize: 10 });\n expect(c.TotalPages).toBe(0);\n });\n\n it('returns 0 when PageSize is 0', () => {\n const c = createComponent({ TotalRowCount: 50, PageSize: 0 });\n expect(c.TotalPages).toBe(0);\n });\n\n it('returns 0 when PageSize is negative', () => {\n const c = createComponent({ TotalRowCount: 50, PageSize: -1 });\n expect(c.TotalPages).toBe(0);\n });\n\n it('returns 1 when rows fit exactly in one page', () => {\n const c = createComponent({ TotalRowCount: 10, PageSize: 10 });\n expect(c.TotalPages).toBe(1);\n });\n\n it('rounds up for partial last page', () => {\n const c = createComponent({ TotalRowCount: 11, PageSize: 10 });\n expect(c.TotalPages).toBe(2);\n });\n\n it('handles large datasets', () => {\n const c = createComponent({ TotalRowCount: 1_000_000, PageSize: 100 });\n expect(c.TotalPages).toBe(10_000);\n });\n\n it('handles PageSize=1', () => {\n const c = createComponent({ TotalRowCount: 5, PageSize: 1 });\n expect(c.TotalPages).toBe(5);\n });\n\n it('handles single row with default PageSize', () => {\n const c = createComponent({ TotalRowCount: 1 });\n expect(c.TotalPages).toBe(1);\n });\n });\n\n // ---------------------------------------------------------- DisplayFrom / DisplayTo\n describe('DisplayFrom', () => {\n it('returns 0 when TotalRowCount is 0', () => {\n const c = createComponent({ TotalRowCount: 0 });\n expect(c.DisplayFrom).toBe(0);\n });\n\n it('returns 1 on the first page', () => {\n const c = createComponent({ TotalRowCount: 50, PageNumber: 1, PageSize: 10 });\n expect(c.DisplayFrom).toBe(1);\n });\n\n it('returns correct start for second page', () => {\n const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10 });\n expect(c.DisplayFrom).toBe(11);\n });\n\n it('returns correct start for last page', () => {\n const c = createComponent({ TotalRowCount: 25, PageNumber: 3, PageSize: 10 });\n expect(c.DisplayFrom).toBe(21);\n });\n });\n\n describe('DisplayTo', () => {\n it('returns 0 when TotalRowCount is 0', () => {\n const c = createComponent({ TotalRowCount: 0, PageSize: 10 });\n expect(c.DisplayTo).toBe(0);\n });\n\n it('caps at TotalRowCount on last partial page', () => {\n const c = createComponent({ TotalRowCount: 25, PageNumber: 3, PageSize: 10 });\n expect(c.DisplayTo).toBe(25);\n });\n\n it('equals PageSize * PageNumber on a full page', () => {\n const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10 });\n expect(c.DisplayTo).toBe(20);\n });\n\n it('equals TotalRowCount on single-page dataset', () => {\n const c = createComponent({ TotalRowCount: 7, PageNumber: 1, PageSize: 10 });\n expect(c.DisplayTo).toBe(7);\n });\n });\n\n // -------------------------------------------------------- CanGoBack / CanGoForward\n describe('CanGoBack', () => {\n it('returns false on first page', () => {\n const c = createComponent({ TotalRowCount: 50, PageNumber: 1 });\n expect(c.CanGoBack).toBe(false);\n });\n\n it('returns true on page > 1', () => {\n const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10 });\n expect(c.CanGoBack).toBe(true);\n });\n\n it('returns false when IsLoading even on page > 1', () => {\n const c = createComponent({ TotalRowCount: 50, PageNumber: 2, PageSize: 10, IsLoading: true });\n expect(c.CanGoBack).toBe(false);\n });\n });\n\n describe('CanGoForward', () => {\n it('returns false on last page', () => {\n const c = createComponent({ TotalRowCount: 20, PageNumber: 2, PageSize: 10 });\n expect(c.CanGoForward).toBe(false);\n });\n\n it('returns true when not on last page', () => {\n const c = createComponent({ TotalRowCount: 30, PageNumber: 2, PageSize: 10 });\n expect(c.CanGoForward).toBe(true);\n });\n\n it('returns false when IsLoading even if not on last page', () => {\n const c = createComponent({ TotalRowCount: 30, PageNumber: 1, PageSize: 10, IsLoading: true });\n expect(c.CanGoForward).toBe(false);\n });\n\n it('returns false when TotalRowCount is 0', () => {\n const c = createComponent({ TotalRowCount: 0, PageNumber: 1, PageSize: 10 });\n expect(c.CanGoForward).toBe(false);\n });\n\n it('returns false on single-page dataset', () => {\n const c = createComponent({ TotalRowCount: 5, PageNumber: 1, PageSize: 10 });\n expect(c.CanGoForward).toBe(false);\n });\n });\n\n // ----------------------------------------------------------------- Navigation\n describe('Navigation methods', () => {\n let comp: PaginationComponent;\n let emitted: PageChangeEvent[];\n\n beforeEach(() => {\n comp = createComponent({ TotalRowCount: 50, PageNumber: 3, PageSize: 10 });\n emitted = [];\n comp.PageChange.subscribe((e: PageChangeEvent) => emitted.push(e));\n });\n\n describe('GoToFirst', () => {\n it('emits page 1 when CanGoBack is true', () => {\n comp.GoToFirst();\n expect(emitted).toHaveLength(1);\n expect(emitted[0]).toEqual({ PageNumber: 1, PageSize: 10, StartRow: 0 });\n });\n\n it('does nothing on page 1', () => {\n comp.PageNumber = 1;\n comp.GoToFirst();\n expect(emitted).toHaveLength(0);\n });\n });\n\n describe('GoToPrevious', () => {\n it('emits previous page', () => {\n comp.GoToPrevious();\n expect(emitted).toHaveLength(1);\n expect(emitted[0]).toEqual({ PageNumber: 2, PageSize: 10, StartRow: 10 });\n });\n\n it('does nothing on page 1', () => {\n comp.PageNumber = 1;\n comp.GoToPrevious();\n expect(emitted).toHaveLength(0);\n });\n });\n\n describe('GoToNext', () => {\n it('emits next page', () => {\n comp.GoToNext();\n expect(emitted).toHaveLength(1);\n expect(emitted[0]).toEqual({ PageNumber: 4, PageSize: 10, StartRow: 30 });\n });\n\n it('does nothing on last page', () => {\n comp.PageNumber = 5; // last page of 50/10\n comp.GoToNext();\n expect(emitted).toHaveLength(0);\n });\n });\n\n describe('GoToLast', () => {\n it('emits last page', () => {\n comp.GoToLast();\n expect(emitted).toHaveLength(1);\n expect(emitted[0]).toEqual({ PageNumber: 5, PageSize: 10, StartRow: 40 });\n });\n\n it('does nothing when already on last page', () => {\n comp.PageNumber = 5;\n comp.GoToLast();\n expect(emitted).toHaveLength(0);\n });\n });\n });\n\n // ------------------------------------------------------------ PageChangeEvent shape\n describe('PageChangeEvent', () => {\n it('StartRow is always (PageNumber - 1) * PageSize', () => {\n const comp = createComponent({ TotalRowCount: 500, PageNumber: 1, PageSize: 25 });\n const events: PageChangeEvent[] = [];\n comp.PageChange.subscribe((e: PageChangeEvent) => events.push(e));\n\n comp.GoToNext(); // page 2\n expect(events[0].StartRow).toBe(25);\n\n comp.PageNumber = 10;\n comp.GoToNext(); // page 11\n expect(events[1].StartRow).toBe(250);\n });\n\n it('carries the current PageSize', () => {\n const comp = createComponent({ TotalRowCount: 100, PageNumber: 1, PageSize: 42 });\n const events: PageChangeEvent[] = [];\n comp.PageChange.subscribe((e: PageChangeEvent) => events.push(e));\n\n comp.GoToNext();\n expect(events[0].PageSize).toBe(42);\n });\n });\n\n // ----------------------------------------------------------------- Edge cases\n describe('Edge cases', () => {\n it('does not emit when IsLoading blocks all navigation', () => {\n const comp = createComponent({ TotalRowCount: 100, PageNumber: 3, PageSize: 10, IsLoading: true });\n const events: PageChangeEvent[] = [];\n comp.PageChange.subscribe((e: PageChangeEvent) => events.push(e));\n\n comp.GoToFirst();\n comp.GoToPrevious();\n comp.GoToNext();\n comp.GoToLast();\n expect(events).toHaveLength(0);\n });\n\n it('handles PageSize=1 navigation correctly', () => {\n const comp = createComponent({ TotalRowCount: 3, PageNumber: 2, PageSize: 1 });\n expect(comp.TotalPages).toBe(3);\n expect(comp.DisplayFrom).toBe(2);\n expect(comp.DisplayTo).toBe(2);\n expect(comp.CanGoBack).toBe(true);\n expect(comp.CanGoForward).toBe(true);\n });\n\n it('works with very large PageSize', () => {\n const comp = createComponent({ TotalRowCount: 5, PageNumber: 1, PageSize: 10000 });\n expect(comp.TotalPages).toBe(1);\n expect(comp.DisplayFrom).toBe(1);\n expect(comp.DisplayTo).toBe(5);\n expect(comp.CanGoForward).toBe(false);\n });\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-pagination",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.23.0",
|
|
4
4
|
"description": "MemberJunction: Reusable pagination component for server-side paged data with first/prev/next/last navigation",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"/dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "vitest run",
|
|
12
12
|
"build": "ngc",
|
|
13
13
|
"test:watch": "vitest"
|
|
14
14
|
},
|