diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-06-22 13:44:12 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-06-22 16:33:24 +0200 |
commit | fb018fbc9a053e60f00e3c1d006e94f1c2e81a99 (patch) | |
tree | c498ee9aa462d766ae40461588e0c91ba65c2fab /server/sonar-web | |
parent | 1eb94e56649b47cfd4e14d7448fbdd380b0bf1f4 (diff) | |
download | sonarqube-fb018fbc9a053e60f00e3c1d006e94f1c2e81a99.tar.gz sonarqube-fb018fbc9a053e60f00e3c1d006e94f1c2e81a99.zip |
improve start of js apps
Diffstat (limited to 'server/sonar-web')
56 files changed, 937 insertions, 876 deletions
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/app.js b/server/sonar-web/src/main/js/apps/api-documentation/app.js index 3e706bcc05f..bc38d046613 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/app.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/app.js @@ -29,7 +29,6 @@ define([ var $ = jQuery, App = new Marionette.Application(), init = function (options) { - // State this.state = new Backbone.Model({ internal: false }); @@ -65,7 +64,7 @@ define([ this.router = new Router({ app: this }); Backbone.history.start({ pushState: true, - root: getRoot() + root: options.urlRoot }); }; @@ -75,13 +74,6 @@ define([ }); }); - function getRoot () { - var API_DOCUMENTATION = '/api_documentation', - path = window.location.pathname, - pos = path.indexOf(API_DOCUMENTATION); - return path.substr(0, pos + API_DOCUMENTATION.length); - } - return App; }); diff --git a/server/sonar-web/src/main/js/apps/api-documentation/layout.js b/server/sonar-web/src/main/js/apps/api-documentation/layout.js index ae4ce851798..773463f8728 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/layout.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/layout.js @@ -34,7 +34,7 @@ define([ }, onRender: function () { - var navigator = $('.search-navigator'); + var navigator = this.$('.search-navigator'); navigator.addClass('sticky search-navigator-extended-view'); var top = navigator.offset().top; this.$('.search-navigator-workspace-header').css({ top: top }); diff --git a/server/sonar-web/src/main/js/apps/api-documentation/templates/api-documentation-layout.hbs b/server/sonar-web/src/main/js/apps/api-documentation/templates/api-documentation-layout.hbs index 4ef38c51b11..18019c34a4c 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/templates/api-documentation-layout.hbs +++ b/server/sonar-web/src/main/js/apps/api-documentation/templates/api-documentation-layout.hbs @@ -1,9 +1,11 @@ -<div class="search-navigator-side search-navigator-side-light"> - <div class="search-navigator-filters"></div> - <div class="api-documentation-results panel"></div> -</div> +<div class="search-navigator sticky"> + <div class="search-navigator-side search-navigator-side-light"> + <div class="search-navigator-filters"></div> + <div class="api-documentation-results panel"></div> + </div> -<div class="search-navigator-workspace"> - <div class="search-navigator-workspace-header"></div> - <div class="search-navigator-workspace-details"></div> + <div class="search-navigator-workspace"> + <div class="search-navigator-workspace-header"></div> + <div class="search-navigator-workspace-details"></div> + </div> </div> diff --git a/server/sonar-web/src/main/js/apps/coding-rules/app.js b/server/sonar-web/src/main/js/apps/coding-rules/app.js index c07d7513591..61f5e97ddd2 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/app.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/app.js @@ -1,37 +1,18 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ - './models/state', - './layout', - './models/rules', - 'components/navigator/models/facets', + './models/state', + './layout', + './models/rules', + 'components/navigator/models/facets', - './controller', - 'components/navigator/router', + './controller', + 'components/navigator/router', - './workspace-list-view', - './workspace-header-view', + './workspace-list-view', + './workspace-header-view', - './facets-view', - './filters-view' -], + './facets-view', + './filters-view' + ], function (State, Layout, Rules, @@ -44,59 +25,48 @@ define([ FiltersView) { var $ = jQuery, - App = new Marionette.Application(); - - App.addInitializer(function () { - this.layout = new Layout(); - $('.coding-rules').empty().append(this.layout.render().el); - $('#footer').addClass('search-navigator-footer'); - }); - - App.addInitializer(function () { - this.state = new State(); - this.list = new Rules(); - this.facets = new Facets(); - }); - - App.addInitializer(function () { - this.controller = new Controller({ - app: this - }); - }); - - App.addInitializer(function () { - this.workspaceListView = new WorkspaceListView({ - app: this, - collection: this.list - }); - this.layout.workspaceListRegion.show(this.workspaceListView); - this.workspaceListView.bindScrollEvents(); - - this.workspaceHeaderView = new WorkspaceHeaderView({ - app: this, - collection: this.list - }); - this.layout.workspaceHeaderRegion.show(this.workspaceHeaderView); - - this.facetsView = new FacetsView({ - app: this, - collection: this.facets - }); - this.layout.facetsRegion.show(this.facetsView); - - this.filtersView = new FiltersView({ - app: this - }); - this.layout.filtersRegion.show(this.filtersView); - }); - - App.addInitializer(function () { - key.setScope('list'); - this.router = new Router({ - app: this - }); - Backbone.history.start(); - }); + App = new Marionette.Application(), + init = function (options) { + this.layout = new Layout({ el: options.el }); + this.layout.render(); + $('#footer').addClass('search-navigator-footer'); + + this.state = new State(); + this.list = new Rules(); + this.facets = new Facets(); + + this.controller = new Controller({ app: this }); + + this.workspaceListView = new WorkspaceListView({ + app: this, + collection: this.list + }); + this.layout.workspaceListRegion.show(this.workspaceListView); + this.workspaceListView.bindScrollEvents(); + + this.workspaceHeaderView = new WorkspaceHeaderView({ + app: this, + collection: this.list + }); + this.layout.workspaceHeaderRegion.show(this.workspaceHeaderView); + + this.facetsView = new FacetsView({ + app: this, + collection: this.facets + }); + this.layout.facetsRegion.show(this.facetsView); + + this.filtersView = new FiltersView({ + app: this + }); + this.layout.filtersRegion.show(this.filtersView); + + key.setScope('list'); + this.router = new Router({ + app: this + }); + Backbone.history.start(); + }; App.manualRepository = function () { return { @@ -116,13 +86,13 @@ define([ } }; - var appXHR = $.get(baseUrl + '/api/rules/app').done(function(r) { + var appXHR = $.get(baseUrl + '/api/rules/app').done(function (r) { App.canWrite = r.canWrite; App.qualityProfiles = _.sortBy(r.qualityprofiles, ['name', 'lang']); App.languages = _.extend(r.languages, { none: 'None' }); - _.map(App.qualityProfiles, function(profile) { + _.map(App.qualityProfiles, function (profile) { profile.language = App.languages[profile.lang]; }); App.repositories = r.repositories; @@ -133,8 +103,12 @@ define([ }); }); - $.when(window.requestMessages(), appXHR).done(function () { - App.start(); + App.on('start', function (options) { + $.when(window.requestMessages(), appXHR).done(function () { + init.call(App, options); + }); }); + return App; + }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/layout.js b/server/sonar-web/src/main/js/apps/coding-rules/layout.js index 238db774707..34f66a61a2e 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/layout.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/layout.js @@ -35,8 +35,7 @@ define([ }, onRender: function () { - var navigator = $('.search-navigator'); - navigator.addClass('sticky'); + var navigator = this.$('.search-navigator'); var top = navigator.offset().top; this.$('.search-navigator-workspace-header').css({ top: top }); this.$('.search-navigator-side').css({ top: top }).isolatedScroll(); @@ -44,12 +43,12 @@ define([ showDetails: function () { this.scroll = $(window).scrollTop(); - $('.search-navigator').addClass('search-navigator-extended-view'); + this.$('.search-navigator').addClass('search-navigator-extended-view'); }, hideDetails: function () { - $('.search-navigator').removeClass('search-navigator-extended-view'); + this.$('.search-navigator').removeClass('search-navigator-extended-view'); if (this.scroll != null) { $(window).scrollTop(this.scroll); } diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-layout.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-layout.hbs index 8f46e4f8fb1..3290b738558 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-layout.hbs +++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-layout.hbs @@ -1,10 +1,12 @@ -<div class="search-navigator-side"> - <div class="search-navigator-filters"></div> - <div class="search-navigator-facets"></div> -</div> +<div class="coding-rules search-navigator sticky"> + <div class="search-navigator-side"> + <div class="search-navigator-filters"></div> + <div class="search-navigator-facets"></div> + </div> -<div class="search-navigator-workspace"> - <div class="search-navigator-workspace-header"></div> - <div class="search-navigator-workspace-list"></div> - <div class="search-navigator-workspace-details"></div> + <div class="search-navigator-workspace"> + <div class="search-navigator-workspace-header"></div> + <div class="search-navigator-workspace-list"></div> + <div class="search-navigator-workspace-details"></div> + </div> </div> diff --git a/server/sonar-web/src/main/js/apps/issues/app-context.js b/server/sonar-web/src/main/js/apps/issues/app-context.js index bcef0841779..ba15e720664 100644 --- a/server/sonar-web/src/main/js/apps/issues/app-context.js +++ b/server/sonar-web/src/main/js/apps/issues/app-context.js @@ -13,10 +13,55 @@ define([ FacetsView) { var $ = jQuery, - App = new Marionette.Application(); + App = new Marionette.Application(), + init = function (options) { + this.config = options.config; + this.state = new State({ + isContext: true, + contextQuery: { componentUuids: options.config.resource }, + contextComponentUuid: options.config.resource, + contextComponentName: options.config.resourceName, + contextComponentQualifier: options.config.resourceQualifier + }); + this.updateContextFacets(); + this.list = new Issues(); + this.facets = new Facets(); + this.filters = new Filters(); + + this.layout = new Layout({ app: this, el: options.el }); + this.layout.render(); + $('#footer').addClass('search-navigator-footer'); + + this.controller = new Controller({ app: this }); + + this.issuesView = new WorkspaceListView({ + app: this, + collection: this.list + }); + this.layout.workspaceListRegion.show(this.issuesView); + this.issuesView.bindScrollEvents(); + + this.workspaceHeaderView = new WorkspaceHeaderView({ + app: this, + collection: this.list + }); + this.layout.workspaceHeaderRegion.show(this.workspaceHeaderView); + + this.facetsView = new FacetsView({ + app: this, + collection: this.facets + }); + this.layout.facetsRegion.show(this.facetsView); + + this.controller.fetchFilters().done(function () { + key.setScope('list'); + App.router = new Router({ app: App }); + Backbone.history.start(); + }); + }; App.getContextQuery = function () { - return { componentUuids: window.config.resource }; + return { componentUuids: this.config.resource }; }; App.getRestrictedFacets = function () { @@ -35,71 +80,17 @@ define([ facetsFromServer = this.state.get('facetsFromServer'); return this.state.set({ facets: facets, - allFacets: _.difference(allFacets, this.getRestrictedFacets()[window.config.resourceQualifier]), - facetsFromServer: _.difference(facetsFromServer, this.getRestrictedFacets()[window.config.resourceQualifier]) + allFacets: _.difference(allFacets, this.getRestrictedFacets()[this.config.resourceQualifier]), + facetsFromServer: _.difference(facetsFromServer, this.getRestrictedFacets()[this.config.resourceQualifier]) }); }; - App.addInitializer(function () { - this.state = new State({ - isContext: true, - contextQuery: this.getContextQuery(), - contextComponentUuid: window.config.resource, - contextComponentName: window.config.resourceName, - contextComponentQualifier: window.config.resourceQualifier + App.on('start', function (options) { + $.when(window.requestMessages()).done(function () { + init.call(App, options); }); - this.updateContextFacets(); - this.list = new Issues(); - this.facets = new Facets(); - this.filters = new Filters(); }); - App.addInitializer(function () { - this.layout = new Layout({ app: this }); - $('.issues').empty().append(this.layout.render().el); - $('#footer').addClass('search-navigator-footer'); - }); - - App.addInitializer(function () { - this.controller = new Controller({ app: this }); - }); - - App.addInitializer(function () { - this.issuesView = new WorkspaceListView({ - app: this, - collection: this.list - }); - this.layout.workspaceListRegion.show(this.issuesView); - this.issuesView.bindScrollEvents(); - }); - - App.addInitializer(function () { - this.workspaceHeaderView = new WorkspaceHeaderView({ - app: this, - collection: this.list - }); - this.layout.workspaceHeaderRegion.show(this.workspaceHeaderView); - }); - - App.addInitializer(function () { - this.facetsView = new FacetsView({ - app: this, - collection: this.facets - }); - this.layout.facetsRegion.show(this.facetsView); - }); - - App.addInitializer(function () { - return this.controller.fetchFilters().done(function () { - key.setScope('list'); - App.router = new Router({ app: App }); - Backbone.history.start(); - }); - }); - - var l10nXHR = window.requestMessages(); - return jQuery.when(l10nXHR).done(function () { - return App.start(); - }); + return App; }); diff --git a/server/sonar-web/src/main/js/apps/issues/app-new.js b/server/sonar-web/src/main/js/apps/issues/app-new.js index 07b047bfcd8..061903ae01f 100644 --- a/server/sonar-web/src/main/js/apps/issues/app-new.js +++ b/server/sonar-web/src/main/js/apps/issues/app-new.js @@ -14,69 +14,57 @@ define([ FacetsView, FiltersView) { var $ = jQuery, - App = new Marionette.Application(); + App = new Marionette.Application(), + init = function (options) { + this.state = new State(); + this.list = new Issues(); + this.facets = new Facets(); + this.filters = new Filters(); - App.addInitializer(function () { - this.state = new State(); - this.list = new Issues(); - this.facets = new Facets(); - this.filters = new Filters(); - }); + this.layout = new Layout({ app: this, el: options.el }); + this.layout.render(); + $('#footer').addClass('search-navigator-footer'); - App.addInitializer(function () { - this.layout = new Layout({ app: this }); - $('.issues').empty().append(this.layout.render().el); - $('#footer').addClass('search-navigator-footer'); - }); + this.controller = new Controller({ app: this }); - App.addInitializer(function () { - this.controller = new Controller({ app: this }); - }); + this.issuesView = new WorkspaceListView({ + app: this, + collection: this.list + }); + this.layout.workspaceListRegion.show(this.issuesView); + this.issuesView.bindScrollEvents(); - App.addInitializer(function () { - this.issuesView = new WorkspaceListView({ - app: this, - collection: this.list - }); - this.layout.workspaceListRegion.show(this.issuesView); - this.issuesView.bindScrollEvents(); - }); + this.workspaceHeaderView = new WorkspaceHeaderView({ + app: this, + collection: this.list + }); + this.layout.workspaceHeaderRegion.show(this.workspaceHeaderView); - App.addInitializer(function () { - this.workspaceHeaderView = new WorkspaceHeaderView({ - app: this, - collection: this.list - }); - this.layout.workspaceHeaderRegion.show(this.workspaceHeaderView); - }); + this.facetsView = new FacetsView({ + app: this, + collection: this.facets + }); + this.layout.facetsRegion.show(this.facetsView); - App.addInitializer(function () { - this.facetsView = new FacetsView({ - app: this, - collection: this.facets - }); - this.layout.facetsRegion.show(this.facetsView); - }); + this.filtersView = new FiltersView({ + app: this, + collection: this.filters + }); + this.layout.filtersRegion.show(this.filtersView); - App.addInitializer(function () { - this.filtersView = new FiltersView({ - app: this, - collection: this.filters - }); - this.layout.filtersRegion.show(this.filtersView); - }); + this.controller.fetchFilters().done(function () { + key.setScope('list'); + App.router = new Router({ app: App }); + Backbone.history.start(); + }); + }; - App.addInitializer(function () { - this.controller.fetchFilters().done(function () { - key.setScope('list'); - App.router = new Router({ app: App }); - Backbone.history.start(); + App.on('start', function (options) { + $.when(window.requestMessages()).done(function () { + init.call(App, options); }); }); - var l10nXHR = window.requestMessages(); - return jQuery.when(l10nXHR).done(function () { - return App.start(); - }); + return App; }); diff --git a/server/sonar-web/src/main/js/apps/issues/layout.js b/server/sonar-web/src/main/js/apps/issues/layout.js index 13a71301a24..5dbbcaf1139 100644 --- a/server/sonar-web/src/main/js/apps/issues/layout.js +++ b/server/sonar-web/src/main/js/apps/issues/layout.js @@ -19,8 +19,8 @@ define([ if (this.options.app.state.get('isContext')) { this.$(this.filtersRegion.el).addClass('hidden'); } - $('.search-navigator').addClass('sticky'); - var top = $('.search-navigator').offset().top; + this.$('.search-navigator').addClass('sticky'); + var top = this.$('.search-navigator').offset().top; this.$('.search-navigator-workspace-header').css({ top: top }); this.$('.search-navigator-side').css({ top: top }).isolatedScroll(); }, @@ -33,22 +33,22 @@ define([ showComponentViewer: function () { this.scroll = $(window).scrollTop(); - $('.issues').addClass('issues-extended-view'); + this.$('.issues').addClass('issues-extended-view'); }, hideComponentViewer: function () { - $('.issues').removeClass('issues-extended-view'); + this.$('.issues').removeClass('issues-extended-view'); if (this.scroll != null) { $(window).scrollTop(this.scroll); } }, showHomePage: function () { - $('.issues').addClass('issues-home-view'); + this.$('.issues').addClass('issues-home-view'); }, hideHomePage: function () { - $('.issues').removeClass('issues-home-view'); + this.$('.issues').removeClass('issues-home-view'); } }); diff --git a/server/sonar-web/src/main/js/apps/issues/templates/issues-layout.hbs b/server/sonar-web/src/main/js/apps/issues/templates/issues-layout.hbs index 5a61d1f66bf..b84449ae553 100644 --- a/server/sonar-web/src/main/js/apps/issues/templates/issues-layout.hbs +++ b/server/sonar-web/src/main/js/apps/issues/templates/issues-layout.hbs @@ -1,11 +1,13 @@ -<div class="search-navigator-side"> - <div class="search-navigator-filters"></div> - <div class="search-navigator-facets"></div> -</div> +<div class="issues search-navigator"> + <div class="search-navigator-side"> + <div class="search-navigator-filters"></div> + <div class="search-navigator-facets"></div> + </div> -<div class="search-navigator-workspace"> - <div class="search-navigator-workspace-header"></div> - <div class="search-navigator-workspace-list"></div> - <div class="issues-workspace-component-viewer"></div> - <div class="issues-workspace-home"></div> + <div class="search-navigator-workspace"> + <div class="search-navigator-workspace-header"></div> + <div class="search-navigator-workspace-list"></div> + <div class="issues-workspace-component-viewer"></div> + <div class="issues-workspace-home"></div> + </div> </div> diff --git a/server/sonar-web/src/main/js/apps/nav/app.js b/server/sonar-web/src/main/js/apps/nav/app.js index 5d45dd82f97..b229981ff6b 100644 --- a/server/sonar-web/src/main/js/apps/nav/app.js +++ b/server/sonar-web/src/main/js/apps/nav/app.js @@ -27,53 +27,54 @@ define([ var $ = jQuery, App = new Marionette.Application(), - state = new State(); + init = function (options) { + var state = new State(options); + state.fetchGlobal(); - state.set(window.navbarOptions.toJSON()); + this.navbarView = new GlobalNavbarView({ + app: App, + el: $('.navbar-global'), + model: state + }); + this.navbarView.render(); - App.on('start', function () { - state.fetchGlobal(); - - this.navbarView = new GlobalNavbarView({ - app: App, - el: $('.navbar-global'), - model: state - }); - this.navbarView.render(); + if (state.get('space') === 'component') { + state.fetchComponent(); + this.contextNavbarView = new ContextNavbarView({ + app: App, + el: $('.navbar-context'), + model: state + }); + this.contextNavbarView.render(); + } - if (state.get('space') === 'component') { - state.fetchComponent(); - this.contextNavbarView = new ContextNavbarView({ - app: App, - el: $('.navbar-context'), - model: state - }); - this.contextNavbarView.render(); - } + if (state.get('space') === 'settings') { + state.fetchSettings(); + this.settingsNavbarView = new SettingsNavbarView({ + app: App, + el: $('.navbar-context'), + model: state + }); + this.settingsNavbarView.render(); + } - if (state.get('space') === 'settings') { - state.fetchSettings(); - this.settingsNavbarView = new SettingsNavbarView({ - app: App, - el: $('.navbar-context'), - model: state - }); - this.settingsNavbarView.render(); - } + $(window).on('keypress', function (e) { + var tagName = e.target.tagName; + if (tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA') { + var code = e.keyCode || e.which; + if (code === 63) { + App.navbarView.showShortcutsHelp(); + } + } + }); + }; - $(window).on('keypress', function (e) { - var tagName = e.target.tagName; - if (tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA') { - var code = e.keyCode || e.which; - if (code === 63) { - App.navbarView.showShortcutsHelp(); - } - } + App.on('start', function (options) { + $.when(window.requestMessages()).done(function () { + init.call(App, options); }); }); - window.requestMessages().done(function () { - App.start(); - }); + return App; }); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/app.js b/server/sonar-web/src/main/js/apps/quality-gates/app.js index f5d521fe310..6f939c9aa24 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/app.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/app.js @@ -40,7 +40,7 @@ define([ this.router = new Router({ app: this }); Backbone.history.start({ pushState: true, - root: getRoot() + root: options.urlRoot }); }; @@ -57,13 +57,6 @@ define([ }); }); - function getRoot () { - var ROOT = '/quality_gates', - path = window.location.pathname, - pos = path.indexOf(ROOT); - return path.substr(0, pos + ROOT.length); - } - return App; }); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/layout.js b/server/sonar-web/src/main/js/apps/quality-gates/layout.js index 791ba30ae83..db02143caa6 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/layout.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/layout.js @@ -3,8 +3,6 @@ define([ './templates' ], function (IntroView) { - var $ = jQuery; - return Marionette.LayoutView.extend({ template: Templates['quality-gates-layout'], @@ -16,7 +14,7 @@ define([ }, onRender: function () { - var top = $('.search-navigator').offset().top; + var top = this.$('.search-navigator').offset().top; this.$('.search-navigator-workspace-header').css({ top: top }); this.$('.search-navigator-side').css({ top: top }).isolatedScroll(); this.renderIntro(); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-layout.hbs b/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-layout.hbs index 4ac8b8b6c37..25bd5742e32 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-layout.hbs +++ b/server/sonar-web/src/main/js/apps/quality-gates/templates/quality-gates-layout.hbs @@ -1,9 +1,11 @@ -<div class="search-navigator-side search-navigator-side-light"> - <div class="search-navigator-filters"></div> - <div class="quality-gates-results panel"></div> -</div> +<div class="search-navigator sticky search-navigator-extended-view"> + <div class="search-navigator-side search-navigator-side-light"> + <div class="search-navigator-filters"></div> + <div class="quality-gates-results panel"></div> + </div> -<div class="search-navigator-workspace"> - <div class="search-navigator-workspace-header"></div> - <div class="search-navigator-workspace-details"></div> + <div class="search-navigator-workspace"> + <div class="search-navigator-workspace-header"></div> + <div class="search-navigator-workspace-details"></div> + </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/app.js b/server/sonar-web/src/main/js/apps/quality-profiles/app.js index 30ed90b173c..cd94804cb03 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/app.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/app.js @@ -1,22 +1,3 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ './router', './controller', @@ -27,62 +8,55 @@ define([ ], function (Router, Controller, Layout, Profiles, ActionsView, ProfilesView) { var $ = jQuery, - App = new Marionette.Application(); - - App.on('start', function () { - // Layout - this.layout = new Layout({ el: '#quality-profiles' }); - this.layout.render(); - $('#footer').addClass('search-navigator-footer'); - - // Profiles List - this.profiles = new Profiles(); - - // Controller - this.controller = new Controller({ app: this }); - - // Actions View - this.actionsView = new ActionsView({ - collection: this.profiles, - canWrite: this.canWrite - }); - this.actionsView.requestLanguages().done(function () { - App.layout.actionsRegion.show(App.actionsView); - }); - - // Profiles View - this.profilesView = new ProfilesView({ - collection: this.profiles, - canWrite: this.canWrite - }); - this.layout.resultsRegion.show(this.profilesView); - - // Router - this.router = new Router({ app: this }); - Backbone.history.start({ - pushState: true, - root: getRoot() - }); - - }); - - - var requestUser = $.get(baseUrl + '/api/users/current').done(function (r) { + App = new Marionette.Application(), + requestUser = $.get(baseUrl + '/api/users/current').done(function (r) { App.canWrite = r.permissions.global.indexOf('profileadmin') !== -1; }), requestExporters = $.get(baseUrl + '/api/qualityprofiles/exporters').done(function (r) { App.exporters = r.exporters; - }); - - $.when(window.requestMessages(), requestUser, requestExporters).done(function () { - App.start(); + }), + init = function (options) { + // Layout + this.layout = new Layout({ el: options.el }); + this.layout.render(); + $('#footer').addClass('search-navigator-footer'); + + // Profiles List + this.profiles = new Profiles(); + + // Controller + this.controller = new Controller({ app: this }); + + // Actions View + this.actionsView = new ActionsView({ + collection: this.profiles, + canWrite: this.canWrite + }); + this.actionsView.requestLanguages().done(function () { + App.layout.actionsRegion.show(App.actionsView); + }); + + // Profiles View + this.profilesView = new ProfilesView({ + collection: this.profiles, + canWrite: this.canWrite + }); + this.layout.resultsRegion.show(this.profilesView); + + // Router + this.router = new Router({ app: this }); + Backbone.history.start({ + pushState: true, + root: options.urlRoot + }); + }; + + App.on('start', function (options) { + $.when(window.requestMessages(), requestUser, requestExporters).done(function () { + init.call(App, options); + }); }); - function getRoot () { - var QUALITY_PROFILES = '/profiles', - path = window.location.pathname, - pos = path.indexOf(QUALITY_PROFILES); - return path.substr(0, pos + QUALITY_PROFILES.length); - } + return App; }); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/layout.js b/server/sonar-web/src/main/js/apps/quality-profiles/layout.js index 7ec62799470..44cafd82d32 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/layout.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/layout.js @@ -22,8 +22,6 @@ define([ './templates' ], function (IntroView) { - var $ = jQuery; - return Marionette.LayoutView.extend({ template: Templates['quality-profiles-layout'], @@ -35,7 +33,7 @@ define([ }, onRender: function () { - var navigator = $('.search-navigator'); + var navigator = this.$('.search-navigator'); navigator.addClass('sticky search-navigator-extended-view'); var top = navigator.offset().top; this.$('.search-navigator-workspace-header').css({ top: top }); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-layout.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-layout.hbs index 91e2e23a237..ac6f40bcaa4 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-layout.hbs +++ b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-layout.hbs @@ -1,9 +1,11 @@ -<div class="search-navigator-side search-navigator-side-light"> - <div class="search-navigator-filters"></div> - <div class="quality-profiles-results panel"></div> -</div> +<div class="search-navigator"> + <div class="search-navigator-side search-navigator-side-light"> + <div class="search-navigator-filters"></div> + <div class="quality-profiles-results panel"></div> + </div> -<div class="search-navigator-workspace"> - <div class="search-navigator-workspace-header"></div> - <div class="search-navigator-workspace-details"></div> + <div class="search-navigator-workspace"> + <div class="search-navigator-workspace-header"></div> + <div class="search-navigator-workspace-details"></div> + </div> </div> diff --git a/server/sonar-web/src/main/js/apps/source-viewer/app.js b/server/sonar-web/src/main/js/apps/source-viewer/app.js index ded35b07041..1c6947db3ee 100644 --- a/server/sonar-web/src/main/js/apps/source-viewer/app.js +++ b/server/sonar-web/src/main/js/apps/source-viewer/app.js @@ -1,54 +1,29 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -requirejs.config({ - baseUrl: baseUrl + '/js' -}); - -requirejs([ +define([ 'components/source-viewer/main' - ], function (SourceViewer) { - var App = new Marionette.Application(); - - App.addRegions({ - viewerRegion: '#source-viewer' + var App = new Marionette.Application(), + init = function (options) { + this.addRegions({ mainRegion: options.el }); + + var viewer = new SourceViewer(); + this.mainRegion.show(viewer); + viewer.open(options.file.uuid); + if (typeof options.file.line === 'number') { + viewer.on('loaded', function () { + viewer + .highlightLine(options.file.line) + .scrollToLine(options.file.line); + }); + } + }; + + App.on('start', function (options) { + window.requestMessages().done(function () { + init.call(App, options); + }); }); - App.addInitializer(function () { - var viewer = new SourceViewer(); - App.viewerRegion.show(viewer); - viewer.open(window.file.uuid); - if (typeof window.file.line === 'number') { - viewer.on('loaded', function () { - viewer - .highlightLine(window.file.line) - .scrollToLine(window.file.line); - }); - } - }); - - var l10nXHR = window.requestMessages(); - - l10nXHR.done(function () { - App.start(); - }); + return App; }); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb index 9779e93a1c0..52765748951 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb @@ -1,9 +1,7 @@ -<div id="api-documentation" class="search-navigator sticky"></div> - <% content_for :extra_script do %> <script> require(['apps/api-documentation/app'], function (App) { - App.start({ el: '#api-documentation' }); + App.start({ el: '#content', urlRoot: baseUrl + '/api_documentation' }); }); </script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb index c520f46993c..804ed54db8f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb @@ -1,7 +1,7 @@ -<div class="coding-rules search-navigator"></div> - <% content_for :extra_script do %> <script> - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); </script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb index 3711e3ebb46..5f6a94409f2 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb @@ -1,14 +1,17 @@ -<% content_for :script do %> - <script>require(['apps/source-viewer/app']);</script> +<% content_for :extra_script do %> + <script type="text/javascript"> + (function () { + var file = { + uuid: '<%= @resource.uuid -%>', + key: '<%= @resource.key -%>' + <% if @line %>, line: <%= @line -%><% end %> + }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#body', file: file }) + }); + })(); + </script> <% end %> -<div id="source-viewer"></div> -<script type="text/javascript"> - window.file = { - uuid: '<%= @resource.uuid -%>', - key: '<%= @resource.key -%>' - <% if @line %>,line: <%= @line -%><% end %> - }; -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb index c1b98d59ad0..d3a46e6eeda 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb @@ -1,14 +1,15 @@ -<% content_for :script do %> - <script>require(['apps/issues/app-context']);</script> +<% content_for :extra_script do %> + <script> + (function () { + var config = { + resource: '<%= escape_javascript @resource.uuid -%>', + resourceQualifier: '<%= escape_javascript @resource.qualifier -%>', + resourceName: '<%= escape_javascript @resource.name -%>', + periodDate: <% if @period %>'<%= escape_javascript @snapshot.period_datetime(@period) -%>'<% else %>null<% end %> + }; + require(['apps/issues/app-context'], function (App) { + App.start({ el: '#content', config: config }); + }); + })(); + </script> <% end %> - -<div class="issues search-navigator"></div> - -<script> - var config = { - resource: '<%= escape_javascript @resource.uuid -%>', - resourceQualifier: '<%= escape_javascript @resource.qualifier -%>', - resourceName: '<%= escape_javascript @resource.name -%>', - periodDate: <% if @period %>'<%= escape_javascript @snapshot.period_datetime(@period) -%>'<% else %>null<% end %> - }; -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb index d23d96e68c2..23e483f5746 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb @@ -3,16 +3,21 @@ </div> <% content_for :extra_script do %> - <script type="text/javascript"> - window.file = { - uuid: '<%= @resource.uuid -%>', - key: '<%= @resource.key -%>' - }; - document.querySelector('.navbar-context').remove(); - jQuery('.page-wrapper-context').addClass('page-wrapper-global').removeClass('page-wrapper-context'); - </script> - <script> - require(['apps/source-viewer/app']); + (function () { + jQuery('.navbar-context').remove(); + jQuery('.page-wrapper-context').addClass('page-wrapper-global').removeClass('page-wrapper-context'); + var file = { + uuid: '<%= @resource.uuid -%>', + key: '<%= @resource.key -%>' + }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#source-viewer', file: file }) + }); + })(); </script> <% end %> + + + + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb index 66fb3c06168..1cf75f1d41f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb @@ -1,7 +1,7 @@ -<div class="issues search-navigator"></div> - <% content_for :extra_script do %> <script> - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); </script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb index 21e492f553c..dd25b284589 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb @@ -1,5 +1,29 @@ -<%= render 'layouts/navbar_conf' -%> <%= render 'layouts/recent_history' -%> + +<% + selected_section = controller.class::SECTION if defined?(controller.class::SECTION) + if selected_section == Navigation::SECTION_RESOURCE && !@project && !@resource + selected_section = Navigation::SECTION_HOME + end + + @project = @resource unless @project || selected_section == Navigation::SECTION_HOME +%> + <script> - require(['apps/nav/app']); + (function () { + var options = {}; + <% if selected_section == Navigation::SECTION_RESOURCE %> + options.space = 'component'; + options.componentKey = '<%= escape_javascript @project.key -%>'; + <% end %> + + <% if selected_section == Navigation::SECTION_CONFIGURATION %> + options.space = 'settings'; + <% end %> + + window.SS.isUserAdmin = <%= current_user && is_admin? ? 'true' : 'false' -%>; + require(['apps/nav/app'], function (App) { + App.start(options); + }); + })(); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf.html.erb deleted file mode 100644 index 194fe53bd42..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -<% - selected_section = controller.class::SECTION if defined?(controller.class::SECTION) - if selected_section == Navigation::SECTION_RESOURCE && !@project && !@resource - selected_section = Navigation::SECTION_HOME - end - - @project = @resource unless @project || selected_section == Navigation::SECTION_HOME -%> - -<script> - window.navbarOptions = new Backbone.Model(); - - <% if selected_section == Navigation::SECTION_RESOURCE %> - window.navbarOptions.set({ space: 'component', componentKey: '<%= escape_javascript @project.key -%>' }); - <% end %> - - <% if selected_section == Navigation::SECTION_CONFIGURATION %> - window.navbarOptions.set({ space: 'settings' }); - <% end %> - - window.SS.isUserAdmin = <%= current_user && is_admin? ? 'true' : 'false' -%>; -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 371d2b45735..9f4ee19f8cc 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -1,7 +1,7 @@ -<div class="search-navigator" id="quality-profiles"></div> - <% content_for :extra_script do %> <script> - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: baseUrl + '/profiles' }); + }); </script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb index 749c6aeba6a..9563962a02a 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb @@ -1,6 +1,7 @@ -<div class="search-navigator sticky search-navigator-extended-view" id="quality-gates"></div> -<script> - require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); - }); -</script> +<% content_for :extra_script do %> + <script> + require(['apps/quality-gates/app'], function (App) { + App.start({ el: '#content', urlRoot: baseUrl + '/quality_gates' }); + }); + </script> +<% end %> diff --git a/server/sonar-web/src/test/js/api-documentation-spec.js b/server/sonar-web/src/test/js/api-documentation-spec.js index 215d5c4e469..b068de274dc 100644 --- a/server/sonar-web/src/test/js/api-documentation-spec.js +++ b/server/sonar-web/src/test/js/api-documentation-spec.js @@ -29,7 +29,7 @@ lib.configureCasper(); casper.test.begin(testName('Should Show List'), 12, function (test) { casper - .start(lib.buildUrl('api_documentation'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/webservices/list', 'list.json'); @@ -38,7 +38,7 @@ casper.test.begin(testName('Should Show List'), 12, function (test) { .then(function () { casper.evaluate(function () { require(['apps/api-documentation/app'], function (App) { - App.start({ el: '#api-documentation' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -86,7 +86,7 @@ casper.test.begin(testName('Should Show List'), 12, function (test) { casper.test.begin(testName('Should Show Actions'), 10, function (test) { casper - .start(lib.buildUrl('api_documentation'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/webservices/list', 'list.json'); @@ -95,7 +95,7 @@ casper.test.begin(testName('Should Show Actions'), 10, function (test) { .then(function () { casper.evaluate(function () { require(['apps/api-documentation/app'], function (App) { - App.start({ el: '#api-documentation' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -132,7 +132,7 @@ casper.test.begin(testName('Should Show Actions'), 10, function (test) { casper.test.begin(testName('Should Show Example Response'), 1, function (test) { casper - .start(lib.buildUrl('api_documentation'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/webservices/list', 'list.json'); @@ -143,7 +143,7 @@ casper.test.begin(testName('Should Show Example Response'), 1, function (test) { .then(function () { casper.evaluate(function () { require(['apps/api-documentation/app'], function (App) { - App.start({ el: '#api-documentation' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -174,7 +174,7 @@ casper.test.begin(testName('Should Show Example Response'), 1, function (test) { casper.test.begin(testName('Web Service Permalink'), 1, function (test) { casper - .start(lib.buildUrl('api_documentation#api/public'), function () { + .start(lib.buildUrl('base#api/public'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/webservices/list', 'list.json'); @@ -183,7 +183,7 @@ casper.test.begin(testName('Web Service Permalink'), 1, function (test) { .then(function () { casper.evaluate(function () { require(['apps/api-documentation/app'], function (App) { - App.start({ el: '#api-documentation' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -208,7 +208,7 @@ casper.test.begin(testName('Web Service Permalink'), 1, function (test) { casper.test.begin(testName('Action Permalink'), 1, function (test) { casper - .start(lib.buildUrl('api_documentation#api/internal/move'), function () { + .start(lib.buildUrl('base#api/internal/move'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/webservices/list', 'list.json'); @@ -217,7 +217,7 @@ casper.test.begin(testName('Action Permalink'), 1, function (test) { .then(function () { casper.evaluate(function () { require(['apps/api-documentation/app'], function (App) { - App.start({ el: '#api-documentation' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) diff --git a/server/sonar-web/src/test/js/coding-rules-spec.js b/server/sonar-web/src/test/js/coding-rules-spec.js index 7824936b3d3..ebd288fe0a3 100644 --- a/server/sonar-web/src/test/js/coding-rules-spec.js +++ b/server/sonar-web/src/test/js/coding-rules-spec.js @@ -5,7 +5,7 @@ describe('Coding Rules App', function () { it('should show alert when there is no available profiles for activation', 2, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app-no-available-profiles.json'); lib.fmock('/api/rules/search', 'search-no-available-profiles.json'); @@ -15,7 +15,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -42,7 +44,7 @@ describe('Coding Rules App', function () { it('should show profile facet', 6, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-profile-facet-qprofile-active.json', { data: { activation: true } }); @@ -53,7 +55,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -93,7 +97,7 @@ describe('Coding Rules App', function () { it('should show query facet', 3, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-query.json', { data: { q: 'query' } }); @@ -102,7 +106,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -135,7 +141,7 @@ describe('Coding Rules App', function () { it('should show rule permalink', 1, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -145,7 +151,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -166,7 +174,7 @@ describe('Coding Rules App', function () { it('should activate profile', 5, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -177,7 +185,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -214,7 +224,7 @@ describe('Coding Rules App', function () { it('should create custom rule', 1, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); this.customRulesSearchMock = lib.fmock('/api/rules/search', 'search-custom-rules.json', @@ -227,7 +237,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -260,7 +272,7 @@ describe('Coding Rules App', function () { it('should reactivate custom rule', 2, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); this.customRulesSearchMock = lib.fmock('/api/rules/search', 'search-custom-rules.json', @@ -273,7 +285,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -319,7 +333,7 @@ describe('Coding Rules App', function () { it('should create manual rule', 3, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-create-manual-rule.json'); @@ -330,7 +344,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -361,7 +377,7 @@ describe('Coding Rules App', function () { it('should reactivate manual rule', 7, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-create-manual-rule.json'); @@ -372,7 +388,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -415,7 +433,7 @@ describe('Coding Rules App', function () { it('should delete custom rules', 1, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-delete-custom-rule-custom-rules.json', @@ -428,7 +446,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -452,7 +472,7 @@ describe('Coding Rules App', function () { it('should delete manual rules', 1, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); this.searchMock = lib.fmock('/api/rules/search', 'search-delete-manual-rule-before.json'); @@ -463,7 +483,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -496,7 +518,7 @@ describe('Coding Rules App', function () { it('should show custom rules', 3, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-show-cutsom-rule-custom-rules.json', @@ -508,7 +530,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -532,7 +556,7 @@ describe('Coding Rules App', function () { it('should show deprecated label', 1, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-deprecated.json'); @@ -540,7 +564,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -555,7 +581,7 @@ describe('Coding Rules App', function () { it('should show rule details', 20, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-show-details.json'); @@ -565,7 +591,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -610,7 +638,7 @@ describe('Coding Rules App', function () { it('should show empty list', 3, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-empty.json'); @@ -618,7 +646,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -635,7 +665,7 @@ describe('Coding Rules App', function () { it('should show facets', 1, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -643,7 +673,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -658,7 +690,7 @@ describe('Coding Rules App', function () { it('should show rule', 7, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -666,7 +698,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -687,7 +721,7 @@ describe('Coding Rules App', function () { it('should show rule issues', 5, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -697,7 +731,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -722,7 +758,7 @@ describe('Coding Rules App', function () { it('should show rules', 4, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -730,7 +766,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -749,7 +787,7 @@ describe('Coding Rules App', function () { it('should move between rules from detailed view', 3, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -758,7 +796,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -801,7 +841,7 @@ describe('Coding Rules App', function () { it('should filter similar rules', 3, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-sql-tag.json', { data: { tags: 'sql' } }); @@ -810,7 +850,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -839,7 +881,7 @@ describe('Coding Rules App', function () { it('should show active severity facet', 7, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-BLOCKER.json', { data: { active_severities: 'BLOCKER' } }); @@ -852,7 +894,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -898,7 +942,7 @@ describe('Coding Rules App', function () { it('should show available since facet', 2, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-limited.json', { data: { available_since: '2014-12-01' } }); @@ -907,7 +951,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -934,7 +980,7 @@ describe('Coding Rules App', function () { it('should bulk activate', 7, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -943,7 +989,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -989,7 +1037,7 @@ describe('Coding Rules App', function () { it('should fail to bulk activate', 6, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -998,7 +1046,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1043,7 +1093,7 @@ describe('Coding Rules App', function () { it('should filter profiles by language during bulk change', 4, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search.json'); @@ -1051,7 +1101,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1083,7 +1135,7 @@ describe('Coding Rules App', function () { it('should change selected profile during bulk change', 4, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-qprofile-active.json', @@ -1094,7 +1146,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1138,7 +1192,7 @@ describe('Coding Rules App', function () { it('should show characteristic facet', 6, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); @@ -1156,7 +1210,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1201,7 +1257,7 @@ describe('Coding Rules App', function () { it('should disable characteristic facet', 6, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); lib.fmock('/api/rules/app', 'app.json'); @@ -1218,7 +1274,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1296,7 +1354,7 @@ describe('Coding Rules App', function () { it('should show template facet', 4, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); lib.fmock('/api/rules/app', 'app.json'); @@ -1307,7 +1365,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1350,7 +1410,7 @@ describe('Coding Rules App', function () { it('should show language facet', 5, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); @@ -1363,7 +1423,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1406,7 +1468,7 @@ describe('Coding Rules App', function () { it('should reload results', 2, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); @@ -1416,7 +1478,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1440,7 +1504,7 @@ describe('Coding Rules App', function () { it('should do a new search', 3, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); lib.fmock('/api/rules/app', 'app.json'); @@ -1450,7 +1514,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1478,7 +1544,7 @@ describe('Coding Rules App', function () { it('should go back', 2, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); lib.fmock('/api/rules/app', 'app.json'); @@ -1488,7 +1554,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1512,7 +1580,7 @@ describe('Coding Rules App', function () { it('should show inheritance facet', 11, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/rules/app', 'app.json'); lib.fmock('/api/rules/search', 'search-not-inherited.json', { data: { inheritance: 'NONE' } }); @@ -1527,7 +1595,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -1592,7 +1662,7 @@ describe('Coding Rules App', function () { it('should show activation details', 5, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); lib.fmock('/api/rules/app', 'app.json'); @@ -1602,7 +1672,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1632,7 +1704,7 @@ describe('Coding Rules App', function () { it('should activate rule', 9, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); lib.fmock('/api/rules/app', 'app.json'); @@ -1643,7 +1715,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -1688,7 +1762,7 @@ describe('Coding Rules App', function () { it('should deactivate rule', 6, function (casper, test) { return casper - .start(lib.buildUrl('coding-rules'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.smock('/api/l10n/index', '{}'); lib.fmock('/api/rules/app', 'app.json'); @@ -1699,7 +1773,9 @@ describe('Coding Rules App', function () { .then(function () { casper.evaluate(function () { - require(['apps/coding-rules/app']); + require(['apps/coding-rules/app'], function (App) { + App.start({ el: '#content' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) diff --git a/server/sonar-web/src/test/js/global-issue-filter-widget.js b/server/sonar-web/src/test/js/global-issue-filter-widget.js index f4d92282615..5cf3863ccdb 100644 --- a/server/sonar-web/src/test/js/global-issue-filter-widget.js +++ b/server/sonar-web/src/test/js/global-issue-filter-widget.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -43,7 +43,7 @@ casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'severities' }); @@ -53,7 +53,7 @@ casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -89,7 +89,7 @@ casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) casper.test.begin(testName('Red Issues By Severity'), 9, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -102,7 +102,7 @@ casper.test.begin(testName('Red Issues By Severity'), 9, function (test) { require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false|severities=BLOCKER,CRITICAL,MAJOR', distributionAxis: 'severities' }); @@ -112,7 +112,7 @@ casper.test.begin(testName('Red Issues By Severity'), 9, function (test) { }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -144,7 +144,7 @@ casper.test.begin(testName('Red Issues By Severity'), 9, function (test) { casper.test.begin(testName('All Issues By Status'), 9, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -156,7 +156,7 @@ casper.test.begin(testName('All Issues By Status'), 9, function (test) { require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: '', distributionAxis: 'statuses' }); @@ -166,7 +166,7 @@ casper.test.begin(testName('All Issues By Status'), 9, function (test) { }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -198,7 +198,7 @@ casper.test.begin(testName('All Issues By Status'), 9, function (test) { casper.test.begin(testName('Unresolved Issues By Status'), 9, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -211,7 +211,7 @@ casper.test.begin(testName('Unresolved Issues By Status'), 9, function (test) { require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'statuses' }); @@ -221,7 +221,7 @@ casper.test.begin(testName('Unresolved Issues By Status'), 9, function (test) { }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -253,7 +253,7 @@ casper.test.begin(testName('Unresolved Issues By Status'), 9, function (test) { casper.test.begin(testName('All Issues By Resolution'), 10, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -265,7 +265,7 @@ casper.test.begin(testName('All Issues By Resolution'), 10, function (test) { require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: '', distributionAxis: 'resolutions' }); @@ -275,7 +275,7 @@ casper.test.begin(testName('All Issues By Resolution'), 10, function (test) { }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -308,7 +308,7 @@ casper.test.begin(testName('All Issues By Resolution'), 10, function (test) { casper.test.begin(testName('Unresolved Issues By Resolution'), 5, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -321,7 +321,7 @@ casper.test.begin(testName('Unresolved Issues By Resolution'), 5, function (test require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'resolutions' }); @@ -331,7 +331,7 @@ casper.test.begin(testName('Unresolved Issues By Resolution'), 5, function (test }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -359,7 +359,7 @@ casper.test.begin(testName('Unresolved Issues By Resolution'), 5, function (test casper.test.begin(testName('Unresolved Issues By Rule'), 15, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -372,7 +372,7 @@ casper.test.begin(testName('Unresolved Issues By Rule'), 15, function (test) { require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'rules' }); @@ -382,7 +382,7 @@ casper.test.begin(testName('Unresolved Issues By Rule'), 15, function (test) { }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -422,7 +422,7 @@ casper.test.begin(testName('Unresolved Issues By Rule'), 15, function (test) { casper.test.begin(testName('Unresolved Issues By Project'), 15, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -435,7 +435,7 @@ casper.test.begin(testName('Unresolved Issues By Project'), 15, function (test) require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'projectUuids' }); @@ -445,7 +445,7 @@ casper.test.begin(testName('Unresolved Issues By Project'), 15, function (test) }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -485,7 +485,7 @@ casper.test.begin(testName('Unresolved Issues By Project'), 15, function (test) casper.test.begin(testName('Unresolved Issues By Assignee'), 15, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -498,7 +498,7 @@ casper.test.begin(testName('Unresolved Issues By Assignee'), 15, function (test) require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'assignees' }); @@ -508,7 +508,7 @@ casper.test.begin(testName('Unresolved Issues By Assignee'), 15, function (test) }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -548,7 +548,7 @@ casper.test.begin(testName('Unresolved Issues By Assignee'), 15, function (test) casper.test.begin(testName('Unresolved Unassigned Issues By Assignee'), 6, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -561,7 +561,7 @@ casper.test.begin(testName('Unresolved Unassigned Issues By Assignee'), 6, funct require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false|assigned=false', distributionAxis: 'assignees' }); @@ -571,7 +571,7 @@ casper.test.begin(testName('Unresolved Unassigned Issues By Assignee'), 6, funct }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -602,7 +602,7 @@ casper.test.begin(testName('Unresolved Unassigned Issues By Assignee'), 6, funct casper.test.begin(testName('Unresolved Issues By Reporter'), 12, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -615,7 +615,7 @@ casper.test.begin(testName('Unresolved Issues By Reporter'), 12, function (test) require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'reporters' }); @@ -625,7 +625,7 @@ casper.test.begin(testName('Unresolved Issues By Reporter'), 12, function (test) }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -662,7 +662,7 @@ casper.test.begin(testName('Unresolved Issues By Reporter'), 12, function (test) casper.test.begin(testName('Unresolved Issues By Language'), 15, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -675,7 +675,7 @@ casper.test.begin(testName('Unresolved Issues By Language'), 15, function (test) require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'languages' }); @@ -685,7 +685,7 @@ casper.test.begin(testName('Unresolved Issues By Language'), 15, function (test) }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -725,7 +725,7 @@ casper.test.begin(testName('Unresolved Issues By Language'), 15, function (test) casper.test.begin(testName('Unresolved Issues By Action Plan'), 15, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -738,7 +738,7 @@ casper.test.begin(testName('Unresolved Issues By Action Plan'), 15, function (te require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'actionPlans' }); @@ -748,7 +748,7 @@ casper.test.begin(testName('Unresolved Issues By Action Plan'), 15, function (te }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -788,7 +788,7 @@ casper.test.begin(testName('Unresolved Issues By Action Plan'), 15, function (te casper.test.begin(testName('Unresolved Unplanned Issues By Action Plan'), 6, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -801,7 +801,7 @@ casper.test.begin(testName('Unresolved Unplanned Issues By Action Plan'), 6, fun require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false|planned=false', distributionAxis: 'actionPlans' }); @@ -811,7 +811,7 @@ casper.test.begin(testName('Unresolved Unplanned Issues By Action Plan'), 6, fun }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -842,7 +842,7 @@ casper.test.begin(testName('Unresolved Unplanned Issues By Action Plan'), 6, fun casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -855,7 +855,7 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'createdAt' }); @@ -865,7 +865,7 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -910,7 +910,7 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { casper.test.begin(testName('Unresolved Issues on a Limited Period By Date'), 12, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -923,7 +923,7 @@ casper.test.begin(testName('Unresolved Issues on a Limited Period By Date'), 12, require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false|createdAfter=2015-02-16|createdBefore=2015-02-18', distributionAxis: 'createdAt' }); @@ -933,7 +933,7 @@ casper.test.begin(testName('Unresolved Issues on a Limited Period By Date'), 12, }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { diff --git a/server/sonar-web/src/test/js/issues-page-should-open-issue-permalink.js b/server/sonar-web/src/test/js/issues-page-should-open-issue-permalink.js index e2c6841100b..af5ce1a8b5b 100644 --- a/server/sonar-web/src/test/js/issues-page-should-open-issue-permalink.js +++ b/server/sonar-web/src/test/js/issues-page-should-open-issue-permalink.js @@ -32,7 +32,7 @@ var issueKey = 'some-issue-key'; casper.test.begin('issues-page-should-open-issue-permalink', 3, function (test) { casper - .start(lib.buildUrl('issues#issues=' + encodeURI(issueKey)), function () { + .start(lib.buildUrl('base#issues=' + encodeURI(issueKey)), function () { lib.setDefaultViewport(); @@ -45,7 +45,9 @@ casper.test.begin('issues-page-should-open-issue-permalink', 3, function (test) .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) diff --git a/server/sonar-web/src/test/js/issues-page-spec.js b/server/sonar-web/src/test/js/issues-page-spec.js index dbbfe698475..0bb392501eb 100644 --- a/server/sonar-web/src/test/js/issues-page-spec.js +++ b/server/sonar-web/src/test/js/issues-page-spec.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName('Base'), function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -40,7 +40,9 @@ casper.test.begin(testName('Base'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -94,7 +96,7 @@ casper.test.begin(testName('Base'), function (test) { casper.test.begin(testName('Context'), function (test) { casper - .start(lib.buildUrl('issues-context'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -104,13 +106,15 @@ casper.test.begin(testName('Context'), function (test) { .then(function () { casper.evaluate(function () { - window.config = { + var config = { resource: 'uuid', resourceQualifier: 'TRL', resourceName: 'SonarQube', periodDate: null }; - require(['apps/issues/app-context']); + require(['apps/issues/app-context'], function (App) { + App.start({ el: '#content', config: config }); + }); }); }) @@ -163,7 +167,7 @@ casper.test.begin(testName('Context'), function (test) { casper.test.begin(testName('Issue Box', 'Check Elements'), function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -173,7 +177,9 @@ casper.test.begin(testName('Issue Box', 'Check Elements'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -211,7 +217,7 @@ casper.test.begin(testName('Issue Box', 'Check Elements'), function (test) { casper.test.begin(testName('Issue Box', 'Tags'), function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -223,7 +229,9 @@ casper.test.begin(testName('Issue Box', 'Tags'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -262,7 +270,7 @@ casper.test.begin(testName('Issue Box', 'Tags'), function (test) { casper.test.begin(testName('Issue Box', 'Transitions'), function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -274,7 +282,9 @@ casper.test.begin(testName('Issue Box', 'Transitions'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -305,7 +315,7 @@ casper.test.begin(testName('Issue Box', 'Transitions'), function (test) { casper.test.begin(testName('Issue Box', 'Rule'), function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -316,7 +326,9 @@ casper.test.begin(testName('Issue Box', 'Rule'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -350,7 +362,7 @@ casper.test.begin(testName('File-Level Issues'), function (test) { issueSelector = '.issue[data-key="' + issueKey + '"]'; casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -362,7 +374,9 @@ casper.test.begin(testName('File-Level Issues'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -390,7 +404,7 @@ casper.test.begin(testName('File-Level Issues'), function (test) { casper.test.begin(testName('Severity Facet'), function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -401,7 +415,9 @@ casper.test.begin(testName('Severity Facet'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -432,7 +448,7 @@ casper.test.begin(testName('Select Issues'), 11, function (test) { issueSelector = '.issue[data-key="' + issueKey + '"]'; casper - .start(lib.buildUrl('issues#resolved=false'), function () { + .start(lib.buildUrl('base#resolved=false'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/issue_filters/app', 'app.json'); @@ -441,7 +457,9 @@ casper.test.begin(testName('Select Issues'), 11, function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -487,7 +505,7 @@ casper.test.begin(testName('Select Issues'), 11, function (test) { casper.test.begin(testName('Bulk Change'), function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -499,7 +517,9 @@ casper.test.begin(testName('Bulk Change'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -529,7 +549,7 @@ casper.test.begin(testName('Bulk Change of Selected Issues'), 8, function (test) issueSelector = '.issue[data-key="' + issueKey + '"]'; casper - .start(lib.buildUrl('issues#resolved=false'), function () { + .start(lib.buildUrl('base#resolved=false'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/issue_filters/app', 'app.json'); @@ -540,7 +560,9 @@ casper.test.begin(testName('Bulk Change of Selected Issues'), 8, function (test) .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) @@ -595,7 +617,7 @@ casper.test.begin(testName('Bulk Change of Selected Issues'), 8, function (test) casper.test.begin(testName('Filter Similar Issues'), 12, function (test) { casper - .start(lib.buildUrl('issues'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -607,7 +629,9 @@ casper.test.begin(testName('Filter Similar Issues'), 12, function (test) { .then(function () { casper.evaluate(function () { - require(['apps/issues/app-new']); + require(['apps/issues/app-new'], function (App) { + App.start({ el: '#content' }); + }); }); }) diff --git a/server/sonar-web/src/test/js/nav-spec.js b/server/sonar-web/src/test/js/nav-spec.js index e62bc2ced18..13f0fcef993 100644 --- a/server/sonar-web/src/test/js/nav-spec.js +++ b/server/sonar-web/src/test/js/nav-spec.js @@ -5,7 +5,7 @@ describe('Navigation App', function () { it('should show global spaces', 7, function (casper, test) { return casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/navigation/global', 'global.json'); }) @@ -13,8 +13,9 @@ describe('Navigation App', function () { .then(function () { casper.evaluate(function () { window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) @@ -40,7 +41,7 @@ describe('Navigation App', function () { it('should show global dashboards', 12, function (casper, test) { return casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/navigation/global', 'global.json'); }) @@ -48,8 +49,9 @@ describe('Navigation App', function () { .then(function () { casper.evaluate(function () { window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) @@ -83,7 +85,7 @@ describe('Navigation App', function () { it('should show global plugin pages', 12, function (casper, test) { return casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/navigation/global', 'global.json'); }) @@ -91,8 +93,9 @@ describe('Navigation App', function () { .then(function () { casper.evaluate(function () { window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) @@ -126,15 +129,16 @@ describe('Navigation App', function () { it('should show login form', 3, function (casper, test) { return casper - .start(lib.buildUrl('nav#anchor'), function () { + .start(lib.buildUrl('base#anchor'), function () { lib.setDefaultViewport(); }) .then(function () { casper.evaluate(function () { window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) @@ -146,7 +150,7 @@ describe('Navigation App', function () { test.assertExists('.navbar-global .js-login'); casper.click('.navbar-global .js-login'); casper.waitForUrl('/sessions/new?return_to=', function () { - test.assertUrlMatches('/pages/nav'); + test.assertUrlMatches('/pages/base'); test.assertUrlMatches('#anchor'); }); }); @@ -154,7 +158,7 @@ describe('Navigation App', function () { it('should search', 24, function (casper, test) { return casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/navigation/global', 'global.json'); lib.fmock('/api/components/suggestions', 'search.json'); @@ -165,10 +169,11 @@ describe('Navigation App', function () { casper.evaluate(function () { window.SS.user = 'user'; window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); window.localStorage.setItem('sonar_recent_history', '[{"key":"localhistoryproject","name":"Local History Project","icon":"trk"}]'); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) @@ -241,7 +246,7 @@ describe('Navigation App', function () { it('should show context bar', 3, function (casper, test) { return casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/navigation/component', 'component.json', { data: { componentKey: 'org.codehaus.sonar-plugins.java:java' } }); @@ -250,9 +255,9 @@ describe('Navigation App', function () { .then(function () { casper.evaluate(function () { window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - window.navbarOptions.set({ space: 'component', componentKey: 'org.codehaus.sonar-plugins.java:java' }); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start({ space: 'component', componentKey: 'org.codehaus.sonar-plugins.java:java' }); + }); }); }) @@ -269,7 +274,7 @@ describe('Navigation App', function () { it('should favorite component', 1, function (casper, test) { return casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/navigation/component', 'component.json', { data: { componentKey: 'org.codehaus.sonar-plugins.java:java' } }); @@ -280,9 +285,9 @@ describe('Navigation App', function () { .then(function () { casper.evaluate(function () { window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - window.navbarOptions.set({ space: 'component', componentKey: 'org.codehaus.sonar-plugins.java:java' }); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start({ space: 'component', componentKey: 'org.codehaus.sonar-plugins.java:java' }); + }); }); }) diff --git a/server/sonar-web/src/test/js/project-issue-filter-widget.js b/server/sonar-web/src/test/js/project-issue-filter-widget.js index 083065c01e3..8ec0127a1ad 100644 --- a/server/sonar-web/src/test/js/project-issue-filter-widget.js +++ b/server/sonar-web/src/test/js/project-issue-filter-widget.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -43,7 +43,7 @@ casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'severities', componentUuid: '69e57151-be0d-4157-adff-c06741d88879', @@ -55,7 +55,7 @@ casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -91,7 +91,7 @@ casper.test.begin(testName('Unresolved Issues By Severity'), 13, function (test) casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -104,7 +104,7 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'createdAt', componentUuid: '69e57151-be0d-4157-adff-c06741d88879', @@ -116,7 +116,7 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -161,7 +161,7 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) { casper.test.begin(testName('Unresolved Issues By Severity With Differential Period'), 13, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -174,7 +174,7 @@ casper.test.begin(testName('Unresolved Issues By Severity With Differential Peri require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false', distributionAxis: 'severities', periodDate: '2014-12-09T17:12:38+0100', @@ -187,7 +187,7 @@ casper.test.begin(testName('Unresolved Issues By Severity With Differential Peri }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { @@ -223,7 +223,7 @@ casper.test.begin(testName('Unresolved Issues By Severity With Differential Peri casper.test.begin(testName('Unresolved Issues By Severity With IGNORED Differential Period'), 19, function (test) { casper - .start(lib.buildUrl('issue-filter-widget'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -237,7 +237,7 @@ casper.test.begin(testName('Unresolved Issues By Severity With IGNORED Different require(['widgets/issue-filter/widget'], function (IssueFilter) { window.requestMessages().done(function () { new IssueFilter({ - el: '#issue-filter-widget', + el: '#content', query: 'resolved=false|createdInLast=1w', distributionAxis: 'severities', periodDate: '2014-12-09T17:12:38+0100', @@ -250,7 +250,7 @@ casper.test.begin(testName('Unresolved Issues By Severity With IGNORED Different }) .then(function () { - casper.waitForSelector('#issue-filter-widget > table'); + casper.waitForSelector('#content > table'); }) .then(function () { diff --git a/server/sonar-web/src/test/js/quality-gates-spec.js b/server/sonar-web/src/test/js/quality-gates-spec.js index 5d5885c1975..7e20ede48da 100644 --- a/server/sonar-web/src/test/js/quality-gates-spec.js +++ b/server/sonar-web/src/test/js/quality-gates-spec.js @@ -5,7 +5,7 @@ describe('Quality Gates App', function () { it('should show list', 5, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -15,7 +15,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -37,7 +37,7 @@ describe('Quality Gates App', function () { it('should show details for anonymous', 14, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app-anonymous.json'); @@ -48,7 +48,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -90,7 +90,7 @@ describe('Quality Gates App', function () { it('should show details for admin', 12, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -101,7 +101,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -137,7 +137,7 @@ describe('Quality Gates App', function () { it('should show projects', 2, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/5'), function () { + .start(lib.buildUrl('base#show/5'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app-anonymous.json'); @@ -149,7 +149,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); }); }) @@ -167,7 +167,7 @@ describe('Quality Gates App', function () { it('should rename', 2, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/1'), function () { + .start(lib.buildUrl('base#show/1'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -179,7 +179,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -211,7 +211,7 @@ describe('Quality Gates App', function () { it('should copy', 3, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/1'), function () { + .start(lib.buildUrl('base#show/1'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -224,7 +224,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -257,7 +257,7 @@ describe('Quality Gates App', function () { it('should set as default', 4, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/5'), function () { + .start(lib.buildUrl('base#show/5'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -269,7 +269,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -295,7 +295,7 @@ describe('Quality Gates App', function () { it('should unset as default', 4, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/1'), function () { + .start(lib.buildUrl('base#show/1'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -307,7 +307,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -333,7 +333,7 @@ describe('Quality Gates App', function () { it('should create', 2, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -347,7 +347,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -387,7 +387,7 @@ describe('Quality Gates App', function () { it('should delete', 2, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/5'), function () { + .start(lib.buildUrl('base#show/5'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -400,7 +400,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -437,7 +437,7 @@ describe('Quality Gates App', function () { it('should add condition', 6, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/5'), function () { + .start(lib.buildUrl('base#show/5'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -450,7 +450,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -501,7 +501,7 @@ describe('Quality Gates App', function () { it('should update condition', 3, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/1'), function () { + .start(lib.buildUrl('base#show/1'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -514,7 +514,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); @@ -542,7 +542,7 @@ describe('Quality Gates App', function () { it('should delete condition', 1, function (casper, test) { return casper - .start(lib.buildUrl('quality_gates#show/1'), function () { + .start(lib.buildUrl('base#show/1'), function () { lib.setDefaultViewport(); lib.fmock('/api/qualitygates/app', 'app.json'); @@ -555,7 +555,7 @@ describe('Quality Gates App', function () { .then(function () { casper.evaluate(function () { require(['apps/quality-gates/app'], function (App) { - App.start({ el: '#quality-gates' }); + App.start({ el: '#content', urlRoot: '/pages/base' }); }); jQuery.ajaxSetup({ dataType: 'json' }); }); diff --git a/server/sonar-web/src/test/js/quality-profiles.js b/server/sonar-web/src/test/js/quality-profiles.js index 365206bb87c..2345c747f56 100644 --- a/server/sonar-web/src/test/js/quality-profiles.js +++ b/server/sonar-web/src/test/js/quality-profiles.js @@ -5,7 +5,7 @@ describe('Quality Profiles App', function () { it('should show list', 9, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user.json'); lib.fmock('/api/qualityprofiles/search', 'search.json'); @@ -15,7 +15,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -40,7 +42,7 @@ describe('Quality Profiles App', function () { it('should filter list by language', 15, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user.json'); @@ -51,7 +53,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -95,7 +99,7 @@ describe('Quality Profiles App', function () { it('should show details', 10, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user.json'); @@ -111,7 +115,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -141,7 +147,7 @@ describe('Quality Profiles App', function () { it('should show details for admin', 10, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -157,7 +163,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -187,7 +195,7 @@ describe('Quality Profiles App', function () { it('should show inheritance details', 10, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -202,7 +210,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -233,7 +243,7 @@ describe('Quality Profiles App', function () { it('should show selected projects', 2, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -247,7 +257,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -272,7 +284,7 @@ describe('Quality Profiles App', function () { it('should move between profiles', 1, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user.json'); @@ -286,7 +298,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -317,7 +331,7 @@ describe('Quality Profiles App', function () { it('should copy profile', 5, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -333,7 +347,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -371,7 +387,7 @@ describe('Quality Profiles App', function () { it('should rename profile', 2, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -387,7 +403,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -425,7 +443,7 @@ describe('Quality Profiles App', function () { it('should make profile default', 4, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -441,7 +459,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -473,7 +493,7 @@ describe('Quality Profiles App', function () { it('should delete profile', 2, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -489,7 +509,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -524,7 +546,7 @@ describe('Quality Profiles App', function () { it('should create profile', 1, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -538,7 +560,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -568,7 +592,7 @@ describe('Quality Profiles App', function () { it('should restore profile', 1, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -581,7 +605,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -604,7 +630,7 @@ describe('Quality Profiles App', function () { it('should show importers', 6, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -618,7 +644,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -658,7 +686,7 @@ describe('Quality Profiles App', function () { it('should restore built-in profiles', 3, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -674,7 +702,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -708,7 +738,7 @@ describe('Quality Profiles App', function () { it('should change profile\'s parent', 1, function (casper, test) { return casper - .start(lib.buildUrl('profiles'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -725,7 +755,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) @@ -764,7 +796,7 @@ describe('Quality Profiles App', function () { it('should open permalink', 9, function (casper, test) { return casper - .start(lib.buildUrl('profiles#show?key=java-sonar-way-67887'), function () { + .start(lib.buildUrl('base#show?key=java-sonar-way-67887'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user-admin.json'); @@ -777,7 +809,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -801,7 +835,7 @@ describe('Quality Profiles App', function () { it('should show changelog', 22, function (casper, test) { return casper - .start(lib.buildUrl('profiles#show?key=java-sonar-way-67887'), function () { + .start(lib.buildUrl('base#show?key=java-sonar-way-67887'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user.json'); @@ -820,7 +854,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -875,7 +911,7 @@ describe('Quality Profiles App', function () { it('should open changelog permalink', 2, function (casper, test) { return casper - .start(lib.buildUrl('profiles#changelog?since=2015-03-25&key=java-sonar-way-67887&to=2015-03-26'), function () { + .start(lib.buildUrl('base#changelog?since=2015-03-25&key=java-sonar-way-67887&to=2015-03-26'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user.json'); @@ -903,7 +939,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -925,7 +963,7 @@ describe('Quality Profiles App', function () { it('should show comparison', 12, function (casper, test) { return casper - .start(lib.buildUrl('profiles#show?key=java-sonar-way-67887'), function () { + .start(lib.buildUrl('base#show?key=java-sonar-way-67887'), function () { lib.setDefaultViewport(); lib.fmock('/api/users/current', 'user.json'); @@ -941,7 +979,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) @@ -975,7 +1015,7 @@ describe('Quality Profiles App', function () { it('should open comparison permalink', 4, function (casper, test) { return casper - .start(lib.buildUrl('profiles#compare?key=java-sonar-way-67887&withKey=java-copied-profile-11711'), + .start(lib.buildUrl('base#compare?key=java-sonar-way-67887&withKey=java-copied-profile-11711'), function () { lib.setDefaultViewport(); @@ -992,7 +1032,9 @@ describe('Quality Profiles App', function () { .then(function () { casper.evaluate(function () { - require(['apps/quality-profiles/app']); + require(['apps/quality-profiles/app'], function (App) { + App.start({ el: '#content', urlRoot: '/pages/base' }); + }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-coverage.js b/server/sonar-web/src/test/js/source-viewer-coverage.js index 9f15220e5bf..0a1965e82ea 100644 --- a/server/sonar-web/src/test/js/source-viewer-coverage.js +++ b/server/sonar-web/src/test/js/source-viewer-coverage.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName(), 12, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -43,8 +43,10 @@ casper.test.begin(testName(), 12, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-create-manual-issue.js b/server/sonar-web/src/test/js/source-viewer-create-manual-issue.js index ace652101fd..adbe170881a 100644 --- a/server/sonar-web/src/test/js/source-viewer-create-manual-issue.js +++ b/server/sonar-web/src/test/js/source-viewer-create-manual-issue.js @@ -29,7 +29,7 @@ lib.configureCasper(); casper.test.begin(testName('source-viewer-create-manual-issue'), function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -43,7 +43,10 @@ casper.test.begin(testName('source-viewer-create-manual-issue'), function (test) .then(function () { casper.evaluate(function () { - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-duplications.js b/server/sonar-web/src/test/js/source-viewer-duplications.js index e24fabfca75..14b5d3d714c 100644 --- a/server/sonar-web/src/test/js/source-viewer-duplications.js +++ b/server/sonar-web/src/test/js/source-viewer-duplications.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName(), 5, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json'); @@ -41,8 +41,10 @@ casper.test.begin(testName(), 5, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -87,7 +89,7 @@ casper.test.begin(testName(), 5, function (test) { casper.test.begin(testName('In Removed Component'), 2, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json', { data: { uuid: 'uuid' } }); @@ -98,8 +100,10 @@ casper.test.begin(testName('In Removed Component'), 2, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-favorite-spec.js b/server/sonar-web/src/test/js/source-viewer-favorite-spec.js index 3bc39b656ef..79a964f53df 100644 --- a/server/sonar-web/src/test/js/source-viewer-favorite-spec.js +++ b/server/sonar-web/src/test/js/source-viewer-favorite-spec.js @@ -29,7 +29,7 @@ lib.configureCasper(); casper.test.begin(testName('Mark as Favorite'), function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequest('/api/favourites', '{}', { type: 'POST' }); @@ -41,7 +41,10 @@ casper.test.begin(testName('Mark as Favorite'), function (test) { .then(function () { casper.evaluate(function () { - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -74,7 +77,7 @@ casper.test.begin(testName('Mark as Favorite'), function (test) { casper.test.begin(testName('Don\'t Show Favorite If Not Logged In'), function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app-not-logged-in.json'); @@ -84,7 +87,10 @@ casper.test.begin(testName('Don\'t Show Favorite If Not Logged In'), function (t .then(function () { casper.evaluate(function () { - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-issues.js b/server/sonar-web/src/test/js/source-viewer-issues.js index 7fca895a9ba..105d7751d4a 100644 --- a/server/sonar-web/src/test/js/source-viewer-issues.js +++ b/server/sonar-web/src/test/js/source-viewer-issues.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName(), 16, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -43,8 +43,10 @@ casper.test.begin(testName(), 16, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); jQuery.ajaxSetup({ dataType: 'json' }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-scm.js b/server/sonar-web/src/test/js/source-viewer-scm.js index 200419bbd9b..ce773b18c0e 100644 --- a/server/sonar-web/src/test/js/source-viewer-scm.js +++ b/server/sonar-web/src/test/js/source-viewer-scm.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName('SCM'), 4, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -41,8 +41,10 @@ casper.test.begin(testName('SCM'), 4, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-should-not-show-source-if-no-permission.js b/server/sonar-web/src/test/js/source-viewer-should-not-show-source-if-no-permission.js index 2c7de6dbb0c..98007e0c7a0 100644 --- a/server/sonar-web/src/test/js/source-viewer-should-not-show-source-if-no-permission.js +++ b/server/sonar-web/src/test/js/source-viewer-should-not-show-source-if-no-permission.js @@ -29,7 +29,7 @@ lib.configureCasper(); casper.test.begin(testName('source-viewer-should-not-show-source-if-no-permission'), function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -40,7 +40,10 @@ casper.test.begin(testName('source-viewer-should-not-show-source-if-no-permissio .then(function () { casper.evaluate(function () { - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) diff --git a/server/sonar-web/src/test/js/source-viewer-spec.js b/server/sonar-web/src/test/js/source-viewer-spec.js index bf734b93ce3..1b229ab7120 100644 --- a/server/sonar-web/src/test/js/source-viewer-spec.js +++ b/server/sonar-web/src/test/js/source-viewer-spec.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName('Base'), 14, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json', { data: { uuid: 'uuid' } }); @@ -40,8 +40,10 @@ casper.test.begin(testName('Base'), 14, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -81,7 +83,7 @@ casper.test.begin(testName('Base'), 14, function (test) { casper.test.begin(testName('Decoration'), 8, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json', { data: { uuid: 'uuid' } }); @@ -91,8 +93,10 @@ casper.test.begin(testName('Decoration'), 8, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -136,7 +140,7 @@ casper.test.begin(testName('Decoration'), 8, function (test) { casper.test.begin(testName('Test File'), 1, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); @@ -147,8 +151,10 @@ casper.test.begin(testName('Test File'), 1, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -172,7 +178,7 @@ casper.test.begin(testName('Test File'), 1, function (test) { casper.test.begin(testName('Highlight Usages'), 6, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json', { data: { uuid: 'uuid' } }); @@ -182,8 +188,10 @@ casper.test.begin(testName('Highlight Usages'), 6, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -216,7 +224,7 @@ casper.test.begin(testName('Highlight Usages'), 6, function (test) { casper.test.begin(testName('Line Permalink'), 1, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json', { data: { uuid: 'uuid' } }); @@ -226,8 +234,10 @@ casper.test.begin(testName('Line Permalink'), 1, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -259,7 +269,7 @@ casper.test.begin(testName('Line Permalink'), 1, function (test) { casper.test.begin(testName('Link to Raw'), 1, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json', { data: { uuid: 'uuid' } }); @@ -269,8 +279,10 @@ casper.test.begin(testName('Link to Raw'), 1, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -302,7 +314,7 @@ casper.test.begin(testName('Link to Raw'), 1, function (test) { casper.test.begin(testName('Details'), 15, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json', { data: { uuid: 'uuid' } }); @@ -315,8 +327,10 @@ casper.test.begin(testName('Details'), 15, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -370,7 +384,7 @@ casper.test.begin(testName('Details'), 15, function (test) { casper.test.begin(testName('Details', 'Tests'), 41, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app-test.json', { data: { uuid: 'uuid' } }); @@ -388,8 +402,10 @@ casper.test.begin(testName('Details', 'Tests'), 41, function (test) { .then(function () { casper.evaluate(function () { - window.file = { uuid: 'uuid', key: 'key' }; - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) diff --git a/server/sonar-web/src/test/js/workspace.js b/server/sonar-web/src/test/js/workspace.js index ee2dc2b3aa4..19f5b4fe64b 100644 --- a/server/sonar-web/src/test/js/workspace.js +++ b/server/sonar-web/src/test/js/workspace.js @@ -30,7 +30,7 @@ lib.configureCasper(); casper.test.begin(testName('Open From Component Viewer'), 8, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json'); @@ -41,7 +41,10 @@ casper.test.begin(testName('Open From Component Viewer'), 8, function (test) { .then(function () { casper.evaluate(function () { window.localStorage.removeItem('sonarqube-workspace'); - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -89,7 +92,7 @@ casper.test.begin(testName('Open From Component Viewer'), 8, function (test) { casper.test.begin(testName('Load From Local Storage'), 7, function (test) { casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json'); @@ -102,8 +105,9 @@ casper.test.begin(testName('Load From Local Storage'), 7, function (test) { window.localStorage.setItem('sonarqube-workspace', '[{"uuid":"12345","type":"component","name":"Cache.java","q":"FIL"}]'); window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) @@ -142,7 +146,7 @@ casper.test.begin(testName('Load From Local Storage'), 7, function (test) { casper.test.begin(testName('Close From Nav'), 2, function (test) { casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json'); @@ -155,8 +159,9 @@ casper.test.begin(testName('Close From Nav'), 2, function (test) { window.localStorage.setItem('sonarqube-workspace', '[{"uuid":"12345","type":"component","name":"Cache.java","q":"FIL"}]'); window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) @@ -187,7 +192,7 @@ casper.test.begin(testName('Close From Nav'), 2, function (test) { casper.test.begin(testName('Minimize'), 2, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json'); @@ -198,7 +203,10 @@ casper.test.begin(testName('Minimize'), 2, function (test) { .then(function () { casper.evaluate(function () { window.localStorage.removeItem('sonarqube-workspace'); - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -235,7 +243,7 @@ casper.test.begin(testName('Minimize'), 2, function (test) { casper.test.begin(testName('Full Screen'), 6, function (test) { casper - .start(lib.buildUrl('source-viewer'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/components/app', 'app.json'); @@ -246,7 +254,10 @@ casper.test.begin(testName('Full Screen'), 6, function (test) { .then(function () { casper.evaluate(function () { window.localStorage.removeItem('sonarqube-workspace'); - require(['apps/source-viewer/app']); + var file = { uuid: 'uuid', key: 'key' }; + require(['apps/source-viewer/app'], function (App) { + App.start({ el: '#content', file: file }); + }); }); }) @@ -290,7 +301,7 @@ casper.test.begin(testName('Full Screen'), 6, function (test) { casper.test.begin(testName('Rule'), 3, function (test) { casper - .start(lib.buildUrl('nav'), function () { + .start(lib.buildUrl('base'), function () { lib.setDefaultViewport(); lib.mockRequestFromFile('/api/rules/show', 'rule.json'); @@ -301,8 +312,9 @@ casper.test.begin(testName('Rule'), 3, function (test) { window.localStorage.setItem('sonarqube-workspace', '[{"key":"common-java:InsufficientBranchCoverage","type":"rule"}]'); window.SS.isUserAdmin = false; - window.navbarOptions = new Backbone.Model(); - require(['apps/nav/app']); + require(['apps/nav/app'], function (App) { + App.start(); + }); }); }) diff --git a/server/sonar-web/src/test/views/api_documentation.jade b/server/sonar-web/src/test/views/api_documentation.jade deleted file mode 100644 index 63789f5b1cb..00000000000 --- a/server/sonar-web/src/test/views/api_documentation.jade +++ /dev/null @@ -1,4 +0,0 @@ -extends layouts/main - -block body - .search-navigator.sticky#api-documentation diff --git a/server/sonar-web/src/test/views/coding-rules.jade b/server/sonar-web/src/test/views/coding-rules.jade deleted file mode 100644 index 038fd85901c..00000000000 --- a/server/sonar-web/src/test/views/coding-rules.jade +++ /dev/null @@ -1,4 +0,0 @@ -extends layouts/main - -block body - .coding-rules.search-navigator diff --git a/server/sonar-web/src/test/views/issue-filter-widget.jade b/server/sonar-web/src/test/views/issue-filter-widget.jade deleted file mode 100644 index d0097d07a9d..00000000000 --- a/server/sonar-web/src/test/views/issue-filter-widget.jade +++ /dev/null @@ -1,4 +0,0 @@ -extends layouts/main - -block body - #issue-filter-widget diff --git a/server/sonar-web/src/test/views/issues-context.jade b/server/sonar-web/src/test/views/issues-context.jade deleted file mode 100644 index bb823c330a4..00000000000 --- a/server/sonar-web/src/test/views/issues-context.jade +++ /dev/null @@ -1,4 +0,0 @@ -extends layouts/main - -block body - .issues.search-navigator diff --git a/server/sonar-web/src/test/views/issues.jade b/server/sonar-web/src/test/views/issues.jade deleted file mode 100644 index bb823c330a4..00000000000 --- a/server/sonar-web/src/test/views/issues.jade +++ /dev/null @@ -1,4 +0,0 @@ -extends layouts/main - -block body - .issues.search-navigator diff --git a/server/sonar-web/src/test/views/layouts/main.jade b/server/sonar-web/src/test/views/layouts/main.jade index 9c286d1c58b..3b971677908 100644 --- a/server/sonar-web/src/test/views/layouts/main.jade +++ b/server/sonar-web/src/test/views/layouts/main.jade @@ -69,6 +69,8 @@ html requirejs.config({ baseUrl: baseUrl + '/js' }); block header body + .navbar.navbar-global + .navbar.navbar-context #body #content block body diff --git a/server/sonar-web/src/test/views/nav.jade b/server/sonar-web/src/test/views/nav.jade deleted file mode 100644 index 6980b5e34ad..00000000000 --- a/server/sonar-web/src/test/views/nav.jade +++ /dev/null @@ -1,5 +0,0 @@ -extends layouts/main - -block body - .navbar.navbar-global - .navbar.navbar-context diff --git a/server/sonar-web/src/test/views/profiles.jade b/server/sonar-web/src/test/views/profiles.jade deleted file mode 100644 index 1c87e17bf2f..00000000000 --- a/server/sonar-web/src/test/views/profiles.jade +++ /dev/null @@ -1,4 +0,0 @@ -extends layouts/main - -block body - .search-navigator#quality-profiles diff --git a/server/sonar-web/src/test/views/quality_gates.jade b/server/sonar-web/src/test/views/quality_gates.jade deleted file mode 100644 index 5e068786798..00000000000 --- a/server/sonar-web/src/test/views/quality_gates.jade +++ /dev/null @@ -1,4 +0,0 @@ -extends layouts/main - -block body - .search-navigator.sticky.search-navigator-extended-view#quality-gates diff --git a/server/sonar-web/src/test/views/source-viewer.jade b/server/sonar-web/src/test/views/source-viewer.jade deleted file mode 100644 index 5680a36a32b..00000000000 --- a/server/sonar-web/src/test/views/source-viewer.jade +++ /dev/null @@ -1,10 +0,0 @@ -extends layouts/main - -block body - #source-viewer - - script. - window.file = { - uuid: '', - key: '' - }; |