Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you write a functional / controller test to check for content added via an AJAX call?
    primarykey
    data
    text
    <p>Test</p> <pre><code>def test_generateCashFlowStmt get :getDateRangeForCashFlowStmt xhr :post, :generate_cash_flow_stmt, {:fromDate =&gt; {:year=&gt;"2009", :month =&gt; "3", :day=&gt;"1"}, :toDate =&gt; {:year=&gt;"2009", :month =&gt; "3", :day=&gt;"31"} } table = [ .... ] assert_equal table, formatCashFlowStatementAsTable( assigns(:cashFlowStmt)) assert_tag :tag =&gt; "div", :children =&gt; {:count =&gt; 1, :only =&gt; {:tag=&gt;"table"} } end </code></pre> <p>Controller Action</p> <pre><code>def generate_cash_flow_stmt puts params fromDate = Date.civil params[:fromDate]["year"].to_i, params[:fromDate]["month"].to_i, params[:fromDate]["day"].to_i toDate = Date.civil params[:toDate]["year"].to_i, params[:toDate]["month"].to_i, params[:toDate]["day"].to_i @cashFlowStmt = CashFlowStatement.new(fromDate, toDate) render :partial =&gt; "cash_flow_stmt", :layout =&gt; false end </code></pre> <p>View</p> <pre><code>&lt;% form_remote_tag(:loading =&gt; "Element.show('progress-indicator');", :update =&gt; "div_results", :complete =&gt; "Element.hide('progress-indicator');", :url=&gt;{:action=&gt;'generate_cash_flow_stmt'}) do %&gt; ... &lt;% end %&gt; &lt;div id="div_results"&gt; </code></pre> <p></p> <p>The test fails at the last check, where I check if the div content holder is populated with the table as a result of the call to generate_cash_flow_stmt access. Although I see the table being displayed in the browser, the 'View Source' action shows a blank div tag. What gives?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload