Skip to content

Commit 267084a

Browse files
author
Evan Borgstrom
committed
Add test case to try and reproduce #32
1 parent 07d1979 commit 267084a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ python:
99

1010
env:
1111
- DJANGO=Django==1.6
12-
- DJANGO=git+https://github.com/django/django.git@stable/1.7.x
12+
- DJANGO=Django==1.7
1313

1414
matrix:
1515
exclude:
1616
- python: 2.6
17-
env: DJANGO=git+https://github.com/django/django.git@stable/1.7.x
18-
allow_failures:
19-
- env: DJANGO=git+https://github.com/django/django.git@stable/1.7.x
17+
env: DJANGO=Django==1.7
2018

2119
install:
2220
- pip install -q -e .

menu/tests/test_menu.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def setUp(self):
1414
MenuItem("kids2-2", "/kids2-2")
1515
]
1616
kids3 = [
17-
MenuItem("kids3-1", "/parent3/kids3-1")
17+
MenuItem("kids3-1", "/parent3/kids3-1", children=[
18+
MenuItem("kids3-1-1", "/parent3/kids3-1/kid1")
19+
])
1820
]
1921

2022
Menu.items = {}
@@ -49,6 +51,15 @@ def test_select_parents(self):
4951
self.assertEqual(Menu.items['test'][2].selected, False)
5052
self.assertEqual(Menu.items['test'][1].children[1].selected, True)
5153

54+
settings.MENU_SELECT_PARENTS = True
55+
request = self.factory.get('/parent3/kids3-1/kid1')
56+
Menu.process(request, 'test')
57+
self.assertEqual(Menu.items['test'][0].selected, False)
58+
self.assertEqual(Menu.items['test'][1].selected, False)
59+
self.assertEqual(Menu.items['test'][1].children[1].selected, False)
60+
self.assertEqual(Menu.items['test'][2].selected, True)
61+
self.assertEqual(Menu.items['test'][2].children[0].selected, True)
62+
self.assertEqual(Menu.items['test'][2].children[0].children[0].selected, True)
5263

5364
def test_template_tag(self):
5465
"""

0 commit comments

Comments
 (0)