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

Christian Theune ct at gocept.com
Tue Aug 22 14:00:23 EDT 2006


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

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

-=-
Modified: Zope3/trunk/src/zope/testbrowser/README.txt
===================================================================
--- Zope3/trunk/src/zope/testbrowser/README.txt	2006-08-22 17:51:38 UTC (rev 69729)
+++ Zope3/trunk/src/zope/testbrowser/README.txt	2006-08-22 18:00:22 UTC (rev 69730)
@@ -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/trunk/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/browser.py	2006-08-22 17:51:38 UTC (rev 69729)
+++ Zope3/trunk/src/zope/testbrowser/browser.py	2006-08-22 18:00:22 UTC (rev 69730)
@@ -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