Skip to content

Commit d51274e

Browse files
committed
feat: update tests logic for Pagination
1 parent 1ec1653 commit d51274e

File tree

5 files changed

+46
-80
lines changed

5 files changed

+46
-80
lines changed

packages/plasma-b2c/src/components/Pagination/Pagination.component-test.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,13 @@ describe('plasma-new-hope: Pagination Content', () => {
216216
const [pageValue, setPageValue] = useState(args.value);
217217
const [perPageValue, setPerPageValue] = useState(args.perPage);
218218

219-
const handleChangePerpage = useCallback(
220-
(perPage: number) => {
221-
setPerPageValue(perPage);
222-
},
223-
[perPageValue, setPerPageValue],
224-
);
219+
const handleChangePerPage = (perPage: number) => {
220+
setPerPageValue(perPage);
221+
};
225222

226-
const handleChangePage = useCallback(
227-
(page: number) => {
228-
setPageValue(page);
229-
},
230-
[pageValue, setPageValue],
231-
);
223+
const handleChangePage = (page: number) => {
224+
setPageValue(page);
225+
};
232226

233227
return (
234228
<>
@@ -237,7 +231,6 @@ describe('plasma-new-hope: Pagination Content', () => {
237231
count={count}
238232
value={pageValue}
239233
perPage={perPageValue}
240-
count={count}
241234
leftContent={
242235
<Button
243236
id="pagination-button-prev"
@@ -259,7 +252,7 @@ describe('plasma-new-hope: Pagination Content', () => {
259252
</Button>
260253
}
261254
onChangePageValue={handleChangePage}
262-
onChangePerageValue={handleChangePerpage}
255+
onChangePerPageValue={handleChangePerPage}
263256
/>
264257
</>
265258
);
@@ -281,7 +274,7 @@ describe('plasma-new-hope: Pagination Content', () => {
281274
it('setInput', () => {
282275
mount(
283276
<CypressTestDecoratorWithTypo>
284-
<Pagination slots={slots[1]} value={values[0]} count={count} />
277+
<Pagination slots={slots[1]} count={count} />
285278
</CypressTestDecoratorWithTypo>,
286279
);
287280
cy.get('input:first').focus().type('10').type('{enter}');
@@ -293,7 +286,7 @@ describe('plasma-new-hope: Pagination Content', () => {
293286

294287
mount(
295288
<CypressTestDecoratorWithTypo>
296-
<Pagination slots={slots[2]} value={values[0]} count={count} listWidth="5rem" />
289+
<Pagination slots={slots[2]} count={count} listWidth="5rem" />
297290
</CypressTestDecoratorWithTypo>,
298291
);
299292
cy.get('button').last().click();

packages/plasma-giga/src/components/Pagination/Pagination.component-test.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,13 @@ describe('plasma-giga: Pagination Content', () => {
191191
const [pageValue, setPageValue] = useState(args.value);
192192
const [perPageValue, setPerPageValue] = useState(args.perPage);
193193

194-
const handleChangePerpage = useCallback(
195-
(perPage: number) => {
196-
setPerPageValue(perPage);
197-
},
198-
[perPageValue, setPerPageValue],
199-
);
194+
const handleChangePerPage = (perPage: number) => {
195+
setPerPageValue(perPage);
196+
};
200197

201-
const handleChangePage = useCallback(
202-
(page: number) => {
203-
setPageValue(page);
204-
},
205-
[pageValue, setPageValue],
206-
);
198+
const handleChangePage = (page: number) => {
199+
setPageValue(page);
200+
};
207201

208202
return (
209203
<>
@@ -212,7 +206,6 @@ describe('plasma-giga: Pagination Content', () => {
212206
count={count}
213207
value={pageValue}
214208
perPage={perPageValue}
215-
count={count}
216209
leftContent={
217210
<Button
218211
id="pagination-button-prev"
@@ -234,7 +227,7 @@ describe('plasma-giga: Pagination Content', () => {
234227
</Button>
235228
}
236229
onChangePageValue={handleChangePage}
237-
onChangePerageValue={handleChangePerpage}
230+
onChangePerPageValue={handleChangePerPage}
238231
/>
239232
</>
240233
);
@@ -256,7 +249,7 @@ describe('plasma-giga: Pagination Content', () => {
256249
it('setInput', () => {
257250
mount(
258251
<CypressTestDecorator>
259-
<Pagination slots={slots[1]} value={values[0]} count={count} />
252+
<Pagination slots={slots[1]} count={count} />
260253
</CypressTestDecorator>,
261254
);
262255
cy.get('input:first').focus().type('10').type('{enter}');
@@ -268,7 +261,7 @@ describe('plasma-giga: Pagination Content', () => {
268261

269262
mount(
270263
<CypressTestDecorator>
271-
<Pagination slots={slots[2]} value={values[0]} count={count} listWidth="5rem" />
264+
<Pagination slots={slots[2]} count={count} listWidth="5rem" />
272265
</CypressTestDecorator>,
273266
);
274267
cy.get('button').last().click();

packages/plasma-web/src/components/Pagination/Pagination.component-test.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,27 +216,21 @@ describe('plasma-new-hope: Pagination Content', () => {
216216
const [pageValue, setPageValue] = useState(args.value);
217217
const [perPageValue, setPerPageValue] = useState(args.perPage);
218218

219-
const handleChangePerpage = useCallback(
220-
(perPage: number) => {
221-
setPerPageValue(perPage);
222-
},
223-
[perPageValue, setPerPageValue],
224-
);
219+
const handleChangePerPage = (perPage: number) => {
220+
setPerPageValue(perPage);
221+
};
225222

226-
const handleChangePage = useCallback(
227-
(page: number) => {
228-
setPageValue(page);
229-
},
230-
[pageValue, setPageValue],
231-
);
223+
const handleChangePage = (page: number) => {
224+
setPageValue(page);
225+
};
232226

233227
return (
234228
<>
235229
<Pagination
236230
{...args}
231+
count={count}
237232
value={pageValue}
238233
perPage={perPageValue}
239-
count={count}
240234
leftContent={
241235
<Button
242236
id="pagination-button-prev"
@@ -258,7 +252,7 @@ describe('plasma-new-hope: Pagination Content', () => {
258252
</Button>
259253
}
260254
onChangePageValue={handleChangePage}
261-
onChangePerageValue={handleChangePerpage}
255+
onChangePerPageValue={handleChangePerPage}
262256
/>
263257
</>
264258
);
@@ -280,7 +274,7 @@ describe('plasma-new-hope: Pagination Content', () => {
280274
it('setInput', () => {
281275
mount(
282276
<CypressTestDecoratorWithTypo>
283-
<Pagination slots={slots[1]} value={values[0]} count={count} />
277+
<Pagination slots={slots[1]} count={count} />
284278
</CypressTestDecoratorWithTypo>,
285279
);
286280
cy.get('input:first').focus().type('10').type('{enter}');
@@ -290,7 +284,7 @@ describe('plasma-new-hope: Pagination Content', () => {
290284
it('setSelect', () => {
291285
mount(
292286
<CypressTestDecoratorWithTypo>
293-
<Pagination slots={slots[2]} value={values[0]} count={count} listWidth="5rem" />
287+
<Pagination slots={slots[2]} count={count} listWidth="5rem" />
294288
</CypressTestDecoratorWithTypo>,
295289
);
296290
cy.get('button').last().click();

packages/sdds-cs/src/components/Pagination/Pagination.component-test.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,13 @@ describe('sdds-cs: Pagination Content', () => {
177177
const [pageValue, setPageValue] = useState(args.value);
178178
const [perPageValue, setPerPageValue] = useState(args.perPage);
179179

180-
const handleChangePerpage = useCallback(
181-
(perPage: number) => {
182-
setPerPageValue(perPage);
183-
},
184-
[perPageValue, setPerPageValue],
185-
);
180+
const handleChangePerPage = (perPage: number) => {
181+
setPerPageValue(perPage);
182+
};
186183

187-
const handleChangePage = useCallback(
188-
(page: number) => {
189-
setPageValue(page);
190-
},
191-
[pageValue, setPageValue],
192-
);
184+
const handleChangePage = (page: number) => {
185+
setPageValue(page);
186+
};
193187

194188
return (
195189
<>
@@ -198,7 +192,6 @@ describe('sdds-cs: Pagination Content', () => {
198192
count={count}
199193
value={pageValue}
200194
perPage={perPageValue}
201-
count={count}
202195
leftContent={
203196
<Button
204197
id="pagination-button-prev"
@@ -220,7 +213,7 @@ describe('sdds-cs: Pagination Content', () => {
220213
</Button>
221214
}
222215
onChangePageValue={handleChangePage}
223-
onChangePerageValue={handleChangePerpage}
216+
onChangePerPageValue={handleChangePerPage}
224217
/>
225218
</>
226219
);
@@ -242,7 +235,7 @@ describe('sdds-cs: Pagination Content', () => {
242235
it('setInput', () => {
243236
mount(
244237
<CypressTestDecorator>
245-
<Pagination slots={slots[1]} value={values[0]} count={count} />
238+
<Pagination slots={slots[1]} count={count} />
246239
</CypressTestDecorator>,
247240
);
248241
cy.get('input:first').focus().type('10').type('{enter}');
@@ -254,7 +247,7 @@ describe('sdds-cs: Pagination Content', () => {
254247

255248
mount(
256249
<CypressTestDecorator>
257-
<Pagination slots={slots[2]} value={values[0]} count={count} listWidth="5rem" />
250+
<Pagination slots={slots[2]} count={count} listWidth="5rem" />
258251
</CypressTestDecorator>,
259252
);
260253
cy.get('button').last().click();

packages/sdds-insol/src/components/Pagination/Pagination.component-test.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,13 @@ describe('sdds-insol: Pagination Content', () => {
191191
const [pageValue, setPageValue] = useState(args.value);
192192
const [perPageValue, setPerPageValue] = useState(args.perPage);
193193

194-
const handleChangePerpage = useCallback(
195-
(perPage: number) => {
196-
setPerPageValue(perPage);
197-
},
198-
[perPageValue, setPerPageValue],
199-
);
194+
const handleChangePerPage = (perPage: number) => {
195+
setPerPageValue(perPage);
196+
};
200197

201-
const handleChangePage = useCallback(
202-
(page: number) => {
203-
setPageValue(page);
204-
},
205-
[pageValue, setPageValue],
206-
);
198+
const handleChangePage = (page: number) => {
199+
setPageValue(page);
200+
};
207201

208202
return (
209203
<>
@@ -212,7 +206,6 @@ describe('sdds-insol: Pagination Content', () => {
212206
count={count}
213207
value={pageValue}
214208
perPage={perPageValue}
215-
count={count}
216209
leftContent={
217210
<Button
218211
id="pagination-button-prev"
@@ -234,7 +227,7 @@ describe('sdds-insol: Pagination Content', () => {
234227
</Button>
235228
}
236229
onChangePageValue={handleChangePage}
237-
onChangePerageValue={handleChangePerpage}
230+
onChangePerPageValue={handleChangePerPage}
238231
/>
239232
</>
240233
);
@@ -256,7 +249,7 @@ describe('sdds-insol: Pagination Content', () => {
256249
it('setInput', () => {
257250
mount(
258251
<CypressTestDecorator>
259-
<Pagination slots={slots[1]} value={values[0]} count={count} />
252+
<Pagination slots={slots[1]} count={count} />
260253
</CypressTestDecorator>,
261254
);
262255
cy.get('input:first').focus().type('10').type('{enter}');
@@ -268,7 +261,7 @@ describe('sdds-insol: Pagination Content', () => {
268261

269262
mount(
270263
<CypressTestDecorator>
271-
<Pagination slots={slots[2]} value={values[0]} count={count} listWidth="5rem" />
264+
<Pagination slots={slots[2]} count={count} listWidth="5rem" />
272265
</CypressTestDecorator>,
273266
);
274267
cy.get('button').last().click();

0 commit comments

Comments
 (0)