[Zope3-checkins] SVN: Zope3/branches/3.3/ - Made zope.testbrowser report the selection state of ItemControls on

Christian Theune ct at gocept.com
Tue Aug 22 13:51:38 EDT 2006


Log message for revision 69729:
    - Made zope.testbrowser report the selection state of ItemControls on
      representations.
  

Changed:
  U   Zope3/branches/3.3/doc/CHANGES.txt
  U   Zope3/branches/3.3/src/zope/testbrowser/README.txt
  U   Zope3/branches/3.3/src/zope/testbrowser/browser.py

-=-
Modified: Zope3/branches/3.3/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.3/doc/CHANGES.txt	2006-08-22 14:47:57 UTC (rev 69728)
+++ Zope3/branches/3.3/doc/CHANGES.txt	2006-08-22 17:51:38 UTC (rev 69729)
@@ -21,6 +21,9 @@
 
     Bugfixes
 
+      - Made zope.testbrowser report the selection state of ItemControls on
+        representations.
+
       - Fixed a bug on unregistering handlers. When multiple handlers for one
         specification where registered, all of them would be removed when only
         a single one was unregistered.

Modified: Zope3/branches/3.3/src/zope/testbrowser/README.txt
===================================================================
--- Zope3/branches/3.3/src/zope/testbrowser/README.txt	2006-08-22 14:47:57 UTC (rev 69728)
+++ Zope3/branches/3.3/src/zope/testbrowser/README.txt	2006-08-22 17:51:38 UTC (rev 69729)
@@ -425,11 +425,11 @@
     >>> browser.getControl(name='radio-value')
     <ListControl name='radio-value' type='radio'>
     >>> browser.getControl('Zwei')
-    <ItemControl name='radio-value' type='radio' optionValue='2'>
+    <ItemControl name='radio-value' type='radio' optionValue='2' selected=True>
     >>> browser.getControl('One')
-    <ItemControl name='multi-checkbox-value' type='checkbox' optionValue='1'>
+    <ItemControl name='multi-checkbox-value' type='checkbox' optionValue='1' selected=True>
     >>> browser.getControl('Tres')
-    <ItemControl name='single-select-value' type='select' optionValue='3'>
+    <ItemControl name='single-select-value' type='select' optionValue='3' selected=False>
 
 Characteristics of controls and subcontrols are discussed below.
 
@@ -516,20 +516,20 @@
     (subcontrols are discussed below).
 
     >>> ctrl.controls
-    [<ItemControl name='multi-select-value' type='select' optionValue='1'>,
-     <ItemControl name='multi-select-value' type='select' optionValue='2'>,
-     <ItemControl name='multi-select-value' type='select' optionValue='3'>]
+    [<ItemControl name='multi-select-value' type='select' optionValue='1' selected=True>,
+     <ItemControl name='multi-select-value' type='select' optionValue='2' selected=True>,
+     <ItemControl name='multi-select-value' type='select' optionValue='3' selected=False>]
 
   - The 'getControl' method lets you get subcontrols by their label or their value.
 
     >>> ctrl.getControl('Un')
-    <ItemControl name='multi-select-value' type='select' optionValue='1'>
+    <ItemControl name='multi-select-value' type='select' optionValue='1' selected=True>
     >>> ctrl.getControl('Deux')
-    <ItemControl name='multi-select-value' type='select' optionValue='2'>
+    <ItemControl name='multi-select-value' type='select' optionValue='2' selected=True>
     >>> ctrl.getControl('Trois') # label attribute
-    <ItemControl name='multi-select-value' type='select' optionValue='3'>
+    <ItemControl name='multi-select-value' type='select' optionValue='3' selected=False>
     >>> ctrl.getControl('Third') # contents
-    <ItemControl name='multi-select-value' type='select' optionValue='3'>
+    <ItemControl name='multi-select-value' type='select' optionValue='3' selected=False>
     >>> browser.getControl('Third') # ambiguous in the browser, so useful
     Traceback (most recent call last):
     ...

Modified: Zope3/branches/3.3/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/branches/3.3/src/zope/testbrowser/browser.py	2006-08-22 14:47:57 UTC (rev 69728)
+++ Zope3/branches/3.3/src/zope/testbrowser/browser.py	2006-08-22 17:51:38 UTC (rev 69729)
@@ -635,9 +635,9 @@
         self.mech_item.selected = not self.mech_item.selected
 
     def __repr__(self):
-        return "<%s name=%r type=%r optionValue=%r>" % (
+        return "<%s name=%r type=%r optionValue=%r selected=%r>" % (
             self.__class__.__name__, self.mech_item._control.name,
-            self.mech_item._control.type, self.optionValue)
+            self.mech_item._control.type, self.optionValue, self.mech_item.selected)
 
 
 class Form(SetattrErrorsMixin):



More information about the Zope3-Checkins mailing list