diff options
-rw-r--r-- | server/sonar-web/Gruntfile.coffee | 6 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/app.js (renamed from server/sonar-web/src/main/js/apps/issues/app-new.js) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb | 2 | ||||
-rw-r--r-- | server/sonar-web/src/test/json/issues-spec/filter.json | 9 | ||||
-rw-r--r-- | server/sonar-web/test/intern.js | 3 | ||||
-rw-r--r-- | server/sonar-web/test/medium/issues.spec.js | 65 |
6 files changed, 78 insertions, 7 deletions
diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee index 18a37e1349b..8e61d0b9553 100644 --- a/server/sonar-web/Gruntfile.coffee +++ b/server/sonar-web/Gruntfile.coffee @@ -94,10 +94,6 @@ module.exports = (grunt) -> baseUrl: '<%= BUILD_PATH %>/js/' preserveLicenseComments: false - issues: options: - name: 'apps/issues/app-new' - out: '<%= ASSETS_PATH %>/js/apps/issues/app-new.js' - issuesContext: options: name: 'apps/issues/app-context' out: '<%= ASSETS_PATH %>/js/apps/issues/app-context.js' @@ -126,6 +122,7 @@ module.exports = (grunt) -> 'build-app:computation' 'build-app:drilldown' 'build-app:groups' + 'build-app:issues' 'build-app:maintenance' 'build-app:markdown' 'build-app:measures' @@ -140,7 +137,6 @@ module.exports = (grunt) -> # widgets 'build-widget:issue-filter' # other - 'requirejs:issues' 'requirejs:issuesContext' 'requirejs:selectList' ] diff --git a/server/sonar-web/src/main/js/apps/issues/app-new.js b/server/sonar-web/src/main/js/apps/issues/app.js index 12e5671c5c3..12e5671c5c3 100644 --- a/server/sonar-web/src/main/js/apps/issues/app-new.js +++ b/server/sonar-web/src/main/js/apps/issues/app.js 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 1cf75f1d41f..0c105bbd322 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,6 +1,6 @@ <% content_for :extra_script do %> <script> - require(['apps/issues/app-new'], function (App) { + require(['apps/issues/app'], function (App) { App.start({ el: '#content' }); }); </script> diff --git a/server/sonar-web/src/test/json/issues-spec/filter.json b/server/sonar-web/src/test/json/issues-spec/filter.json new file mode 100644 index 00000000000..6b6ecfef664 --- /dev/null +++ b/server/sonar-web/src/test/json/issues-spec/filter.json @@ -0,0 +1,9 @@ +{ + "filter": { + "id": 31, + "name": "Critical and Blocker Issues", + "shared": true, + "query": "resolved=false|severities=BLOCKER,CRITICAL", + "canModify": true + } +} diff --git a/server/sonar-web/test/intern.js b/server/sonar-web/test/intern.js index 17cab286e7d..5df2a74da06 100644 --- a/server/sonar-web/test/intern.js +++ b/server/sonar-web/test/intern.js @@ -20,7 +20,8 @@ define(['intern'], function (intern) { ], functionalSuites: [ - 'test/medium/users.spec' + 'test/medium/users.spec', + 'test/medium/issues.spec' ], tunnel: tunnel, diff --git a/server/sonar-web/test/medium/issues.spec.js b/server/sonar-web/test/medium/issues.spec.js new file mode 100644 index 00000000000..4987c91aa4c --- /dev/null +++ b/server/sonar-web/test/medium/issues.spec.js @@ -0,0 +1,65 @@ +define(function (require) { + var bdd = require('intern!bdd'); + require('../helpers/test-page'); + + bdd.describe('Issues Page', function () { + bdd.describe('Saved Searches', function () { + bdd.it('should show list of saved searches', function () { + return this.remote + .get(require.toUrl('test/medium/base.html')) + .setFindTimeout(5000) + .mockFromString('/api/l10n/index', '{}') + .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') + .mockFromFile('/api/issues/search', 'issues-spec/search.json') + .startApp('issues') + .assertElementCount('.js-filter', 2) + .assertElementCount('.js-filter[data-id="31"]', 1) + .assertElementCount('.js-filter[data-id="32"]', 1); + }); + + bdd.it('should load a saved search', function () { + return this.remote + .get(require.toUrl('test/medium/base.html')) + .setFindTimeout(5000) + .mockFromString('/api/l10n/index', '{}') + .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') + .mockFromFile('/api/issues/search', 'issues-spec/search.json') + .mockFromFile('/api/issue_filters/show/31', 'issues-spec/filter.json') + .startApp('issues') + .clickElement('.search-navigator-filters-show-list') + .clickElement('.js-filter[data-id="31"]') + .assertElementCount('.js-filter-copy', 1) + .assertElementCount('.js-filter-edit', 1) + .assertElementInclude('.issues-filters-name', 'Critical and Blocker Issues') + .assertElementCount('.js-facet.active[data-value="BLOCKER"]', 1) + .assertElementCount('.js-facet.active[data-value="CRITICAL"]', 1) + .assertElementCount('.js-facet.active[data-unresolved]', 1); + }); + + bdd.it('should load a saved search and then resets it by new search', function () { + return this.remote + .get(require.toUrl('test/medium/base.html')) + .setFindTimeout(5000) + .mockFromString('/api/l10n/index', '{}') + .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') + .mockFromFile('/api/issues/search', 'issues-spec/search.json') + .mockFromFile('/api/issue_filters/show/31', 'issues-spec/filter.json') + .startApp('issues') + .clickElement('.search-navigator-filters-show-list') + .clickElement('.js-filter[data-id="31"]') + .assertElementCount('.js-filter-copy', 1) + .assertElementCount('.js-filter-edit', 1) + .assertElementInclude('.issues-filters-name', 'Critical and Blocker Issues') + .assertElementCount('.js-facet.active[data-value="BLOCKER"]', 1) + .assertElementCount('.js-facet.active[data-value="CRITICAL"]', 1) + .assertElementCount('.js-facet.active[data-unresolved]', 1) + .clickElement('.js-new-search') + .assertElementCount('.js-facet[data-value="BLOCKER"]:not(.active)', 1) + .assertElementCount('.js-facet[data-value="CRITICAL"]:not(.active)', 1) + .assertElementCount('.js-facet.active[data-unresolved]', 1) + .assertElementNotInclude('.issues-filters-name', 'Critical and Blocker Issues'); + }); + }); + }); + +}); |