diff --git a/combo/apps/wcs/templates/combo/wcs/form_link_fragment.html b/combo/apps/wcs/templates/combo/wcs/form_link_fragment.html
index 6d4915b6..148ad9d4 100644
--- a/combo/apps/wcs/templates/combo/wcs/form_link_fragment.html
+++ b/combo/apps/wcs/templates/combo/wcs/form_link_fragment.html
@@ -6,7 +6,13 @@
{% block form-link-pre %}{% endblock %}
-{% block form-link-title %}{{ form_title }}{% endblock %}
+
+ {% block form-link-title %}{{ form_title }}{% endblock %}
+
{% if form_description %}
{% block form-link-description %}{{ form_description|safe }}{% endblock %}
{% endif %}
diff --git a/combo/public/templates/combo/link-list-cell.html b/combo/public/templates/combo/link-list-cell.html
index 23288a4b..ba7e973e 100644
--- a/combo/public/templates/combo/link-list-cell.html
+++ b/combo/public/templates/combo/link-list-cell.html
@@ -2,33 +2,33 @@
{% block cell-content %}
{% spaceless %}
{% block cell-header %}
- {% if title %}{{ title }}
{% endif %}
+ {% if title %}{{ title }}
{% endif %}
{% include "combo/asset_picture_fragment.html" %}
{% endblock cell-header %}
{% block cell-top-content %}{% endblock cell-top-content %}
-
+
{% if more_links %}
-
+
{% for link in more_links %}
- - {% if link.is_form %}
- {% include "combo/wcs/form_link_fragment.html" with form=link %}
+
- {% if link.is_form %}
+ {% include "combo/wcs/form_link_fragment.html" with form=link css_block="links-list"%}
{% else %}
- {{ link.title }}
+ {{ link.title }}
{% endif %}
{% endfor %}
{% endif %}
diff --git a/tests/test_cells.py b/tests/test_cells.py
index e92a5a7b..3ec7a67a 100644
--- a/tests/test_cells.py
+++ b/tests/test_cells.py
@@ -20,6 +20,7 @@ from django.test.utils import CaptureQueriesContext
from django.urls import reverse
from django.utils.encoding import force_bytes, force_str
from django.utils.timezone import now
+from pyquery import PyQuery
from combo.data.library import get_cell_classes
from combo.data.models import (
@@ -292,29 +293,33 @@ def test_link_list_cell():
)
ctx = {'page_cells': [item]}
- assert '' in cell.render(
- ctx
- )
+ pq = PyQuery(cell.render(ctx))
+ assert pq("a").attr("href") == "http://example.net/"
+ assert pq("a").text() == "Example Site"
+ assert "foobar" in pq("li").attr("class")
item.title = ''
item.extra_css_class = ''
- assert '' in cell.render(
- ctx
- )
+ pq = PyQuery(cell.render(ctx))
+ assert pq("a").text() == "http://example.net/"
+ assert "foobar" not in pq("li").attr("class")
item.link_page = page
- assert '' in cell.render(ctx)
+ pq = PyQuery(cell.render(ctx))("a")
+ assert pq.attr("href") == "/example-page/"
+ assert pq.text() == "example page"
item.title = 'altertitle'
- assert '' in cell.render(ctx)
+ pq = PyQuery(cell.render(ctx))("a")
+ assert pq.text() == "altertitle"
item.anchor = 'anchor'
- assert '' in cell.render(ctx)
+ pq = PyQuery(cell.render(ctx))("a")
+ assert pq.attr("href") == "/example-page/#anchor"
item.link_page = None
- assert '' in cell.render(
- ctx
- )
+ pq = PyQuery(cell.render(ctx))("a")
+ assert pq.attr("href") == "http://example.net/#anchor"
item2 = LinkCell.objects.create(
page=page,
@@ -324,9 +329,9 @@ def test_link_list_cell():
order=1,
)
ctx = {'page_cells': [item, item2]}
- assert 'class="add-more-items--button">+' not in cell.render(ctx)
+ assert 'class="add-more-items--button links-list--more-items-button">+' not in cell.render(ctx)
cell.limit = 1
- assert 'class="add-more-items--button">+' in cell.render(ctx)
+ assert 'class="add-more-items--button links-list--more-items-button">+' in cell.render(ctx)
def test_link_list_cell_validity():
diff --git a/tests/wcs/test_all.py b/tests/wcs/test_all.py
index f1d995e9..5244015b 100644
--- a/tests/wcs/test_all.py
+++ b/tests/wcs/test_all.py
@@ -1864,7 +1864,7 @@ def test_list_of_links_with_form_render(app):
resp = app.get('/test_list_of_links_with_form_render/')
assert PyQuery(resp.text).find('.links-list a').text() == 'A title'
- assert PyQuery(resp.text).find('.links-list li').attr('class') == ' foobar'
+ assert 'foobar' in PyQuery(resp.text).find('.links-list li').attr('class')
assert (
PyQuery(resp.text).find('.links-list a').attr('href')
== 'http://example.com/tryauth?cancelurl=http%3A//testserver/test_list_of_links_with_form_render/'
@@ -1873,12 +1873,12 @@ def test_list_of_links_with_form_render(app):
link.cached_json = {'keywords': ['bar']}
link.save()
resp = app.get('/test_list_of_links_with_form_render/')
- assert PyQuery(resp.text).find('.links-list li').attr('class') == 'keyword-bar foobar'
+ assert 'keyword-bar foobar' in PyQuery(resp.text).find('.links-list li').attr('class')
link.extra_css_class = ''
link.save()
resp = app.get('/test_list_of_links_with_form_render/')
- assert PyQuery(resp.text).find('.links-list li').attr('class') == 'keyword-bar'
+ assert 'keyword-bar' in PyQuery(resp.text).find('.links-list li').attr('class')
link.cached_json = {'description': 'en outre, on est des loutres'}
link.save()