summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas NOEL <tnoel@entrouvert.com>2015-05-29 13:36:55 (GMT)
committerThomas NOEL <tnoel@entrouvert.com>2015-05-29 13:42:21 (GMT)
commite53d411fb20da4155c0b5d6bb324b5aeb2c90770 (patch)
treee15626776d3e29553ca1958ea4ac4a961a38e479
parent64e5c82c60389bf52ab96ba97fce3b5ef16c205c (diff)
downloadcombo-e53d411fb20da4155c0b5d6bb324b5aeb2c90770.zip
combo-e53d411fb20da4155c0b5d6bb324b5aeb2c90770.tar.gz
combo-e53d411fb20da4155c0b5d6bb324b5aeb2c90770.tar.bz2
linkcell with link_page and anchor: add tests (#7400)
-rw-r--r--tests/test_cells.py28
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/test_cells.py b/tests/test_cells.py
index fc52f18..8a58592 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() == '<a href="http://example.net">Example Site</a>'
+ assert cell.render(ctx).strip() == '<a href="http://example.net/">Example Site</a>'
- assert cell.get_additional_label() == 'Example Site'
+ cell.title = ''
+ cell.save()
+ assert cell.render(ctx).strip() == '<a href="http://example.net/">http://example.net/</a>'
+
+ cell.link_page = page
+ cell.save()
+ assert cell.render(ctx).strip() == '<a href="/example-page">example page</a>'
+
+ cell.title = 'altertitle'
+ cell.save()
+ assert cell.render(ctx).strip() == '<a href="/example-page">altertitle</a>'
+
+ cell.anchor = 'anchor'
+ cell.save()
+ assert cell.render(ctx).strip() == '<a href="/example-page#anchor">altertitle</a>'
+
+ cell.link_page = None
+ cell.save()
+ assert cell.render(ctx).strip() == '<a href="http://example.net/#anchor">altertitle</a>'