Commits

Anonymous committed 8f3d0a8

Simplified tests a bit.

Comments (0)

Files changed (1)

tests/tests/widgets.py

 
         # default data attribute values for textareas:
         self.mm_settings = mm_settings.MARKUPMIRROR_CODEMIRROR_SETTINGS.copy()
+        default = mm_settings.MARKUPMIRROR_DEFAULT_MARKUP_TYPE
         self.mm_settings.update({
             'preview_url': reverse('markupmirror:preview'),
             'base_url': reverse('markupmirror:base'),
+            'mode': markup_pool[default].codemirror_mode,
+            'markup_type': default,
         })
 
     def test_widget_media(self):
         """
         form = PostForm(instance=self.mp)
         comment = form.fields['comment']
-
-        attrs = self.mm_settings.copy()
-        attrs.update({
-            'mode': 'text/x-markdown',
-            'markup_type': 'markdown',
-        })
         self.assertHTMLEqual(
             comment.widget.render('comment', self.mp.comment),
             textwrap.dedent(u"""\
                 <textarea rows="10" cols="40" name="comment"
                           class="item-markupmirror"
                           data-mm-settings='{0}'></textarea>""").format(
-                    json.dumps(attrs, sort_keys=True))
+                    json.dumps(self.mm_settings, sort_keys=True))
             )
 
     def test_widget_additional_attributes(self):
         """
         form = PostForm(instance=self.mp)
         comment = form.fields['comment']
-
-        attrs = self.mm_settings.copy()
-        attrs.update({
-            'mode': 'text/x-markdown',
-            'markup_type': 'markdown',
-        })
         self.assertHTMLEqual(
             comment.widget.render('comment', self.mp.comment, attrs={
                 'data-something': "else",
                           class="item-markupmirror"
                           data-mm-settings='{0}'
                           data-something="else"></textarea>""").format(
-                    json.dumps(attrs, sort_keys=True))
+                    json.dumps(self.mm_settings, sort_keys=True))
             )
 
     def test_widget_default_mode_and_markuptype(self):