[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Publisher/Browser/tests - testGlobalBrowserMenuService.py:1.4
Jim Fulton
jim@zope.com
Mon, 11 Nov 2002 15:20:27 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Publisher/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv15305/Browser/tests
Modified Files:
testGlobalBrowserMenuService.py
Log Message:
Fixed a bug that allowed titles to be repeated when there are
overlapping menu item definitions. For example, a menu item defined for
an interface should *replace* definitions for base interfaces.
=== Zope3/lib/python/Zope/App/Publisher/Browser/tests/testGlobalBrowserMenuService.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/Publisher/Browser/tests/testGlobalBrowserMenuService.py:1.3 Fri Oct 4 14:37:23 2002
+++ Zope3/lib/python/Zope/App/Publisher/Browser/tests/testGlobalBrowserMenuService.py Mon Nov 11 15:20:27 2002
@@ -81,6 +81,32 @@
self.assertEqual(list(menu), [d(5), d(6), d(3), d(2), d(1)])
+ def test_no_dups(self):
+ r = self.__reg()
+ r.menu('test_id', 'test menu')
+ r.menuItem('test_id', Interface, 'a1', 't1', 'd1')
+ r.menuItem('test_id', Interface, 'a12', 't2', 'd12')
+ r.menuItem('test_id', I1, 'a2', 't2', 'd2')
+ r.menuItem('test_id', I1, 'a23', 't3', 'd23')
+ r.menuItem('test_id', I1, 'a24', 't4', 'd24')
+ r.menuItem('test_id', I11, 'a3', 't3', 'd3', 'context')
+ r.menuItem('test_id', I11, 'a4', 't4', 'd4', 'not:context')
+ r.menuItem('test_id', I111, 'a5', 't5', 'd5')
+ r.menuItem('test_id', I111, 'a6', 't6', 'd6')
+ r.menuItem('test_id', I111, 'f7', 't7', 'd7')
+ r.menuItem('test_id', I111, 'u8', 't8', 'd8')
+ r.menuItem('test_id', I12, 'a9', 't9', 'd9')
+
+ menu = r.getMenu('test_id', X(), TestRequest())
+
+ def d(n):
+ return {'action': "a%s" % n,
+ 'title': "t%s" % n,
+ 'description': "d%s" % n,
+ }
+
+ self.assertEqual(list(menu), [d(5), d(6), d(3), d(2), d(1)])
+
def testEmpty(self):
r = self.__reg()
r.menu('test_id', 'test menu')