Skip to content

Commit a70b2bd

Browse files
Merge branch 'main' into mboulais/O2B-1403/use-coalesced-run-timestamps
2 parents 326d562 + b493147 commit a70b2bd

File tree

3 files changed

+15
-33
lines changed

3 files changed

+15
-33
lines changed

lib/public/components/Pagination/amountSelector.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ const perPageAmountInputComponent = (onCustomChoiceConfirm, paginationModel) =>
5050
oninput: ({ target }) => {
5151
paginationModel.customItemsPerPage = target.value;
5252
},
53-
onkeyup: ({ key }) => {
54-
if (key === 'Enter') {
55-
onCustomChoiceConfirm();
56-
}
57-
},
58-
onblur: onCustomChoiceConfirm,
53+
onchange: onCustomChoiceConfirm,
5954
});
6055

6156
/**

test/public/flps/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
*/
1313

1414
const OverviewSuite = require('./overview.test');
15-
// eslint-disable-next-line capitalized-comments
1615
const DetailSuite = require('./detail.test');
1716

1817
module.exports = () => {
1918
describe('Overview Page', OverviewSuite);
20-
// eslint-disable-next-line capitalized-comments
2119
describe('Detail Page', DetailSuite);
2220
};

test/public/flps/overview.test.js

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const {
2121
waitForTableLength,
2222
goToPage,
2323
getInnerText,
24+
fillInput,
2425
} = require('../defaults.js');
2526
const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js');
2627

@@ -33,6 +34,9 @@ module.exports = () => {
3334
let table;
3435
let firstRowId;
3536

37+
const amountSelectorSelector = '#amountSelector';
38+
const amountSelectorButtonSelector = `${amountSelectorSelector} button`;
39+
3640
before(async () => {
3741
[page, browser] = await defaultBefore(page, browser);
3842
await page.setViewport({
@@ -108,8 +112,6 @@ module.exports = () => {
108112
await page.waitForSelector('table tbody tr:nth-child(2)');
109113
expect(await page.$(`table tbody tr:nth-child(${INFINITE_SCROLL_CHUNK})`)).to.be.null;
110114

111-
const amountSelectorButtonSelector = '#amountSelector button';
112-
113115
// Expect the dropdown options to be visible when it is selected
114116
await pressElement(page, amountSelectorButtonSelector);
115117

@@ -133,23 +135,19 @@ module.exports = () => {
133135

134136
it('can set how many flps are available per page', async () => {
135137
// Expect the amount selector to currently be set to Infinite (after the previous test)
136-
const amountSelectorId = '#amountSelector';
137-
await expectInnerText(page, `${amountSelectorId} button`, 'Rows per page: Infinite ');
138+
await expectInnerText(page, `${amountSelectorSelector} button`, 'Rows per page: Infinite ');
138139

139-
await pressElement(page, `${amountSelectorId} button`);
140-
await page.waitForSelector(`${amountSelectorId} .dropup-menu`);
140+
await pressElement(page, `${amountSelectorSelector} button`);
141+
await page.waitForSelector(`${amountSelectorSelector} .dropup-menu`);
141142

142143
// Expect the amount of visible flps to reduce when the first option (5) is selected
143-
await pressElement(page, `${amountSelectorId} .dropup-menu .menu-item`);
144+
await pressElement(page, `${amountSelectorSelector} .dropup-menu .menu-item`);
144145
await waitForTableLength(page, 5);
145146
});
146147

147148
it('dynamically switches between visible pages in the page selector', async () => {
148-
// Override the amount of flps visible per page manually
149-
await page.evaluate(() => {
150-
// eslint-disable-next-line no-undef
151-
model.flps.pagination.itemsPerPage = 1;
152-
});
149+
await pressElement(page, amountSelectorButtonSelector);
150+
await fillInput(page, `${amountSelectorSelector} input`, '1', ['input', 'change']);
153151
await waitForTableLength(page, 1);
154152

155153
// Expect the page five button to now be visible, but no more than that
@@ -164,22 +162,13 @@ module.exports = () => {
164162
});
165163

166164
it('notifies if table loading returned an error', async () => {
167-
/*
168-
* As an example, override the amount of flps visible per page manually
169-
* We know the limit is 100 as specified by the Dto
170-
*/
171-
await page.evaluate(() => {
172-
// eslint-disable-next-line no-undef
173-
model.flps.pagination.itemsPerPage = 200;
174-
});
165+
await pressElement(page, amountSelectorButtonSelector);
166+
await fillInput(page, `${amountSelectorSelector} input`, '200', ['input', 'change']);
175167

176168
// We expect there to be a fitting error message
177169
await expectInnerText(page, '.alert-danger', 'Invalid Attribute: "query.page.limit" must be less than or equal to 100');
178170

179-
// Revert changes for next test
180-
await page.evaluate(() => {
181-
// eslint-disable-next-line no-undef
182-
model.flps.pagination.itemsPerPage = 10;
183-
});
171+
await pressElement(page, amountSelectorButtonSelector);
172+
await fillInput(page, `${amountSelectorSelector} input`, '10', ['input', 'change']);
184173
});
185174
};

0 commit comments

Comments
 (0)