def test_render_breadcrumbs(self): crumbs = [] crumbs.append(Breadcrumb(label='Test1', pattern_name='index')) crumbs.append(Breadcrumb(label='Test2', url='http://test.com')) output = navutils_tags.render_breadcrumbs({}, crumbs) self.assertHTMLEqual( output, """ <ul class="breadcrumbs"> <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="crumb"><a itemprop="url" href="/"><span itemprop="title">Test1</span></a></li> <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="crumb current"><a itemprop="url" href="http://test.com"><span itemprop="title">Test2</span></a></li> </ul> """)
def test_render_single_crumb(self): crumb = Breadcrumb(label='Test', pattern_name='index') output = navutils_tags.render_crumb({}, crumb) self.assertHTMLEqual( output, '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="crumb"><a itemprop="url" href="/"><span itemprop="title">Test</span></a></li>' )
def test_breadcrumb_reverse(self): crumb = Breadcrumb(label='Test', pattern_name='index') self.assertEqual(crumb.get_url(), '/')
def test_breadcrumb_url(self): crumb = Breadcrumb(label='Test', url='http://test.com') self.assertEqual(crumb.get_url(), 'http://test.com')
def get_breadcrumbs(self): breadcrumbs = super(BlogMixin, self).get_breadcrumbs() breadcrumbs.append(Breadcrumb('Blog', url='/blog')) return breadcrumbs
def get_breadcrumbs(self): breadcrumbs = super(BaseMixin, self).get_breadcrumbs() breadcrumbs.append(Breadcrumb('Home', url='/')) return breadcrumbs