-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/Add pagination #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { module, test } from 'qunit'; | ||
| import { visit, currentURL } from '@ember/test-helpers'; | ||
| import { visit, currentURL, waitUntil } from '@ember/test-helpers'; | ||
| import { setupApplicationTest } from 'ember-qunit'; | ||
| import page from 'bigriver-bookstore/tests/pages/books'; | ||
|
|
||
|
|
@@ -25,4 +25,18 @@ module('Acceptance | books', function(hooks) { | |
| assert.ok(page.books(0).hasAuthor); | ||
| assert.ok(page.books(0).hasImage); | ||
| }); | ||
|
|
||
| test('fetch more data when scrolled down', async function(assert) { | ||
| await page.visit(); | ||
|
|
||
| assert.equal(page.books().count, 9); | ||
|
|
||
| document.querySelector(page.loaderClass).scrollIntoView(); | ||
|
|
||
| await waitUntil(() => { | ||
| return page.books().count === 18; | ||
| }); | ||
|
|
||
| assert.equal(page.books().count, 18); | ||
| }); | ||
|
Comment on lines
+28
to
+41
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests seem to use the actual api, meaning that they will hit the api every time the test runs. Can you think of why this might not be a good idea in real live app and what are some alternatives? |
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very similar with a query made in the books, maybe we can find a way to remove duplication.