[limb-svn] r6545 - 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:56:40 MSK 2007


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

Modified:
   3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php
   3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php
Log:
-- one more case for WactCheckableInputComponent when field has 0 value and "value" attribute has 0 value too

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 14:50:06 UTC (rev 6544)
+++ 3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php	2007-11-23 14:56:40 UTC (rev 6545)
@@ -46,6 +46,8 @@
       return true;
     elseif($value && $value != $this->getAttribute('value'))
       return false;
+    elseif(!$value && $this->hasAttribute('value') && !$this->getAttribute('value'))
+      return true;
 
     return false;
   }

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 14:50:06 UTC (rev 6544)
+++ 3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php	2007-11-23 14:56:40 UTC (rev 6545)
@@ -81,5 +81,13 @@
 
     $this->assertFalse($this->checkbox->isChecked());
   }  
+  
+  function testCheckedIfValueAndValueAttributeAreZero()
+  {
+    $this->form->set('my_checkbox', 0);
+    $this->checkbox->setAttribute('value', 0);
+
+    $this->assertTrue($this->checkbox->isChecked());
+  }    
 }
 



More information about the limb-svn mailing list