misc: add foldable cell and list of links to style demo page (#39112)

This commit is contained in:
Frédéric Péters 2020-01-20 14:11:45 +01:00
parent e54e61d2de
commit a00b640090
2 changed files with 18 additions and 0 deletions

View File

@ -343,6 +343,9 @@ class StyleDemoPage(object):
cell.text = '<h2>%s</h2>%s' % (
lorem_ipsum.words(3, common=False),
'\n'.join(['<p>%s</p>' % x for x in lorem_ipsum.paragraphs(3)]))
if i == 1:
cell.extra_css_class = 'foldable'
cell.save()
cell.save()
if i == 0:
@ -365,6 +368,16 @@ class StyleDemoPage(object):
_('Select'))
cell.save()
if i == 1:
# add a list of links in second placeholder
cell = TextCell(page=self.page, placeholder=placeholder.key, order=1)
cell.text = '<h2>%s</h2><ul>' % _('Title')
cell.extra_css_class = 'links-list'
for i in range(5):
cell.text += '<li><a href="#">%s</a></li>' % lorem_ipsum.words(3, common=False)
cell.text += '</ul>'
cell.save()
return self.page
def __exit__(self, type, value, traceback):

View File

@ -444,6 +444,11 @@ def test_style_demo(app, admin_user):
assert TextCell.objects.count() == 0
assert Page.objects.count() == 0
resp = app.get('/__style__/?template=standard-sidebar', status=200)
assert 'links-list' in resp.text
assert Page.objects.count() == 0
def test_page_async_cell(app):
Page.objects.all().delete()
page = Page(title='Home', slug='index', template_name='standard')