-
Notifications
You must be signed in to change notification settings - Fork 56
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
[DRAFT] Additional Tests for the Preprints index page #1931
Open
bp-cos
wants to merge
3
commits into
CenterForOpenScience:feature/search-improvements
Choose a base branch
from
bp-cos:bp/feature/preprint-tests
base: feature/search-improvements
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{{#if this.hasFooters}} | ||
<div local-class='branded-footer-links'> | ||
<div local-class='branded-footer-links' data-test-footer-links> | ||
{{html-safe this.footerLinks}} | ||
</div> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Acceptance | preprints | branded-footer', hooks => { | ||
setupRenderingTest(hooks); | ||
|
||
test('it inserts the footerLink when present', async function(assert) { | ||
// Given no list is provided | ||
// When the component is rendered | ||
await render(hbs` | ||
<Preprints::-components::BrandedFooter | ||
@footerLinks='these are the footer links' | ||
> | ||
</Preprints::-components::BrandedFooter> | ||
`); | ||
|
||
// Then the footer links are verified | ||
assert.dom('[data-test-footer-links]').hasText('these are the footer links', 'The footer links are present'); | ||
}); | ||
|
||
test('it does not insert the footerLink when undefined', async function(assert) { | ||
// Given no list is provided | ||
// When the component is rendered | ||
await render(hbs`<Preprints::-components::BrandedFooter/>`); | ||
|
||
// Then the footer links are verified | ||
assert.dom('[data-test-footer-links]').doesNotExist('The footer links are not present'); | ||
}); | ||
|
||
test('it does no insert the footerLink when it an empty string', async function(assert) { | ||
// Given no list is provided | ||
// When the component is rendered | ||
await render(hbs` | ||
<Preprints::-components::BrandedFooter | ||
@footerLinks='' | ||
> | ||
</Preprints::-components::BrandedFooter> | ||
`); | ||
|
||
// Then the footer links are verified | ||
assert.dom('[data-test-footer-links]').doesNotExist('The footer links are not present'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -26,28 +26,51 @@ module('Integration | Component | branded-header', hooks => { | |||||
@showHelp=true | ||||||
@searchPlaceholder={{this.searchPlaceholder}} | ||||||
as |branded-header| | ||||||
></BrandedHeader> | ||||||
> | ||||||
{{#branded-header.lead}} | ||||||
<div data-test-lead-yield> | ||||||
This is the lead | ||||||
</div> | ||||||
{{/branded-header.lead}} | ||||||
{{#branded-header.row}} | ||||||
<div data-test-row-yield> | ||||||
This is the row | ||||||
</div> | ||||||
{{/branded-header.row}} | ||||||
</BrandedHeader> | ||||||
`); | ||||||
|
||||||
// Then the header container is verified | ||||||
const headerContainer = this.element.querySelector('[data-test-header-container]'); | ||||||
assert.dom(headerContainer).exists(); | ||||||
|
||||||
// Then the header container is verified | ||||||
// And the brand logo container is verified | ||||||
assert.dom(this.element.querySelector('[data-test-brand-logo]')).hasAttribute('aria-label', 'OSF Preprints'); | ||||||
|
||||||
// And the perform search button is verified | ||||||
// eslint-disable-next-line max-len | ||||||
assert.dom(this.element.querySelector('[data-test-perform-search-button]')).hasAttribute('aria-label', 'Perform search'); | ||||||
assert.dom(this.element.querySelector('[data-test-perform-search-button]')).hasAttribute('type', 'button'); | ||||||
|
||||||
// And the search icon is verified | ||||||
// eslint-disable-next-line max-len | ||||||
assert.dom(this.element.querySelector('[data-test-search-icon]')).hasAttribute('data-icon', 'search'); | ||||||
|
||||||
// And the search box is verified | ||||||
// eslint-disable-next-line max-len | ||||||
assert.dom(this.element.querySelector('[data-test-search-box]')).hasAttribute('placeholder', 'preprints.header.search_placeholder'); | ||||||
|
||||||
// And the search help button is verified | ||||||
// eslint-disable-next-line max-len | ||||||
assert.dom(this.element.querySelector('[data-test-search-help-button]')).hasAttribute('aria-label', 'Search help'); | ||||||
assert.dom(this.element.querySelector('[data-test-search-help-button]')).hasAttribute('type', 'button'); | ||||||
|
||||||
// And the lead yield is verified | ||||||
// eslint-disable-next-line max-len | ||||||
assert.dom(this.element.querySelector('[data-test-lead-yield]')).hasText('This is the lead', 'The lead in yielded correctly'); | ||||||
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.
Suggested change
|
||||||
|
||||||
// And the row yield is verified | ||||||
// eslint-disable-next-line max-len | ||||||
assert.dom(this.element.querySelector('[data-test-row-yield]')).hasText('This is the row', 'The lead in yielded correctly'); | ||||||
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.
Suggested change
|
||||||
}); | ||||||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 doesn't seem related to adding new tests. This would have been a good addition to the "Changes" section of the PR, to let reviewers know that this is expected and what's going on here. Do you not have a providerModel any more?