]> source.dussan.org Git - sonarqube.git/commitdiff
Add messages on tests component
authorJulien Lancelot <julien.lancelot@gmail.com>
Mon, 11 Feb 2013 18:13:44 +0000 (19:13 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Mon, 11 Feb 2013 18:14:01 +0000 (19:14 +0100)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb
sonar-server/src/main/webapp/javascripts/application.js

index 301b4e7734e853f021e2e576bc1e0f4e29a7b140..6e793f01f0567ec5e84a54ee4799f5ddca56feb7 100644 (file)
@@ -1173,6 +1173,8 @@ test_viewer.skipped=skipped
 test_viewer.expand=expand
 test_viewer.collapse=collapse
 test_viewer.covered_lines=Covered Lines
+test_viewer.tests_covering=Tests covering {0} on line {1}
+test_viewer.files_covered_by=Files covered by {0} ({1})
 
 
 #------------------------------------------------------------------------------
index 9af43f406b725a94c1059409d7c0a0e5b1d4971b..30b301a7bbe77cb1f18aaa6cdd4246daa82b3cb6 100644 (file)
@@ -1,7 +1,7 @@
 <div class="accordion-item">
   <div class="accordion-item-header">
     <div class="source_title">
-      <div class="subtitle">Tests covering <%= @testable.component.longName %> on line <%= @line %></div>
+      <div class="subtitle"><%= message('test_viewer.tests_covering', :params => {@testable.component.longName, @line}) %></div>
     </div>
   </div>
   <div class="accordion-item-body">
@@ -13,9 +13,7 @@
       <table class="data marginbottom10">
         <tbody>
         <% reset_cycle %>
-        <% test_cases.sort_by { |test_case| test_case.name }.each do |test_case|
-            reset_cycle
-        %>
+        <% test_cases.sort_by { |test_case| test_case.name }.each do |test_case| %>
           <tr class="<%= cycle('even', 'odd') -%>">
             <td class="thin" nowrap>
               <img src="<%= ApplicationController.root_context + "/images/test/" + test_case.status.name + ".png" -%>"/>
index f3a2f968311d14594da25561e1fdbd82260fbdcd..c82d5cabb8583de9047bce30dd29d990b703d0d0 100644 (file)
@@ -1,27 +1,26 @@
 <div class="accordion-item">
   <div class="accordion-item-header">
-    <h3>Files covered by <%= @test %> (<%= @test_plan.component.longName %>)</h3>
+    <h3><%= message('test_viewer.files_covered_by', :params => {@test, @test_plan.component.longName}) %></h3>
   </div>
   <br/>
   <div class="accordion-item-body">
     <table class="data">
       <thead>
       <tr>
-        <th>File</th>
-        <th>Covered Lines</th>
+        <th class="thin" nowrap><%= message('test_viewer.covered_lines') %></th>
+        <th><%= message('file') %></th>
       </tr>
       </thead>
       <tbody>
       <% @test_case.coverageBlocks.sort_by{|cover| cover.testable.component.name}.each do |cover|
-          reset_cycle
       %>
       <tr class="<%= cycle("even", "odd") -%>">
+        <td><%= cover.lines.size -%></td>
         <td>
           <a href="<%= ApplicationController.root_context -%>/resource/index/<%= cover.testable.component.key -%>?display_title=true&tab=coverage&coverage_filter=lines_covered_per_test&test_case_filter=<%= @test -%>"
              onclick="openAccordionItem(this.href, this); return false;"><%= cover.testable.component.longName -%>
           </a>
         </td>
-        <td><%= cover.lines.size -%></td>
       </tr>
       <% end %>
       </tbody>
index 57a73610582a3d2c4a6e493496239090e2873ce3..4d8f272d273920b58563c0e8f5d62d020ad0577a 100644 (file)
@@ -338,7 +338,9 @@ function openAccordionItem(url, elt, updateCurrentElement) {
     loading.hide();
   }
 
+  // Remove elements under current element
   if (currentElement.length) {
+    // Fix the height in order to not change the position on the screen when removing elements under current element
     var elementToRemove = currentElement.nextAll('.'+ htmlClass);
     if (elementToRemove.height()) {
       $j("#accordion-panel").height($j("#accordion-panel").height() + elementToRemove.height());
@@ -365,16 +367,18 @@ function openAccordionItem(url, elt, updateCurrentElement) {
     }
 
     if (updateCurrentElement) {
+      // Fix the height in order to not change the position on the screen
       var prev = $j("#accordion-panel").height();
       currentElement.replaceWith(html);
       if (prev > $j("#accordion-panel").height()) {
         $j("#accordion-panel").height(prev);
       }
     } else {
+      // Add new item add the end of the panel and restore the height param
       $j("#accordion-panel").append(html);
       $j("#accordion-panel").height('auto');
 
-      // Set the focus on the top of the current item
+      // Set the focus on the top of the current item with animation
       if (currentElement.length) {
         $j('html, body').animate({
           scrollTop: currentElement.offset().top},