[Zope3-checkins] SVN: Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/ - change the way options are reported for single-unvalued checkbox controls

Benji York benji at zope.com
Wed Jul 27 17:42:44 EDT 2005


Log message for revision 37501:
  - change the way options are reported for single-unvalued checkbox controls
  - other minor tweaks
  

Changed:
  U   Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/README.txt
  U   Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/browser.py
  U   Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/ftests/simple.html

-=-
Modified: Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/README.txt
===================================================================
--- Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/README.txt	2005-07-27 21:27:30 UTC (rev 37500)
+++ Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/README.txt	2005-07-27 21:42:44 UTC (rev 37501)
@@ -31,7 +31,7 @@
       </body>
     </html>
 
-Making assertions about page contents are easy.
+Making assertions about page contents is easy.
 
     >>> 'Simple Page' in browser.contents
     True
@@ -488,7 +488,7 @@
     >>> ctrl.multiple
     True
     >>> ctrl.options
-    ['on']
+    [True]
 
   - Checkbox Control (Single-Valued, Valued)
 

Modified: Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/browser.py
===================================================================
--- Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/browser.py	2005-07-27 21:27:30 UTC (rev 37500)
+++ Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/browser.py	2005-07-27 21:42:44 UTC (rev 37501)
@@ -213,7 +213,7 @@
 
         def fget(self):
             value = self.mech_control.value
-            if self.type == 'checkbox' and self.options == ['on']:
+            if self.type == 'checkbox' and self.options == [True]:
                 value = bool(value)
             return value
 
@@ -221,7 +221,7 @@
             if self.mech_control.type == 'file':
                 self.mech_control.add_file(value)
                 return
-            if self.type == 'checkbox' and self.options == ['on']:
+            if self.type == 'checkbox' and self.options == [True]:
                 if value: 
                     value = ['on']
                 else:
@@ -235,6 +235,9 @@
     @property
     def options(self):
         """See zope.app.testing.testbrowser.interfaces.IControl"""
+        if (self.type == 'checkbox'
+        and self.mech_control.possible_items() == ['on']):
+            return [True]
         try:
             return self.mech_control.possible_items()
         except:

Modified: Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/ftests/simple.html
===================================================================
--- Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/ftests/simple.html	2005-07-27 21:27:30 UTC (rev 37500)
+++ Zope3/branches/testbrowser-integration/src/zope/app/testing/testbrowser/ftests/simple.html	2005-07-27 21:42:44 UTC (rev 37501)
@@ -5,4 +5,4 @@
   <body>
     <h1>Simple Page</h1>
   </body>
-</html>
\ No newline at end of file
+</html>



More information about the Zope3-Checkins mailing list