Development

Changeset 11020

You must first sign up to be able to contribute.

Changeset 11020

Show
Ignore:
Timestamp:
08/21/08 17:32:42 (11 months ago)
Author:
fabien
Message:

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

Files:

Legend:

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

    r10950 r11020  
    567567        if ($element->getAttribute('checked')) 
    568568        { 
    569           $value = $element->getAttribute('value')
     569          $value = $element->hasAttribute('value') ? $element->getAttribute('value') : '1'
    570570        } 
    571571      } 
  • branches/1.1/test/unit/util/sfBrowserTest.php

    r10950 r11020  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(51, new lime_output_color()); 
     13$t = new lime_test(53, new lime_output_color()); 
    1414 
    1515// ->click() 
     
    7777      <input name="myarray[]" value="value3" /> 
    7878      <input type="file" name="myfile" /> 
     79      <input type="checkbox" name="checkbox1" value="checkboxvalue" checked="checked" /> 
     80      <input type="checkbox" name="checkbox2" checked="checked" /> 
    7981      <input type="button" name="mybutton" value="mybuttonvalue" /> 
    8082      <input type="submit" name="submit" value="submit" /> 
     
    157159$t->ok(!isset($parameters['mybutton']), '->click() do not populate buttons not clicked'); 
    158160$t->is($parameters['myarray'], array('value1', 'value2', 'value3'), '->click() recognizes array names'); 
     161$t->is($parameters['checkbox1'], 'checkboxvalue', '->click() returns the value of the checkbox value attribute'); 
     162$t->is($parameters['checkbox2'], '1', '->click() returns 1 if the checkbox has no value'); 
    159163 
    160164list($method, $uri, $parameters) = $b->click('mybuttonvalue'); 
  • branches/1.2/lib/util/sfBrowser.class.php

    r11019 r11020  
    631631        if ($element->getAttribute('checked')) 
    632632        { 
    633           $value = $element->getAttribute('value')
     633          $value = $element->hasAttribute('value') ? $element->getAttribute('value') : '1'
    634634        } 
    635635      } 
  • branches/1.2/test/unit/util/sfBrowserTest.php

    r11019 r11020  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(52, new lime_output_color()); 
     13$t = new lime_test(54, new lime_output_color()); 
    1414 
    1515// ->click() 
     
    7777      <input name="myarray[]" value="value3" /> 
    7878      <input type="file" name="myfile" /> 
     79      <input type="checkbox" name="checkbox1" value="checkboxvalue" checked="checked" /> 
     80      <input type="checkbox" name="checkbox2" checked="checked" /> 
    7981      <input type="button" name="mybutton" value="mybuttonvalue" /> 
    8082      <input type="submit" name="submit" value="submit" /> 
     
    162164$t->ok(!isset($parameters['mybutton']), '->click() do not populate buttons not clicked'); 
    163165$t->is($parameters['myarray'], array('value1', 'value2', 'value3'), '->click() recognizes array names'); 
     166$t->is($parameters['checkbox1'], 'checkboxvalue', '->click() returns the value of the checkbox value attribute'); 
     167$t->is($parameters['checkbox2'], '1', '->click() returns 1 if the checkbox has no value'); 
    164168 
    165169list($method, $uri, $parameters) = $b->click('mybuttonvalue'); 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.