From dafd709ee43f13f97aab62b655bd98953a9ea480 Mon Sep 17 00:00:00 2001 From: snewcomer Date: Sun, 13 Oct 2019 08:45:36 -0700 Subject: [PATCH] Allow recording position with users first page visit --- addon/index.js | 1 - tests/unit/services/router-scroll-test.js | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addon/index.js b/addon/index.js index e8fd84df..b170172e 100644 --- a/addon/index.js +++ b/addon/index.js @@ -96,7 +96,6 @@ let RouterScrollMixin = Mixin.create({ if (get(this, 'service.isFirstLoad')) { get(this, 'service').unsetFirstLoad(); - return; } let scrollPosition; diff --git a/tests/unit/services/router-scroll-test.js b/tests/unit/services/router-scroll-test.js index 77d130c3..71530fa4 100644 --- a/tests/unit/services/router-scroll-test.js +++ b/tests/unit/services/router-scroll-test.js @@ -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'); @@ -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 }; @@ -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 };