Skip to content

Commit b8185a0

Browse files
committed
Auto merge of #1883 - nkanderson:increase_results_per_page, r=carols10cents
Increase default results per page for crates page
2 parents 986d3bf + 595d040 commit b8185a0

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

app/controllers/crates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default Controller.extend(PaginationMixin, {
88
queryParams: ['letter', 'page', 'per_page', 'sort'],
99
letter: null,
1010
page: '1',
11-
per_page: 10,
11+
per_page: 50,
1212
sort: 'alpha',
1313
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''),
1414

tests/acceptance/crates-test.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module('Acceptance | crates page', function(hooks) {
1010
setupApplicationTest(hooks);
1111
setupMirage(hooks);
1212

13+
// should match the default set in the crates controller
14+
const per_page = 50;
15+
1316
test('is accessible', async function(assert) {
1417
assert.expect(0);
1518

@@ -53,23 +56,29 @@ module('Acceptance | crates page', function(hooks) {
5356
});
5457

5558
test('listing crates', async function(assert) {
56-
this.server.loadFixtures();
59+
for (let i = 1; i <= per_page; i++) {
60+
this.server.create('crate');
61+
}
5762

5863
await visit('/crates');
5964

60-
assert.dom('[data-test-crates-nav] [data-test-current-rows]').hasText('1-10');
61-
assert.dom('[data-test-crates-nav] [data-test-total-rows]').hasText('19');
65+
assert.dom('[data-test-crates-nav] [data-test-current-rows]').hasText(`1-${per_page}`);
66+
assert.dom('[data-test-crates-nav] [data-test-total-rows]').hasText(`${per_page}`);
6267
});
6368

6469
test('navigating to next page of crates', async function(assert) {
65-
this.server.loadFixtures();
70+
for (let i = 1; i <= per_page + 2; i++) {
71+
this.server.create('crate');
72+
}
73+
const page_start = per_page + 1;
74+
const total = per_page + 2;
6675

6776
await visit('/crates');
6877
await click('[data-test-pagination-next]');
6978

7079
assert.equal(currentURL(), '/crates?page=2');
71-
assert.dom('[data-test-crates-nav] [data-test-current-rows]').hasText('11-19');
72-
assert.dom('[data-test-crates-nav] [data-test-total-rows]').hasText('19');
80+
assert.dom('[data-test-crates-nav] [data-test-current-rows]').hasText(`${page_start}-${total}`);
81+
assert.dom('[data-test-crates-nav] [data-test-total-rows]').hasText(`${total}`);
7382
});
7483

7584
test('crates default sort is alphabetical', async function(assert) {

0 commit comments

Comments
 (0)