aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/quality-profiles/controller.js34
-rw-r--r--server/sonar-web/src/test/js/quality-profiles.js43
2 files changed, 43 insertions, 34 deletions
diff --git a/server/sonar-web/src/main/js/quality-profiles/controller.js b/server/sonar-web/src/main/js/quality-profiles/controller.js
index a7071cde771..eb8222f8cb0 100644
--- a/server/sonar-web/src/main/js/quality-profiles/controller.js
+++ b/server/sonar-web/src/main/js/quality-profiles/controller.js
@@ -84,40 +84,6 @@ define([
fetchProfile: function (profile) {
return profile.fetch();
- },
-
- fetchProfileRules: function (profile) {
- var url = baseUrl + '/api/rules/search',
- key = profile.get('key'),
- options = {
- ps: 1,
- facets: 'severities,tags',
- qprofile: key,
- activation: 'true'
- };
- return $.get(url, options).done(function (r) {
- var severityFacet = _.findWhere(r.facets, { property: 'severities' });
- if (severityFacet != null) {
- var severities = severityFacet.values,
- severityComparator = function (s) {
- return window.severityColumnsComparator(s.val);
- },
- sortedSeverities = _.sortBy(severities, severityComparator);
- profile.set({ rulesSeverities: sortedSeverities });
- }
- });
- },
-
- fetchInheritance: function (profile) {
- var url = baseUrl + '/api/qualityprofiles/inheritance',
- options = { profileKey: profile.id };
- return $.get(url, options).done(function (r) {
- profile.set({
- ancestors: r.ancestors,
- children: r.children
- });
- profile.set(r.profile);
- });
}
});
diff --git a/server/sonar-web/src/test/js/quality-profiles.js b/server/sonar-web/src/test/js/quality-profiles.js
index eacb4e3d431..e8868fd340e 100644
--- a/server/sonar-web/src/test/js/quality-profiles.js
+++ b/server/sonar-web/src/test/js/quality-profiles.js
@@ -601,3 +601,46 @@ casper.test.begin(testName('Change Parent'), 1, function (test) {
test.done();
});
});
+
+
+casper.test.begin(testName('Permalink'), 9, function (test) {
+ casper
+ .start(lib.buildUrl('profiles#show?key=java-sonar-way-67887'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequestFromFile('/api/qualityprofiles/search', 'search.json');
+ lib.mockRequestFromFile('/api/rules/search', 'rules.json');
+ lib.mockRequestFromFile('/api/qualityprofiles/inheritance', 'inheritance.json');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/quality-profiles/app.js']);
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('#quality-profile-rename');
+ })
+
+ .then(function () {
+ test.assertElementCount('.js-list .list-group-item.active', 1);
+ test.assertSelectorContains('.js-list .list-group-item.active', 'Sonar way');
+
+ test.assertSelectorContains('.search-navigator-workspace-header', 'Sonar way');
+ test.assertSelectorContains('.search-navigator-workspace-header', 'Java');
+ test.assertExists('#quality-profile-backup');
+ test.assertExists('#quality-profile-rename');
+ test.assertExists('#quality-profile-copy');
+ test.assertDoesntExist('#quality-profile-delete');
+ test.assertDoesntExist('#quality-profile-set-as-default');
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});