From 34f9b6f51231fb119ad5b910fa3c6a2323d9f9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 10 Jul 2019 17:57:28 +0200 Subject: [PATCH] misc: don't use duplicated slugs as HTML id attributes (#34746) --- combo/public/templates/combo/placeholder.html | 2 +- combo/public/views.py | 11 +++++++++++ tests/test_public.py | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/combo/public/templates/combo/placeholder.html b/combo/public/templates/combo/placeholder.html index 1c6ddf21..71830a13 100644 --- a/combo/public/templates/combo/placeholder.html +++ b/combo/public/templates/combo/placeholder.html @@ -2,7 +2,7 @@ {% if render %} {% for cell in cells %}
no selected_user resp = app.get('/users/foo/', status=200) assert 'XXYY' in resp.text + +def test_cell_slugs(app): + Page.objects.all().delete() + page = Page(title='Home', slug='index', template_name='standard') + page.save() + + TextCell(page=page, placeholder='content', text='Foobar', order=0).save() + TextCell(page=page, placeholder='content', text='Foobar', slug='unique', order=1).save() + TextCell(page=page, placeholder='content', text='Foobar', slug='dup', order=2).save() + TextCell(page=page, placeholder='content', text='Foobar', slug='dup', order=3).save() + + resp = app.get('/', status=200) + assert 'id="unique"' in resp.text + assert 'id="dup"' not in resp.text