Skip to content

Commit

Permalink
Allow recording position with users first page visit
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Oct 13, 2019
1 parent 0546162 commit dafd709
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ let RouterScrollMixin = Mixin.create({

if (get(this, 'service.isFirstLoad')) {
get(this, 'service').unsetFirstLoad();
return;
}

let scrollPosition;
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/services/router-scroll-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module('service:router-scroll', function(hooks) {
});

test('updating will set `scrollMap` to the current scroll position', function(assert) {
const service = this.owner.factoryFor('service:router-scroll').create({ isFirstLoad: false });
const service = this.owner.factoryFor('service:router-scroll').create();

const expected = { x: window.scrollX, y: window.scrollY };
set(service, 'key', '123');
Expand Down Expand Up @@ -93,7 +93,7 @@ module('service:router-scroll', function(hooks) {
otherElem.setAttribute('id', 'other-elem');
const testing = document.querySelector('#ember-testing');
testing.appendChild(otherElem);
const service = this.owner.factoryFor('service:router-scroll').create({ isFirstLoad: false, scrollElement: '#other-elem' });
const service = this.owner.factoryFor('service:router-scroll').create({ scrollElement: '#other-elem' });
window.history.replaceState({ uuid: '123' }, null);

let expected = { x: 0, y: 0 };
Expand All @@ -111,7 +111,7 @@ module('service:router-scroll', function(hooks) {
otherElem.style.top = '100px';
const testing = document.querySelector('#ember-testing');
testing.appendChild(otherElem);
const service = this.owner.factoryFor('service:router-scroll').create({ isFirstLoad: false, targetElement: '#other-elem' });
const service = this.owner.factoryFor('service:router-scroll').create({ targetElement: '#other-elem' });
window.history.replaceState({ uuid: '123' }, null);

let expected = { x: 0, y: 0 };
Expand Down

0 comments on commit dafd709

Please sign in to comment.