My favorites | Sign in
Project Home Downloads Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 164: <cfsetting enablecfoutputonly="true"> breaks EXT2 output in browser
1 person starred this issue and may be notified of changes. Back to list
Status:  Deprecated
Owner:  ----
Closed:  Dec 2009
Cc:  virtix, marc.es...@gmail.com


 
Reported by john.wh...@googlemail.com, Oct 22, 2009
What steps will reproduce the problem?

1. Happens when running the tests in a browser of a generated application 
from ColdBox3 beta 2.

What is the expected output? What do you see instead?

EXT2 view is not working if you have <cfsetting enablecfoutputonly="true">. 
This is because only the code with <cfoutput> tags around it is being 
stored in the variable "strOutput" created with <cfsavecontent> in the getHTMLResults() method of EXTTestResult.cfc

What version of the product are you using? On what operating system?

ColdFusion 9 Developer edition, Windows XP PRO, Apache2, ColdBox 3 beta 2

Please provide any additional information below.

Fixed by changing getHTMLMethod() to:

<cfsavecontent variable="strOutput">
       <cfoutput>
   <script language="javascript">
   var a_output = new Array();
       </cfoutput>
     <cfloop from="1" to="#ArrayLen(results)#" index="i">
     <cfoutput>a_output[#i#] = '#stripDump(results[i].content)#'; </
cfoutput>
     <cfif ArrayLen(results[i].debug)>
       <cfsavecontent variable="debugcontent">
         <cfdump var="#results[i].debug#" label="Debug Output">
       </cfsavecontent>
       <cfoutput>a_output[#i#] = a_output[#i#] + '#stripDump
(debugcontent)#';</cfoutput>
     </cfif>
   </cfloop>

       <cfoutput>
   function showOutput(row){
     win = new Ext.Window(
       {
       autoScroll:true,
       modal:false,
       maximizable:true,
       title:"Debug Output",
       constrain:true,
       html:a_output[row]
       }
     );
     win.show();
   }


   Ext.onReady(function(){
     Ext.BLANK_IMAGE_URL = "#extroot#/resources/images/default/
s.gif";
       Ext.QuickTips.init();
       Ext.apply(Ext.QuickTips.getQuickTip(), {
         maxWidth: 500,
         minWidth: 100,
         showDelay: 100,
         trackMouse: true
     });

     var allData = [
        #resultsToJS(testresult.getResults())#
     ];

     var problemData = [
       #resultsToJS(testresult.getResults(),true)#
     ];

       var xg = Ext.grid;

       var reader = new Ext.data.ArrayReader({}, [
          {name: 'num', type: 'float'},
          {name: 'component'},
          {name: 'method'},
          {name: 'result'},
          {name: 'speed'},
          {name: 'errordetails'},
          {name: 'output'}
       ]);

     var ds = new Ext.data.GroupingStore(
       { reader: reader,
               data: allData,
               sortInfo:{field: 'num', direction: "ASC"},
               groupField:'component'
     });

     var view = new Ext.grid.GroupingView({
               forceFit:true,
               groupTextTpl: '{text} ({[values.rs.length]}
{[values.rs.length > 1 ? "Tests" : "Test"]})',
               hideGroupedColumn:true
           });

     function toggleProblemView(btn, pressed){
       if(pressed){
         ds.loadData(problemData,false);
       }else{
         ds.loadData(allData,false);
       }
     }

     function toggleExpandCollapse(btn, pressed){
       if(pressed){
         view.collapseAllGroups();
       }else{
         view.expandAllGroups();
       }
     }

       var grid = new xg.GridPanel({
           store: ds,
       view: view,

           columns: [
               <!--- {id:'num',header: "No.", width: 15, sortable:
true, dataIndex: 'num', hidden:true} ,  --->
               {header: "Component", width: 100, sortable: true,
dataIndex: 'component',renderer: renderComponent},
               {header: "Method", width: 100, sortable: true,
dataIndex: 'method'},
               {header: "Result", width: 40, sortable: true,
dataIndex: 'result', renderer: renderResult},
               {header: "Error Info", width: 100, sortable: false,
dataIndex: 'errordetails'},
               {header: "Speed (ms)", width:30, sortable: true,
dataIndex: 'speed', renderer: renderSpeed, align:'right'},
               {header: "Output", width: 40, sortable: false,
dataIndex: 'output', align:'center'}
           ],

           frame:true,
           width: 'auto',
           autoHeight: 'true',
           maxHeight: 500,
           autoExpandColumn: 'errordetails',
           collapsible: true,
           animCollapse: true,
           title: 'Test Results: #jsStringFormat
(arguments.DirectoryName)#',
           renderTo: "testresultsgrid_#UUID#",
           tbar: [
             {
             text:'Show Problems Only',
         enableToggle: true,
         pressed: false,
         toggleHandler: toggleProblemView,
         tooltip: "Show failures and errors only"
             },
             '-',
             {
             text: "Collapse All",
             enableToggle: true,
             pressed: false,
             toggleHandler: toggleExpandCollapse,
             tooltip: "Collapse or expand all"
             }
           ]
      });
   });

   function renderComponent(val){
     return "<span ext:qtip='"+val+"'>" + val + "</span>";
   }
   function renderResult(val){
     var newVal = val.toLowerCase();
     if(newVal.indexOf("error")>=0){
       return "<span class='error'>" + val + "</span>";
     }else if(newVal.indexOf("fail")>=0){
       return "<span class='failure'>" + val + "</span>";
     }
     return val;
   }
   function renderSpeed(val){
     if(val > 250){
       return "<span style='color:red;font-weight:bold'
ext:qtip='This test is slow'>" + val + "</span>";
     }
     return val
   }

   </script>

   <!--- begin body divs --->

   <div id="modelink_#UUID#" class="modelink">
     (<a href="?#normalizeQueryString(URL,'html')#">view in normal
html mode</a>)
   </div>

   <div align="center" id="header_#UUID#" class="header">
   <h1>Test Results</h1>

     <p>Failures: <span class="failure">#testresult.getFailures()#</
span> Errors: <span class="error">#testresult.getErrors()#</span>
Successes: <span class="success">#testresult.getSuccesses()#</span></
p>

   </div>

   <div id="testresultsgrid_#UUID#" class="bodypad"></div>
   </cfoutput>
   <!--- end body divs --->


   <cfdump var=" "><!--- need this to get the js and css in the page
--->
   </cfsavecontent>

   <cfreturn strOutput>
 </cffunction>

Dec 5, 2009
Project Member #1 marc.es...@gmail.com
Hey John, could you provide this fix as a patch file? (right click, team -- create
patch -- patchroot=project

I tried copying from this bug report but the whitespace is all messed up

Thanks!
Cc: virtix marc.esher
Jun 30, 2010
Project Member #2 virtix
Moving some, but not all, of these to jira.mxunit.org
Status: Deprecated

Powered by Google Project Hosting