Skip to content

Commit

Permalink
[BREAKING] update ember-in-viewport - changes event action name
Browse files Browse the repository at this point in the history
because we have an action named inViewport this now seems to be conflicting with the service imported in the inViewport mixin. Here I’m suggesting that we rename our action to ‘enterViewport’ as it is the opposite of the other action ‘exitViewport’. Obviously this is a breaking change as anyone using the existing action will need to rename it.
Note: Currently we have a test failure yet to resolve from onScrolledToBottom
  • Loading branch information
fran-worley committed May 22, 2019
1 parent a6d7306 commit 35a3f7c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions addon/components/lt-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ export default Component.extend({

/**
* lt-infinity action to determine if component is still in viewport
* @event inViewport
* @event enterViewport
*/
inViewport() {
enterViewport() {
this.set('isInViewport', true);
},
/**
Expand Down
2 changes: 1 addition & 1 deletion addon/components/lt-infinity.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default Component.extend(InViewportMixin, {
},

didEnterViewport() {
get(this, 'inViewport')();
get(this, 'enterViewport')();
},

didExitViewport() {
Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/lt-body.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{{#if onScrolledToBottom}}
{{lt.infinity
rows=rows
inViewport=(action "inViewport")
enterViewport=(action "enterViewport")
exitViewport=(action "exitViewport")
scrollableContent=".lt-scrollable"}}
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"ember-cli-htmlbars": "^2.0.3",
"ember-cli-string-helpers": "^1.8.1",
"ember-get-config": "^0.2.4",
"ember-in-viewport": "~3.0.3",
"ember-in-viewport": "^3.5.5",
"ember-scrollable": "^0.5.2",
"ember-truth-helpers": "^2.0.0",
"ember-wormhole": "^0.5.5"
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/components/lt-infinity-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module('Integration | Component | lt infinity', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
this.inViewport = () => {};
this.enterViewport = () => {};
this.exitViewport = () => {};
await render(hbs`{{lt-infinity inViewport=inViewport exitViewport=exitViewport}}`);
await render(hbs`{{lt-infinity enterViewport=enterViewport exitViewport=exitViewport}}`);
assert.equal(find('*').textContent.trim(), '');
});
});

0 comments on commit 35a3f7c

Please sign in to comment.