Fix streamfield tests for updated markup

This commit is contained in:
Matt Westcott 2019-08-01 00:50:34 +01:00
parent 268f33ea11
commit ee253d0de5
2 changed files with 13 additions and 13 deletions

View file

@ -4868,7 +4868,7 @@ class TestInlineStreamField(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
# response should include HTML declarations for streamfield child blocks
self.assertContains(response, '<li id="__PREFIX__-container" class="sequence-member">')
self.assertContains(response, '<div id="__PREFIX__-container" aria-hidden="false">')
class TestRecentEditsPanel(TestCase, WagtailTestUtils):

View file

@ -1200,7 +1200,7 @@ class TestStructBlock(SimpleTestCase):
self.assertIn('<div class="struct-block">', html)
self.assertIn('<div class="field char_field widget-text_input fieldname-title">', html)
self.assertIn('<label for="mylink-title">Title:</label>', html)
self.assertIn('<label class="field__label" for="mylink-title">Title</label>', html)
self.assertInHTML(
'<input id="mylink-title" name="mylink-title" placeholder="Title" type="text" value="Wagtail site" />', html
)
@ -1225,7 +1225,7 @@ class TestStructBlock(SimpleTestCase):
'link': 'http://www.wagtail.io',
}), prefix='mylink')
self.assertIn('<li class="required">', html)
self.assertIn('<div class="field required">', html)
def test_render_form_unknown_field(self):
class LinkBlock(blocks.StructBlock):
@ -1290,7 +1290,7 @@ class TestStructBlock(SimpleTestCase):
'link': 'http://www.wagtail.io',
}), prefix='mylink')
self.assertIn('<div class="sequence-member__help help"><span class="icon-help-inverse" aria-hidden="true"></span>Self-promotion is encouraged</div>', html)
self.assertInHTML('<div class="help"><span class="icon-help-inverse" aria-hidden="true"></span> Self-promotion is encouraged</div>', html)
# check it can be overridden in the block constructor
block = LinkBlock(help_text="Self-promotion is discouraged")
@ -1299,7 +1299,7 @@ class TestStructBlock(SimpleTestCase):
'link': 'http://www.wagtail.io',
}), prefix='mylink')
self.assertIn('<div class="sequence-member__help help"><span class="icon-help-inverse" aria-hidden="true"></span>Self-promotion is discouraged</div>', html)
self.assertInHTML('<div class="help"><span class="icon-help-inverse" aria-hidden="true"></span> Self-promotion is discouraged</div>', html)
def test_media_inheritance(self):
class ScriptedCharBlock(blocks.CharBlock):
@ -1734,7 +1734,7 @@ class TestListBlock(WagtailTestUtils, SimpleTestCase):
def test_render_form_wrapper_class(self):
html = self.render_form()
self.assertIn('<div class="sequence-container sequence-type-list">', html)
self.assertIn('<div class="c-sf-container">', html)
def test_render_form_count_field(self):
html = self.render_form()
@ -1755,8 +1755,8 @@ class TestListBlock(WagtailTestUtils, SimpleTestCase):
def test_render_form_labels(self):
html = self.render_form()
self.assertIn('<label for="links-0-value-title">Title:</label>', html)
self.assertIn('<label for="links-0-value-link">Link:</label>', html)
self.assertIn('<label class="field__label" for="links-0-value-title">Title</label>', html)
self.assertIn('<label class="field__label" for="links-0-value-link">Link</label>', html)
def test_render_form_values(self):
html = self.render_form()
@ -2231,7 +2231,7 @@ class TestStreamBlock(WagtailTestUtils, SimpleTestCase):
def test_render_form_wrapper_class(self):
html = self.render_form()
self.assertIn('<div class="sequence-container sequence-type-stream">', html)
self.assertIn('<div class="c-sf-container">', html)
def test_render_form_count_field(self):
html = self.render_form()
@ -2662,7 +2662,7 @@ class TestStreamBlock(WagtailTestUtils, SimpleTestCase):
self.assertTrue(value1 != value3)
def test_render_considers_group_attribute(self):
"""If group attributes are set in Block Meta classes, render a <h3> for each different block"""
"""If group attributes are set in Block Meta classes, render a <h4> for each different block"""
class Group1Block1(blocks.CharBlock):
class Meta:
@ -2691,9 +2691,9 @@ class TestStreamBlock(WagtailTestUtils, SimpleTestCase):
('ngb', NoGroupBlock()),
])
html = block.render_form('')
self.assertNotIn('<h3></h3>', block.render_form(''))
self.assertIn('<h3>group1</h3>', html)
self.assertIn('<h3>group2</h3>', html)
self.assertNotIn('<h4 class="c-sf-add-panel__group-title"></h4>', block.render_form(''))
self.assertIn('<h4 class="c-sf-add-panel__group-title">group1</h4>', html)
self.assertIn('<h4 class="c-sf-add-panel__group-title">group2</h4>', html)
def test_value_from_datadict(self):
class ArticleBlock(blocks.StreamBlock):