Exemplo n.º 1
0
    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>
            """)
Exemplo n.º 2
0
    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>'
        )
Exemplo n.º 3
0
    def test_breadcrumb_reverse(self):
        crumb = Breadcrumb(label='Test', pattern_name='index')

        self.assertEqual(crumb.get_url(), '/')
Exemplo n.º 4
0
    def test_breadcrumb_url(self):
        crumb = Breadcrumb(label='Test', url='http://test.com')

        self.assertEqual(crumb.get_url(), 'http://test.com')
Exemplo n.º 5
0
    def test_breadcrumb_reverse(self):
        crumb = Breadcrumb(label='Test', pattern_name='index')

        self.assertEqual(crumb.get_url(), '/')
Exemplo n.º 6
0
    def test_breadcrumb_url(self):
        crumb = Breadcrumb(label='Test', url='http://test.com')

        self.assertEqual(crumb.get_url(), 'http://test.com')
Exemplo n.º 7
0
 def get_breadcrumbs(self):
     breadcrumbs = super(BlogMixin, self).get_breadcrumbs()
     breadcrumbs.append(Breadcrumb('Blog', url='/blog'))
     return breadcrumbs
Exemplo n.º 8
0
 def get_breadcrumbs(self):
     breadcrumbs = super(BaseMixin, self).get_breadcrumbs()
     breadcrumbs.append(Breadcrumb('Home', url='/'))
     return breadcrumbs