Orders table with page size select and previous/next controls
An online store’s admin dashboard needs a table of recent orders. There are too many orders to show at once, so build a paginated table with page controls and a selectable page size.
The starter code includes an ORDERS array of 23 orders, already in display order:
const ORDERS = [
{ id: 'ORD-1001', customer: 'Priya Nair', status: 'Paid', total: 84.2 },
{ id: 'ORD-1002', customer: 'Mateo Alvarez', status: 'Shipped', total: 129.99 },
// ... 21 more, up to ORD-1023
];
84.2 → $84.20).ORDERS.<select>) labelled Rows per page with the options 5, 10 and 20. The default is 5.Page X of Y, for example Page 1 of 5.Showing A–B of N, for example Showing 1–5 of 23. A hyphen works instead of the en dash.Default (5 rows per page):
Rows ORD-1001 to ORD-1005 Page 1 of 5 Showing 1–5 of 23 Previous disabled
Click Next twice:
Rows ORD-1011 to ORD-1015 Page 3 of 5 Showing 11–15 of 23
Click Next twice more (last page):
Rows ORD-1021 to ORD-1023 Page 5 of 5 Showing 21–23 of 23 Next disabled
On page 3, change Rows per page to 20:
Rows ORD-1001 to ORD-1020 Page 1 of 2 Showing 1–20 of 23
Math.ceil(23 / 10) = 3.The tests click your buttons, change the dropdown, and read the screen like a user would. You don’t need test ids, specific class names, or an exact HTML structure. They check that:
ORD-1006) of the current page only, in order, and their customer and total.disabled attribute (or don’t render it).<select> whose label (a <label>, aria-label, or name) is Rows per page. Its options’ visible text is 5, 10 and 20.Page X of Y and Showing A–B of N is correct after every action.Capitalization and extra spacing don’t matter.