def test_expand_db_attributes_with_missing_alt(self):
     Image.objects.create(id=1, title='Test', file=get_test_image_file())
     result = image_embedtype_handler(
         {'id': 1,
          'format': 'left'},
     )
     self.assertTagInHTML('<img class="richtext-image left" alt="" />', result, allow_extra_attrs=True)
Beispiel #2
0
 def test_expand_db_attributes_not_for_editor(self):
     Image.objects.create(id=1, title='Test', file=get_test_image_file())
     result = image_embedtype_handler({
         'id': 1,
         'alt': 'test-alt',
         'format': 'left'
     })
     self.assertIn('<img class="richtext-image left"', result)
 def test_expand_db_attributes_escapes_alt_text(self):
     Image.objects.create(id=1, title='Test', file=get_test_image_file())
     result = image_embedtype_handler(
         {'id': 1,
          'alt': 'Arthur "two sheds" Jackson',
          'format': 'left'},
     )
     self.assertIn('alt="Arthur &quot;two sheds&quot; Jackson"', result)
 def test_expand_db_attributes_not_for_editor(self):
     Image.objects.create(id=1, title='Test', file=get_test_image_file())
     result = image_embedtype_handler(
         {'id': 1,
          'alt': 'test-alt',
          'format': 'left'}
     )
     self.assertTagInHTML('<img class="richtext-image left" />', result, allow_extra_attrs=True)
Beispiel #5
0
 def test_expand_db_attributes_escapes_alt_text(self):
     Image.objects.create(id=1, title='Test', file=get_test_image_file())
     result = image_embedtype_handler(
         {
             'id': 1,
             'alt': 'Arthur "two sheds" Jackson',
             'format': 'left'
         }, )
     self.assertIn('alt="Arthur &quot;two sheds&quot; Jackson"', result)
Beispiel #6
0
 def test_expand_db_attributes_with_missing_alt(self):
     Image.objects.create(id=1, title='Test', file=get_test_image_file())
     result = image_embedtype_handler({'id': 1, 'format': 'left'}, )
     self.assertIn('<img class="richtext-image left"', result)
     self.assertIn('alt=""', result)
Beispiel #7
0
 def test_expand_db_attributes_image_does_not_exist(self):
     result = image_embedtype_handler({'id': 0})
     self.assertEqual(result, '<img>')
 def test_expand_db_attributes_image_does_not_exist(self):
     result = image_embedtype_handler({'id': 0})
     self.assertEqual(result, '<img>')