-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from DockYard/fix-viewport-tolerance
Fix viewportTolerance with defaults
- Loading branch information
Showing
5 changed files
with
48 additions
and
1 deletion.
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
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,37 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
moduleForComponent('my-component', 'Integration | Component | my component', { | ||
integration: true | ||
}); | ||
|
||
test('it renders with viewportTolerance partially set', function(assert) { | ||
// viewportTolerance && viewportEnabled is usually setup in the initializer. Needs defaults | ||
this.viewportToleranceOverride = { | ||
top: 1 | ||
}; | ||
this.render(hbs` | ||
{{#my-component viewportEnabled=true viewportToleranceOverride=viewportToleranceOverride}} | ||
template block text | ||
{{/my-component}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text'); | ||
}); | ||
|
||
test('it renders with intersectionThreshold set', function(assert) { | ||
this.viewportTolerance = { | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
}; | ||
this.intersectionThreshold = 1.0; | ||
this.render(hbs` | ||
{{#my-component viewportEnabled=true viewportTolerance=viewportTolerance intersectionThreshold=intersectionThreshold}} | ||
template block text | ||
{{/my-component}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text'); | ||
}); |