From c1467d0ecd32d97ab6e7328c248c3039fe8c457d Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Wed, 4 Feb 2015 11:09:34 -0800 Subject: [PATCH] enable named views for smoke tests --- src/NzbDrone.Automation.Test/AutomationTest.cs | 2 ++ src/UI/Mixins/AsNamedView.js | 7 ++++++- src/UI/Shims/backbone.marionette.js | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index 3aa3a49d8..dae31743e 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -45,6 +45,8 @@ namespace NzbDrone.Automation.Test var page = new PageBase(driver); page.WaitForNoSpinner(); + driver.ExecuteScript("window.NzbDrone.NameViews = true;"); + GetPageErrors().Should().BeEmpty(); } diff --git a/src/UI/Mixins/AsNamedView.js b/src/UI/Mixins/AsNamedView.js index 90c5ea0b4..43b801529 100644 --- a/src/UI/Mixins/AsNamedView.js +++ b/src/UI/Mixins/AsNamedView.js @@ -1,5 +1,7 @@ module.exports = function(){ + window.NzbDrone.NameViews = window.NzbDrone.NameViews || !window.NzbDrone.Production; + var regex = new RegExp('/', 'g'); var _getViewName = function(template){ @@ -11,7 +13,10 @@ module.exports = function(){ var originalOnRender = this.onRender; this.onRender = function(){ - this.$el.addClass('iv-' + _getViewName(this.template)); + + if(window.NzbDrone.NameViews) { + this.$el.addClass('iv-' + _getViewName(this.template)); + } if(originalOnRender) { return originalOnRender.call(this); diff --git a/src/UI/Shims/backbone.marionette.js b/src/UI/Shims/backbone.marionette.js index 56eff9681..51b86636a 100644 --- a/src/UI/Shims/backbone.marionette.js +++ b/src/UI/Shims/backbone.marionette.js @@ -8,8 +8,8 @@ var asNamedView = require('../Mixins/AsNamedView'); templateMixin.call(window.Marionette.TemplateCache); -if(!window.NzbDrone.Production) { - asNamedView.call(window.Marionette.ItemView.prototype); -} + +asNamedView.call(window.Marionette.ItemView.prototype); + module.exports = window.Marionette; \ No newline at end of file