diff --git a/tests/test_cells.py b/tests/test_cells.py index fc52f180..8a58592f 100644 --- a/tests/test_cells.py +++ b/tests/test_cells.py @@ -39,18 +39,38 @@ def test_additional_label(): assert '...' in cell.get_additional_label() def test_link_cell(): - page = Page() + page = Page(title='example page', slug='example-page') page.save() cell = LinkCell() cell.page = page cell.title = 'Example Site' - cell.url = 'http://example.net' + cell.url = 'http://example.net/' cell.order = 0 cell.save() + assert cell.get_additional_label() == 'Example Site' + from django.template import Context ctx = Context() - assert cell.render(ctx).strip() == 'Example Site' + assert cell.render(ctx).strip() == 'Example Site' - assert cell.get_additional_label() == 'Example Site' + cell.title = '' + cell.save() + assert cell.render(ctx).strip() == 'http://example.net/' + + cell.link_page = page + cell.save() + assert cell.render(ctx).strip() == 'example page' + + cell.title = 'altertitle' + cell.save() + assert cell.render(ctx).strip() == 'altertitle' + + cell.anchor = 'anchor' + cell.save() + assert cell.render(ctx).strip() == 'altertitle' + + cell.link_page = None + cell.save() + assert cell.render(ctx).strip() == 'altertitle'