Skip to content
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

Fix broken onScroll handler after v1.8.6 #397

Merged
merged 2 commits into from
Apr 28, 2017
Merged

Fix broken onScroll handler after v1.8.6 #397

merged 2 commits into from
Apr 28, 2017

Conversation

eruizdechavez
Copy link

After fixing deprecation message for onScroll, a typo was introduced by using onScrollToY instead of onScrollY. This PR resolves this problem by using the correct event handler and adds a basic test to ensure the event gets fired properly.

After fixing deprecation message for onScroll, a typo was
introduced by using `onScrollToY` instead of `onScrollY`. This
PR resolves this problem by using the correct event handler and
adds a basic test to ensure the event gets fired properly.
table,
currentScrollY: 0,
onScroll() {
assert.ok(true, 'onScroll worked');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-picky, but do we want to check for e.target.scrollTop = 300?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual value was slightly different, probably because of row heights, table size, etc. Just wanted to check the event handler was properly called on scroll.

Should I improve the test to also check for position or is this test good enough?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's probably because 300 > than the total row heights combined, did you try with a smaller value (in my experience it matches).
that being said even something as assert.ok(e.target.scrollTop > 0) proves your point that it did scroll.
assert.equal(e.target.scrollTop, scrollTopAmount) verifies that it scrolled the requested amount as well as it scrolled.

if it's not too hard I would try to add it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 😃 .

300 was indeed too much scrolling for this test, 50 does the trick.

@alexander-alvarez
Copy link
Collaborator

thanks for this @eruizdechavez
For posterity this was introduced in #385

Instead of just testing event handler being called, also test
the value of the actual scrolling.
@alexander-alvarez alexander-alvarez merged commit fdcd31e into adopted-ember-addons:master Apr 28, 2017
@alexander-alvarez
Copy link
Collaborator

Thanks. Will update when released

@eruizdechavez eruizdechavez deleted the fix-onscroll branch April 28, 2017 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants