]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5209 Tests feedback applied
authorStas Vilchik <vilchiks@gmail.com>
Wed, 11 Jun 2014 06:27:01 +0000 (12:27 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 11 Jun 2014 06:27:01 +0000 (12:27 +0600)
sonar-server/src/main/coffee/component-viewer/covered-files-popup.coffee
sonar-server/src/main/coffee/component-viewer/main.coffee
sonar-server/src/main/hbs/component-viewer/header/covered-files-popup.hbs
sonar-server/src/main/hbs/component-viewer/header/tests-header.hbs
sonar-server/src/main/less/component-viewer.less

index 745aa699c142b261202504552f51b0d2a67035a9..ccf628a643488ee812da3a8892c66d3b0fde888b 100644 (file)
@@ -34,6 +34,8 @@ define [
 
 
     serializeData: ->
-      items: @collection.toJSON().map (file) ->
+      items = @collection.toJSON().map (file) ->
         _.extend file, utils.splitLongName file.longName
+      sortedItems = _.sortBy items, 'name'
+      items: sortedItems
       test: @options.test
index f3792415464cf72048121b8c8c8857b930aa0d0c..d4ec05e010953d2aff11607ce1b69254df239819 100644 (file)
@@ -50,11 +50,6 @@ define [
     'complexity,function_complexity,' +
     'comment_lines,comment_lines_density,public_api,public_undocumented_api,public_documented_api_density'
 
-  NEW_SOURCE_METRIC_LIST = 'new_accessors,classes,functions,statements,' +
-      'ncloc,lines,' +
-      'complexity,function_complexity,' +
-      'comment_lines,comment_lines_density,public_api,public_undocumented_api,public_documented_api_density'
-
   COVERAGE_METRIC_LIST = 'coverage,line_coverage,lines_to_cover,covered_lines,uncovered_lines,' +
     'branch_coverage,conditions_to_cover,uncovered_conditions,' +
     'it_coverage,it_line_coverage,it_lines_to_cover,it_covered_lines,it_uncovered_lines,' +
@@ -65,7 +60,7 @@ define [
 
   DUPLICATIONS_METRIC_LIST = 'duplicated_lines_density,duplicated_blocks,duplicated_files,duplicated_lines'
 
-  TESTS_METRIC_LIST = 'tests'
+  TESTS_METRIC_LIST = 'tests,test_success_density,test_failures,test_errors,test_execution_time'
 
 
 
@@ -206,7 +201,7 @@ define [
     requestTests: (key) ->
       $.get API_TESTS, key: key, (data) =>
         @state.set 'hasTests', true
-        @component.set 'tests', data.tests
+        @component.set 'tests', _.sortBy data.tests, 'name'
 
 
     open: (key) ->
index 43f904b0bd513436977668836c6849009709308c..e0a4d5f400217976a9240ed98cb0638e655779cf 100644 (file)
@@ -1,6 +1,13 @@
 <div class="component-viewer-popup-container">
 
-{{#eq test.status 'OK'}}
+{{#notEq test.status 'OK'}}
+  {{#if test.message}}
+      <div class="component-viewer-popup-title">{{test.message}}</div>
+  {{/if}}
+    <pre>{{test.stackTrace}}</pre>
+{{/notEq}}
+
+{{#notEq test.status 'ERROR'}}
   <div class="component-viewer-popup-title">{{t 'component_viewer.transition.covers'}}</div>
 
   {{#each items}}
   {{/each}}
 
   </div>
-{{else}}
-  {{#if test.message}}
-    <div class="component-viewer-popup-title">{{test.message}}</div>
-  {{/if}}
-  <pre>{{test.stackTrace}}</pre>
-{{/eq}}
+{{/notEq}}
 
 <div class="component-viewer-popup-arrow"></div>
\ No newline at end of file
index c19c7501c57be106a4631b9c588d4b5feefc1945..abda962f430317f0a0598a3046c8366a76bbdca0 100644 (file)
@@ -1,3 +1,21 @@
+{{#with component.measures}}
+  <span class="nowrap">
+    {{#any test_success_density test_failures test_errors test_execution_time}}
+      <div class="component-viewer-header-expanded-bar-section">
+        <div class="component-viewer-header-expanded-bar-section-title">
+          {{t 'component_viewer.measure_section.unit_tests'}}
+        </div>
+        <ul class="component-viewer-header-expanded-bar-section-list">
+          {{{componentViewerHeaderItem test_success_density 'test_success_density'}}}
+          {{{componentViewerHeaderItem test_failures 'test_failures'}}}
+          {{{componentViewerHeaderItem test_errors 'test_errors'}}}
+          {{{componentViewerHeaderItem test_execution_time 'test_execution_time'}}}
+        </ul>
+      </div>
+    {{/any}}
+  </span>
+{{/with}}
+
 <div class="component-viewer-header-expanded-bar-section large">
   <div class="component-viewer-header-expanded-bar-section-title justify">
     <span class="ib">{{t 'component_viewer.measure_section.unit_tests'}}</span>
   </div>
   <ul class="component-viewer-header-expanded-bar-section-list">
     {{#each component.tests}}
-      <li><a class="item js-unit-test" data-name="{{name}}">
-        <span class="label">{{testStatusIcon status}} <span class="subtitle">{{durationInMs}}ms</span>
+      <li><a class="item js-unit-test" data-name="{{name}}" title="{{name}}">
+        <span class="label">{{testStatusIcon status}}
+          <span class="duration subtitle">{{durationInMs}}ms</span>
           {{name}}</span>
-        {{#eq status 'OK'}}
+        {{#if coveredLines}}
           <span class="number">{{coveredLines}}</span>
-        {{/eq}}
+        {{/if}}
         <i class="icon-chevron-right"></i>
       </a></li>
     {{/each}}
index e5e1bc33ca47891fc9b60f21a6c93d4ba8735788..0113e875c51ee8bc6844c3ced3939e2aec3b7084 100644 (file)
       right: 10px;
       margin-top: -7px;
     }
+
+    .duration {
+      display: inline-block;
+      min-width: 40px;
+    }
   }
 
   & > li > a.item {