Development

Changeset 6129

You must first sign up to be able to contribute.

Changeset 6129

Show
Ignore:
Timestamp:
11/21/07 11:06:02 (1 year ago)
Author:
noel
Message:

sfBrowser : ->click() also search for HTML button elements (closes #2342)

Files:

Legend:

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

    r4750 r6129  
    334334    if (!$form = $xpath->query(sprintf('//input[((@type="submit" or @type="button") and @value="%s") or (@type="image" and @alt="%s")]/ancestor::form', $name, $name))->item(0)) 
    335335    { 
    336       throw new sfException(sprintf('Cannot find the "%s" link or button.', $name)); 
     336      if (!$form = $xpath->query(sprintf('//button[.="%s" or @id="%s" or @name="%s"]/ancestor::form', $name, $name, $name))->item(0)) 
     337      { 
     338        throw new sfException(sprintf('Cannot find the "%s" link or button.', $name)); 
     339      } 
    337340    } 
    338341 
  • branches/1.0/test/unit/util/sfBrowserTest.php

    r3277 r6129  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(42, new lime_output_color()); 
     13$t = new lime_test(43, new lime_output_color()); 
    1414 
    1515// ->click() 
     
    9393      </span></div> 
    9494    </form> 
     95 
     96    <form action="/myform5"> 
     97      <div><span> 
     98        <button  id="submit5">Click</button> 
     99        <input type="image" src="myimage.png" alt="image submit" name="submit_image" value="image" /> 
     100      </span></div> 
     101    </form> 
    95102  </body> 
    96103</html> 
     
    108115  $t->pass('->click() throws an error if the name does not exist'); 
    109116} 
     117 
     118try 
     119{ 
     120  list($method, $uri, $parameters) = $b->click('submit5'); 
     121  $t->pass('->click() clicks on button links'); 
     122} 
     123catch(Exception $e) 
     124{ 
     125  $t->fail('->click() clicks on button links'); 
     126} 
     127 
    110128 
    111129list($method, $uri, $parameters) = $b->click('test link');