[limb-svn] r6544 - in 3.x/trunk/limb/wact: src/components/form tests/cases/component/form

svn at limb-project.com svn at limb-project.com
Fri Nov 23 17:50:07 MSK 2007


Author: serega
Date: 2007-11-23 17:50:06 +0300 (Fri, 23 Nov 2007)
New Revision: 6544
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6544

Modified:
   3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php
   3.x/trunk/limb/wact/src/components/form/error.inc.php
   3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php
Log:
-- fixed WactCheckableInputComponent for case when "value" attribute has 0 value and real field value is set

Modified: 3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php	2007-11-23 07:36:34 UTC (rev 6543)
+++ 3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php	2007-11-23 14:50:06 UTC (rev 6544)
@@ -40,7 +40,7 @@
       return true;
     elseif(is_scalar($value) && $value && $value == $this->getAttribute('value'))
       return true;
-    elseif($value && !$this->getAttribute('value'))
+    elseif($value && !$this->hasAttribute('value'))
       return true;
     elseif($this->hasAttribute('checked') && is_null($value))
       return true;

Modified: 3.x/trunk/limb/wact/src/components/form/error.inc.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/error.inc.php	2007-11-23 07:36:34 UTC (rev 6543)
+++ 3.x/trunk/limb/wact/src/components/form/error.inc.php	2007-11-23 14:50:06 UTC (rev 6544)
@@ -42,7 +42,9 @@
     else
       return $field_name;
   }
-}class WactFormErrorList extends ArrayIterator
+}
+
+class WactFormErrorList extends ArrayIterator
 {
   protected $field_name_dictionary;
 

Modified: 3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php	2007-11-23 07:36:34 UTC (rev 6543)
+++ 3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php	2007-11-23 14:50:06 UTC (rev 6544)
@@ -73,5 +73,13 @@
 
     $this->assertFalse($this->checkbox->isChecked());
   }
+  
+  function testNotCheckedIfValueAttributeIsZero()
+  {
+    $this->form->set('my_checkbox', 3);
+    $this->checkbox->setAttribute('value', 0);
+
+    $this->assertFalse($this->checkbox->isChecked());
+  }  
 }
 



More information about the limb-svn mailing list