# Path: tests/_utils.py
# class HatbandTestCase(ArmstrongTestCase):
#     pass
# 
# Path: armstrong/hatband/widgets/base.py
# class RichTextWidget(object):
#     def __new__(cls, *args, **kwargs):
#         return RICH_TEXT_BACKEND.get_backend(*args, **kwargs)
# 
# Path: armstrong/hatband/widgets/ckeditor.py
# class CKEditorWidget(widgets.Textarea):
#     class Media:
#         js = (static("ckeditor/ckeditor.js"),)
# 
#     def __init__(self, attrs=None):
#         final_attrs = {'class': 'ckeditor'}
#         if attrs is not None:
#             final_attrs.update(attrs)
#             if 'class' in attrs:
#                 final_attrs['class'] = ' '.join((attrs['class'], 'ckeditor'))
#         super(CKEditorWidget, self).__init__(attrs=final_attrs)


from django.forms.widgets import Textarea
from .._utils import HatbandTestCase
from armstrong.hatband.widgets import CKEditorWidget, RichTextWidget



TEST_SETTINGS = {
    "ARMSTRONG_HATBAND_RICHTEXTEDITOR": "django.forms.widgets.Textarea",
}


class RichTextFieldTestCase(HatbandTestCase):

    def test_default(self):
        ckeditor = CKEditorWidget()
        widget = RichTextWidget()
        ckeditor_out = str(ckeditor.render('widget', ''))
        widget_out = str(widget.render('widget', ''))
        self.assertEquals(ckeditor_out, widget_out)

    def test_non_default_setting(self):
        with self.settings(**TEST_SETTINGS):
            textarea = Textarea()
            widget = RichTextWidget()
            textarea_out = str(textarea.render('widget', ''))
            widget_out = str(widget.render('widget', ''))
            self.assertEquals(textarea_out, widget_out)

    def test_kwargs_passthrough(self):
        attrs = {'cols': 50, 'class': 'something'}

# Path: tests/_utils.py
# class HatbandTestCase(ArmstrongTestCase):
#     pass
# 
# Path: armstrong/hatband/widgets/base.py
# class RichTextWidget(object):
#     def __new__(cls, *args, **kwargs):
#         return RICH_TEXT_BACKEND.get_backend(*args, **kwargs)
# 
# Path: armstrong/hatband/widgets/ckeditor.py
# class CKEditorWidget(widgets.Textarea):
#     class Media:
#         js = (static("ckeditor/ckeditor.js"),)
# 
#     def __init__(self, attrs=None):
#         final_attrs = {'class': 'ckeditor'}
#         if attrs is not None:
#             final_attrs.update(attrs)
#             if 'class' in attrs:
#                 final_attrs['class'] = ' '.join((attrs['class'], 'ckeditor'))
#         super(CKEditorWidget, self).__init__(attrs=final_attrs)


# Path: tests/widgets/rich_text_field.py
from django.forms.widgets import Textarea
from .._utils import HatbandTestCase
from armstrong.hatband.widgets import CKEditorWidget, RichTextWidget




TEST_SETTINGS = {
    "ARMSTRONG_HATBAND_RICHTEXTEDITOR": "django.forms.widgets.Textarea",
}


class RichTextFieldTestCase(HatbandTestCase):

    def test_default(self):
        ckeditor = CKEditorWidget()
        widget = RichTextWidget()
        ckeditor_out = str(ckeditor.render('widget', ''))
        widget_out = str(widget.render('widget', ''))
        self.assertEquals(ckeditor_out, widget_out)

    def test_non_default_setting(self):
        with self.settings(**TEST_SETTINGS):
            textarea = Textarea()
            widget = RichTextWidget()
            textarea_out = str(textarea.render('widget', ''))
            widget_out = str(widget.render('widget', ''))
            self.assertEquals(textarea_out, widget_out)

    def test_kwargs_passthrough(self):
        attrs = {'cols': 50, 'class': 'something'}

        ckeditor = CKEditorWidget(attrs=attrs)