[Checkins] SVN: zc.testbrowser/trunk/src/zc/testbrowser/ Implement
missing radio button functionality
Justas SadzeviÃÂius
justas at pov.lt
Thu Sep 27 09:20:58 EDT 2007
Log message for revision 80222:
Implement missing radio button functionality
Changed:
U zc.testbrowser/trunk/src/zc/testbrowser/README.txt
U zc.testbrowser/trunk/src/zc/testbrowser/real.js
-=-
Modified: zc.testbrowser/trunk/src/zc/testbrowser/README.txt
===================================================================
--- zc.testbrowser/trunk/src/zc/testbrowser/README.txt 2007-09-27 13:20:25 UTC (rev 80221)
+++ zc.testbrowser/trunk/src/zc/testbrowser/README.txt 2007-09-27 13:20:58 UTC (rev 80222)
@@ -780,58 +780,58 @@
>>> ctrl.value
[]
-# - Radio Control
-#
-# This is how you get a radio button based control:
-#
-# >>> ctrl = browser.getControl(name='radio-value')
-#
-# This shows the existing value of the control, as it was in the
-# HTML received from the server:
-#
-# >>> [unicode(v) for v in ctrl.value]
-# [u'2']
-#
-# We can then unselect it:
-#
-# >>> ctrl.value = []
-# >>> ctrl.value
-# []
-#
-# We can also reselect it:
-#
-# >>> ctrl.value = ['2']
-# >>> [unicode(v) for v in ctrl.value]
-# [u'2']
-#
-# displayValue shows the text the user would see next to the
-# control:
-#
-# >>> ctrl.displayValue
-# ['Zwei']
-#
-# This is just unit testing:
-#
-# >>> ctrl
-# <ListControl name='radio-value' type='radio'>
-# >>> verifyObject(zc.testbrowser.interfaces.IListControl, ctrl)
-# True
-# >>> ctrl.disabled
-# False
-# >>> ctrl.multiple
-# False
-# >>> ctrl.options
-# ['1', '2', '3']
-# >>> ctrl.displayOptions
-# ['Ein', 'Zwei', 'Drei']
-# >>> ctrl.displayValue = ['Ein']
-# >>> ctrl.value
-# ['1']
-# >>> ctrl.displayValue
-# ['Ein']
-#
-# The radio control subcontrols were illustrated above.
+ - Radio Control
+ This is how you get a radio button based control:
+
+ >>> ctrl = browser.getControl(name='radio-value')
+
+ This shows the existing value of the control, as it was in the
+ HTML received from the server:
+
+ >>> [unicode(v) for v in ctrl.value]
+ [u'2']
+
+ We can then unselect it:
+
+ >>> ctrl.value = []
+ >>> ctrl.value
+ []
+
+ We can also reselect it:
+
+ >>> ctrl.value = ['2']
+ >>> [unicode(v) for v in ctrl.value]
+ [u'2']
+
+ displayValue shows the text the user would see next to the
+ control:
+
+ >>> ctrl.displayValue
+ ['Zwei']
+
+ This is just unit testing:
+
+ >>> ctrl
+ <ListControl name='radio-value' type='radio'>
+ >>> verifyObject(zc.testbrowser.interfaces.IListControl, ctrl)
+ True
+ >>> ctrl.disabled
+ False
+ >>> ctrl.multiple
+ False
+ >>> [unicode(o) for o in ctrl.options]
+ [u'1', u'2', u'3']
+ >>> ctrl.displayOptions
+ ['Ein', 'Zwei', 'Drei']
+ >>> ctrl.displayValue = ['Ein']
+ >>> [unicode(v) for v in ctrl.value]
+ [u'1']
+ >>> ctrl.displayValue
+ ['Ein']
+
+ The radio control subcontrols were illustrated above.
+
- Image Control
>>> ctrl = browser.getControl(name='image-value')
Modified: zc.testbrowser/trunk/src/zc/testbrowser/real.js
===================================================================
--- zc.testbrowser/trunk/src/zc/testbrowser/real.js 2007-09-27 13:20:25 UTC (rev 80221)
+++ zc.testbrowser/trunk/src/zc/testbrowser/real.js 2007-09-27 13:20:58 UTC (rev 80222)
@@ -375,11 +375,16 @@
return (multiple && multiple.toUpperCase() == 'MULTIPLE') ? true : false
}
else if (tagName == 'INPUT') {
- typeName = elem.getAttribute('type');
- var elem = tb_tokens[token];
- var res = tb_xpath("//input[@name='" + elem.getAttribute('name') +
- "'][@type='"+typeName+"']", elem);
- return res.snapshotLength > 0;
+ var typeName = elem.getAttribute('type');
+ if (typeName == 'radio') {
+ return false;
+ }
+ else if (typeName == 'checkbox'){
+ var elem = tb_tokens[token];
+ var res = tb_xpath("//input[@name='" + elem.getAttribute('name') +
+ "'][@type='"+typeName+"']", elem);
+ return res.snapshotLength > 0;
+ }
}
return false;
}
More information about the Checkins
mailing list