]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5497 Add medium test for "Tag" filter restore, add marker attributes to ease...
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 30 Jul 2014 15:28:47 +0000 (17:28 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 30 Jul 2014 15:28:54 +0000 (17:28 +0200)
server/sonar-web/src/main/hbs/navigator/more-criteria-details-filter.hbs
server/sonar-web/src/main/js/navigator/filters/base-filters.js
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js

index 252cacc24760b4070a07ebf1f3574818b5bf6368..c56b0e7023d30ada2c85b8cb91a1ecbf05be5d15 100644 (file)
@@ -1,7 +1,7 @@
 <ul class="navigator-filter-select-list">
   {{#each filters}}
     <li>
-      <label data-id="{{id}}" {{#if inactive}}class="inactive"{{/if}} {{#if title}}title="{{title}}"{{/if}}>
+      <label data-id="{{id}}" data-property="{{property}}" {{#if inactive}}class="inactive"{{/if}} {{#if title}}title="{{title}}"{{/if}}>
         {{name}}
       </label>
     </li>
index abd81862283c76808697b0215c679e87b77ccaf8..b73a08e09288311ceff7bcfb69bc841321e128d0 100644 (file)
@@ -104,6 +104,7 @@ define([
 
       var title = this.model.get('name') + ': ' + this.renderValue();
       this.$el.prop('title', title);
+      this.$el.attr('data-property', this.model.get('property'));
     },
 
 
index b221a5c59ce368edfb907af1e4a8ec9694238284..750da1da56aa454ed76c2c1e8ada9c9db15d9ad8 100644 (file)
@@ -38,9 +38,9 @@ casper.test.begin(testName('Readonly Tests'), function suite(test) {
 
       casper.click('.navigator-filter-more-criteria');
       casper.waitUntilVisible('.navigator-filter-details.active', function checkTagsAreOrdered() {
-        casper.click('.navigator-filter-details.active li:nth-last-child(2) label');
-        test.assertSelectorHasText('.navigator-filter-details.active>.navigator-filter-select-list.choices>li:nth-child(1)', 'brain-overload');
-        test.assertSelectorHasText('.navigator-filter-details.active>.navigator-filter-select-list.choices>li:nth-child(11)', 'unused');
+        casper.click('.navigator-filter-details.active label[data-property="tags"]');
+        test.assertSelectorHasText('.navigator-filter[data-property="tags"] option:nth-child(1)', 'brain-overload');
+        test.assertSelectorHasText('.navigator-filter[data-property="tags"] option:nth-child(11)', 'unused');
         casper.click('.navigator-filter.active>.navigator-filter-disable');
       });
     });
@@ -269,3 +269,28 @@ casper.test.begin(testName('Activation Tests'), function suite(test) {
     test.done();
   });
 });
+
+
+casper.test.begin(testName('Tag Navigation Test'), function suite(test) {
+
+  casper.start(lib.buildUrl('coding-rules#tags=polop,bug,pilip,unused,palap'), function() {
+    lib.clearRequestMocks();
+    lib.mockRequest('/api/l10n/index', '{}');
+    lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
+    lib.mockRequestFromFile('/api/rules/tags', 'tags.json');
+    lib.mockRequestFromFile('/api/rules/search', 'search_x1.json');
+    lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
+  });
+
+
+  casper.waitWhileSelector("div#coding-rules-page-loader", function checkTagFilterRestored() {
+    casper.waitForSelector('.navigator-filters', function checkDefaultFilters() {
+      test.assertElementCount('.navigator-filter-disabled', 11 /* Tag is enabled */);
+      test.assertSelectorHasText('.navigator-filter[data-property="tags"] .navigator-filter-value', 'bug, unused');
+    });
+  });
+
+  casper.run(function() {
+    test.done();
+  });
+});