Open jkotests opened 11 years ago
Given the table:
<table cellspacing="0" cellpadding="5" rules="groups" frame="box" border="1" id="axis_example" summary="Hugh Laurie made more money than Gregory House in both March and April of 2008."> <caption>Income tax information for Gregory House and Hugh Laurie</caption> <colgroup width="25%" align="left"></colgroup> <colgroup width="25%" span="3" align="right"></colgroup> <thead id="tax_headers"> <tr style="border-bottom: 1px solid black;" class="dark" id="thead_row_1"> <th></th> <th id="before_tax" axis="cash" abbr="Before tax">Before income tax</th> <th id="tax" axis="cash" abbr="Tax">Income tax</th> <th id="after_tax" axis="cash" abbr="After tax">After income tax</th> </tr> </thead> <tfoot id="tax_totals"> <tr class="dark" id="tfoot_row_1"> <th axis="sum">Sum</th> <td headers="before_tax">24 349</td> <td headers="tax">5 577</td> <td headers="after_tax">18 722</td> </tr> </tfoot> <tbody id="first"> <tr id="march"> <th id="d1" axis="date" scope="rowgroup">March 2008</th> <th></th> <th></th> <th></th> </tr> <tr id="gregory"> <td id="p1" abbr="Dr. House">Gregory House</td> <td headers="before_tax p1 d1">5 934</td> <td headers="tax p1 d1">1 347</td> <td headers="after_tax p1 d1">4 587</td> </tr> <tr id="hugh"> <td id="p2" abbr="Laurie">Hugh Laurie</td> <td headers="before_tax p2 d1">6 300</td> <td headers="tax p2 d1">1 479</td> <td headers="after_tax p2 d1">4 821</td> </tr> </tbody> <tbody name="second" id="second"> <tr> <th id="d2" axis="date" scope="rowgroup">April 2008</th> <th></th> <th></th> <th></th> </tr> <tr> <td id="p3" abbr="Dr. House">Gregory House</td> <td headers="before_tax p3 d2">5 863</td> <td headers="tax p3 d2">1 331</td> <td headers="after_tax p3 d2">4 532</td> </tr> <tr> <td id="p4" abbr="Laurie">Hugh Laurie</td> <td headers="before_tax p4 d2">6 252</td> <td headers="tax p4 d2">1 420</td> <td headers="after_tax p4 d2">4 <span id="cell-child">832</span></td> </tr> </tbody> </table>
Then the code:
browser.table(:id => "axis_example").hashes
Returns:
[ {""=>"Sum", "Before income tax"=>"24 349", "Income tax"=>"5 577", "After income tax"=>"18 722"}, {""=>"March 2008", "Before income tax"=>"", "Income tax"=>"", "After income tax"=>""}, {""=>"Gregory House", "Before income tax"=>"5 934", "Income tax"=>"1 347", "After income tax"=>"4 587"}, {""=>"Hugh Laurie", "Before income tax"=>"6 300", "Income tax"=>"1 479", "After income tax"=>"4 821"}, {""=>"April 2008", "Before income tax"=>"", "Income tax"=>"", "After income tax"=>""}, {""=>"Gregory House", "Before income tax"=>"5 863", "Income tax"=>"1 331", "After income tax"=>"4 532"}, {""=>"Hugh Laurie", "Before income tax"=>"6 252", "Income tax"=>"1 420", "After income tax"=>"4 832"} ]
Instead of:
[ { "" => "March 2008", "Before income tax" => "", "Income tax" => "", "After income tax" => "" }, { "" => "Gregory House", "Before income tax" => "5 934", "Income tax" => "1 347", "After income tax" => "4 587" }, { "" => "Hugh Laurie", "Before income tax" => "6 300", "Income tax" => "1 479", "After income tax" => "4 821" }, { "" => "April 2008", "Before income tax" => "", "Income tax" => "", "After income tax" => "" }, { "" => "Gregory House", "Before income tax" => "5 863", "Income tax" => "1 331", "After income tax" => "4 532" }, { "" => "Hugh Laurie", "Before income tax" => "6 252", "Income tax" => "1 420", "After income tax" => "4 832" }, { "" => "Sum", "Before income tax" => "24 349", "Income tax" => "5 577", "After income tax" => "18 722"}, ]
Table#hashes is currently sorting based on the order that the trs appear in the html (unexpected). It should be based on the rowIndex (ie their actual display order).
Given the table:
Then the code:
Returns:
Instead of:
Table#hashes is currently sorting based on the order that the trs appear in the html (unexpected). It should be based on the rowIndex (ie their actual display order).