Author: Kris.Wallsmith
Date: 2010-02-10 20:00:00 +0100 (Wed, 10 Feb 2010)
New Revision: 27836

Modified:
   branches/1.3/lib/util/sfBrowserBase.class.php
   branches/1.3/test/unit/util/sfBrowserTest.php
   branches/1.4/lib/util/sfBrowserBase.class.php
   branches/1.4/test/unit/util/sfBrowserTest.php
Log:
[1.3, 1.4] fixed submission of disable form fields by browser (closes #8178)

Modified: branches/1.3/lib/util/sfBrowserBase.class.php
===================================================================
--- branches/1.3/lib/util/sfBrowserBase.class.php       2010-02-10 18:30:14 UTC 
(rev 27835)
+++ branches/1.3/lib/util/sfBrowserBase.class.php       2010-02-10 19:00:00 UTC 
(rev 27836)
@@ -805,6 +805,11 @@
     $xpath = $this->getResponseDomXpath();
     foreach ($xpath->query('descendant::input | descendant::textarea | 
descendant::select', $item) as $element)
     {
+      if ($element->hasAttribute('disabled'))
+      {
+        continue;
+      }
+
       $elementName = $element->getAttribute('name');
       $nodeName    = $element->nodeName;
       $value       = null;

Modified: branches/1.3/test/unit/util/sfBrowserTest.php
===================================================================
--- branches/1.3/test/unit/util/sfBrowserTest.php       2010-02-10 18:30:14 UTC 
(rev 27835)
+++ branches/1.3/test/unit/util/sfBrowserTest.php       2010-02-10 19:00:00 UTC 
(rev 27836)
@@ -10,7 +10,7 @@
 
 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
 
-$t = new lime_test(70);
+$t = new lime_test(71);
 
 // ->click()
 $t->diag('->click()');
@@ -56,6 +56,7 @@
     <form action="/myform" method="post">
       <input type="text" name="text_default_value" value="default" />
       <input type="text" name="text" value="" />
+      <input type="text" name="i_am_disabled" value="i_am_disabled" 
disabled="disabled" />
       <textarea name="textarea">content</textarea>
       <select name="select">
         <option value="first">first</option>
@@ -223,6 +224,7 @@
 $t->is($parameters['article']['title'], 'mytitle', '->click() can override 
array fields');
 $t->is($parameters['article']['category'], array(1, 2, 3), '->click() can 
override array fields');
 $t->is($parameters['article']['or']['much']['longer'], 'long', '->click() 
recognizes array names');
+$t->is(isset($parameters['i_am_disabled']), false, '->click() ignores disabled 
fields');
 
 list($method, $uri, $parameters) = $b->click('#clickable-link');
 $t->is($method, 'get', '->click() accepts a CSS selector');

Modified: branches/1.4/lib/util/sfBrowserBase.class.php
===================================================================
--- branches/1.4/lib/util/sfBrowserBase.class.php       2010-02-10 18:30:14 UTC 
(rev 27835)
+++ branches/1.4/lib/util/sfBrowserBase.class.php       2010-02-10 19:00:00 UTC 
(rev 27836)
@@ -805,6 +805,11 @@
     $xpath = $this->getResponseDomXpath();
     foreach ($xpath->query('descendant::input | descendant::textarea | 
descendant::select', $item) as $element)
     {
+      if ($element->hasAttribute('disabled'))
+      {
+        continue;
+      }
+
       $elementName = $element->getAttribute('name');
       $nodeName    = $element->nodeName;
       $value       = null;

Modified: branches/1.4/test/unit/util/sfBrowserTest.php
===================================================================
--- branches/1.4/test/unit/util/sfBrowserTest.php       2010-02-10 18:30:14 UTC 
(rev 27835)
+++ branches/1.4/test/unit/util/sfBrowserTest.php       2010-02-10 19:00:00 UTC 
(rev 27836)
@@ -10,7 +10,7 @@
 
 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
 
-$t = new lime_test(70);
+$t = new lime_test(71);
 
 // ->click()
 $t->diag('->click()');
@@ -56,6 +56,7 @@
     <form action="/myform" method="post">
       <input type="text" name="text_default_value" value="default" />
       <input type="text" name="text" value="" />
+      <input type="text" name="i_am_disabled" value="i_am_disabled" 
disabled="disabled" />
       <textarea name="textarea">content</textarea>
       <select name="select">
         <option value="first">first</option>
@@ -223,6 +224,7 @@
 $t->is($parameters['article']['title'], 'mytitle', '->click() can override 
array fields');
 $t->is($parameters['article']['category'], array(1, 2, 3), '->click() can 
override array fields');
 $t->is($parameters['article']['or']['much']['longer'], 'long', '->click() 
recognizes array names');
+$t->is(isset($parameters['i_am_disabled']), false, '->click() ignores disabled 
fields');
 
 list($method, $uri, $parameters) = $b->click('#clickable-link');
 $t->is($method, 'get', '->click() accepts a CSS selector');

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to