From 8bece2f89a1b1839333ee511dbfe3b9a608f156f Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Mon, 23 Oct 2017 10:21:44 -0700 Subject: [PATCH] Don't scroll to top on transition in tests It's mega annoying --- ui/app/routes/application.js | 8 ++++++-- ui/app/services/config.js | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/app/routes/application.js b/ui/app/routes/application.js index 7728d25f2..0a2e57c39 100644 --- a/ui/app/routes/application.js +++ b/ui/app/routes/application.js @@ -1,8 +1,10 @@ import Ember from 'ember'; -const { Route } = Ember; +const { Route, inject } = Ember; export default Route.extend({ + config: inject.service(), + resetController(controller, isExiting) { if (isExiting) { controller.set('error', null); @@ -11,7 +13,9 @@ export default Route.extend({ actions: { didTransition() { - window.scrollTo(0, 0); + if (!this.get('config.isTest')) { + window.scrollTo(0, 0); + } }, willTransition() { diff --git a/ui/app/services/config.js b/ui/app/services/config.js index a6f392a17..2c586d97c 100644 --- a/ui/app/services/config.js +++ b/ui/app/services/config.js @@ -10,4 +10,5 @@ export default Service.extend({ isDev: computed.equal('environment', 'development'), isProd: computed.equal('environment', 'production'), + isTest: computed.equal('environment', 'test'), });