[Checkins] SVN: zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/ Snapshot of work.
Christian Theune
ct at gocept.com
Fri Aug 15 05:33:13 EDT 2008
Log message for revision 89871:
Snapshot of work.
Changed:
U zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/README.txt
U zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/browser.py
U zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/ftests/navigate.html
-=-
Modified: zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/README.txt
===================================================================
--- zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/README.txt 2008-08-15 09:04:08 UTC (rev 89870)
+++ zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/README.txt 2008-08-15 09:33:13 UTC (rev 89871)
@@ -208,16 +208,27 @@
>>> browser.contents
'...Message: <em>By Link Text with Normalization</em>...'
-When a link text matches more than one link, by default the first one is
-chosen. You can, however, specify the index of the link and thus retrieve a
-later matching link:
+When a link text matches more than one link, a link with an exact match will be
+preferred over links that don't match exactly:
- >>> browser.getLink('Link Text')
- <Link text='Link Text' ...>
+ >>> browser.getLink('Matching text')
+ <Link text='Matching text' ...>
- >>> browser.getLink('Link Text', index=1)
- <Link text='Link Text with Whitespace Normalization (and parens)' ...>
+You can, however, specify the index of the link and thus retrieve a later
+matching link:
+ >>> browser.getLink('Matching text with', index=1)
+ <Link text='Matching text with more to it' ...>
+
+
+ >>> browser.getLink('Matching text with')
+ <Link text='Matching text with more' ...>
+
+ >>> browser.getLink('Matching text with', index=1)
+ <Link text='Matching text with more to it' ...>
+
+However, if a link's text matches exactly, this one is preferred:
+
Note that clicking a link object after its browser page has expired will
generate an error.
Modified: zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/browser.py
===================================================================
--- zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/browser.py 2008-08-15 09:04:08 UTC (rev 89870)
+++ zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/browser.py 2008-08-15 09:33:13 UTC (rev 89871)
@@ -290,6 +290,7 @@
def getLink(self, text=None, url=None, id=None, index=0):
"""See zope.testbrowser.interfaces.IBrowser"""
+ import pdb; pdb.set_trace()
if id is not None:
def predicate(link):
return dict(link.attrs).get('id') == id
Modified: zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/ftests/navigate.html
===================================================================
--- zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/ftests/navigate.html 2008-08-15 09:04:08 UTC (rev 89870)
+++ zope.testbrowser/branches/ctheune-exact-match-preferred/src/zope/testbrowser/ftests/navigate.html 2008-08-15 09:33:13 UTC (rev 89871)
@@ -35,5 +35,11 @@
coords="23,21,18" />
</map>
+ <a href="navigate.html?message=Matching+text+with+more">Matching text with more</a>
+
+ <a href="navigate.html?message=Matching+text">Matching text</a>
+
+ <a href="navigate.html?message=Matching+text+with+more+to+it">Matching text with more to it</a>
+
</body>
</html>
More information about the Checkins
mailing list