Development

Changeset 11021 for branches/1.0

You must first sign up to be able to contribute.

Changeset 11021 for branches/1.0

Show
Ignore:
Timestamp:
08/21/08 17:34:34 (3 months ago)
Author:
fabien
Message:

[1.0] fixed sfBrowser doesn't send checked checkedboxes without value attributes correctly (closes #4230)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/util/sfBrowser.class.php

    r10950 r11021  
    362362        if ($element->getAttribute('checked')) 
    363363        { 
    364           $value = $element->getAttribute('value')
     364          $value = $element->hasAttribute('value') ? $element->getAttribute('value') : '1'
    365365        } 
    366366      } 
  • branches/1.0/test/unit/util/sfBrowserTest.php

    r10950 r11021  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(44, new lime_output_color()); 
     13$t = new lime_test(46, new lime_output_color()); 
    1414 
    1515// ->click() 
     
    6868      <input name="myarray[]" value="value2" /> 
    6969      <input name="myarray[]" value="value3" /> 
     70      <input type="checkbox" name="checkbox1" value="checkboxvalue" checked="checked" /> 
     71      <input type="checkbox" name="checkbox2" checked="checked" /> 
    7072      <input type="button" name="mybutton" value="mybuttonvalue" /> 
    7173      <input type="submit" name="submit" value="submit" /> 
     
    147149$t->ok(!isset($parameters['mybutton']), '->click() do not populate buttons not clicked'); 
    148150$t->is($parameters['myarray'], array('value1', 'value2', 'value3'), '->click() recognizes array names'); 
     151$t->is($parameters['checkbox1'], 'checkboxvalue', '->click() returns the value of the checkbox value attribute'); 
     152$t->is($parameters['checkbox2'], '1', '->click() returns 1 if the checkbox has no value'); 
    149153 
    150154list($method, $uri, $parameters) = $b->click('mybuttonvalue');