[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/ Fix bug, with test: checkbox control with a single checkbox obtained by name would not correctly report its disabled value.

Gary Poster gary at zope.com
Thu Dec 22 19:47:34 EST 2005


Log message for revision 40991:
  Fix bug, with test: checkbox control with a single checkbox obtained by name would not correctly report its disabled value.
  
  

Changed:
  U   Zope3/trunk/src/zope/testbrowser/README.txt
  U   Zope3/trunk/src/zope/testbrowser/browser.py
  U   Zope3/trunk/src/zope/testbrowser/ftests/controls.html

-=-
Modified: Zope3/trunk/src/zope/testbrowser/README.txt
===================================================================
--- Zope3/trunk/src/zope/testbrowser/README.txt	2005-12-22 23:16:31 UTC (rev 40990)
+++ Zope3/trunk/src/zope/testbrowser/README.txt	2005-12-23 00:47:33 UTC (rev 40991)
@@ -712,6 +712,9 @@
     False
     >>> ctrl.displayValue
     []
+    >>> browser.getControl(
+    ...     name='single-disabled-unvalued-checkbox-value').disabled
+    True
 
   - Checkbox Control (Single-Valued, Valued)
 

Modified: Zope3/trunk/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/browser.py	2005-12-22 23:16:31 UTC (rev 40990)
+++ Zope3/trunk/src/zope/testbrowser/browser.py	2005-12-23 00:47:33 UTC (rev 40991)
@@ -500,6 +500,12 @@
         return [i.name for i in self.mech_control.items if not i.disabled]
 
     @property
+    def disabled(self):
+        if self.type == 'checkbox' and len(self.mech_control.items) == 1:
+            return bool(getattr(self.mech_control.items[0], 'disabled', False))
+        return bool(getattr(self.mech_control, 'disabled', False))
+
+    @property
     def controls(self):
         if self._browser_counter != self.browser._counter:
             raise interfaces.ExpiredError

Modified: Zope3/trunk/src/zope/testbrowser/ftests/controls.html
===================================================================
--- Zope3/trunk/src/zope/testbrowser/ftests/controls.html	2005-12-22 23:16:31 UTC (rev 40990)
+++ Zope3/trunk/src/zope/testbrowser/ftests/controls.html	2005-12-23 00:47:33 UTC (rev 40991)
@@ -78,6 +78,18 @@
       </div>
 
       <div>
+        <em tal:condition="
+            request/single-disabled-unvalued-checkbox-value|nothing"
+            tal:content="request/single-disabled-unvalued-checkbox-value"></em>
+        <input type="checkbox" name="single-disabled-unvalued-checkbox-value" 
+               id="single-disabled-unvalued-checkbox" checked="checked"
+               disabled="disabled" />
+        <label for="single-disabled-unvalued-checkbox">
+          Single Disabled Unvalued Checkbox
+        </label>
+      </div>
+
+      <div>
         <em tal:condition="request/single-valued-checkbox-value|nothing"
             tal:content="request/single-valued-checkbox-value"></em>
         <label><input type="checkbox" name="single-valued-checkbox-value" 



More information about the Zope3-Checkins mailing list