コード例 #1
0
    def test_old_style_configs(self):
        from django_summernote.widgets import (SummernoteWidget,
                                               SummernoteInplaceWidget)

        OLD_STYLE_CONFIG = {
            'width': '640px',
            'toolbar': [
                ['font', ['bold']],
            ],
        }
        self.app_config._copy_old_configs(OLD_STYLE_CONFIG,
                                          self.app_config.get_default_config())

        widget = SummernoteInplaceWidget()
        html = widget.render('foobar',
                             'lorem ipsum',
                             attrs={'id': 'id_foobar'})

        assert '"width": "640px"' in html
        assert '"height": 480' in html
        assert '"toolbar": [["font", ["bold"]]]' in html

        widget = SummernoteWidget()
        html = widget.render('foobar',
                             'lorem ipsum',
                             attrs={'id': 'id_foobar'})

        assert '"width": "640px"' in html
        assert '"height": 480' in html
        assert '"toolbar": [["font", ["bold"]]]' in html
コード例 #2
0
ファイル: tests.py プロジェクト: yuong1979/django-summernote
    def test_old_style_configs(self):
        from django_summernote.settings import _copy_old_configs, SETTINGS_DEFAULT
        from django_summernote.widgets import (SummernoteWidget, SummernoteInplaceWidget)

        OLD_STYLE_CONFIG = {
            'width': '640px',
            'toolbar': [
                ['font', ['bold']],
            ],
        }
        _copy_old_configs(summernote_config, OLD_STYLE_CONFIG, SETTINGS_DEFAULT)

        widget = SummernoteInplaceWidget()
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert '"width": "640px"' in html
        assert '"height": 480' in html
        assert '"toolbar": [["font", ["bold"]]]' in html

        widget = SummernoteWidget()
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert '"width": "640px"' in html
        assert '"height": 480' in html
        assert '"toolbar": [["font", ["bold"]]]' in html
コード例 #3
0
ファイル: tests.py プロジェクト: summernote/django-summernote
    def test_old_style_configs(self):
        from django_summernote.widgets import (SummernoteWidget, SummernoteInplaceWidget)

        OLD_STYLE_CONFIG = {
            'width': '640px',
            'toolbar': [
                ['font', ['bold']],
            ],
        }
        self.app_config._copy_old_configs(OLD_STYLE_CONFIG, self.app_config.get_default_config())

        widget = SummernoteInplaceWidget()
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert '"width": "640px"' in html
        assert '"height": 480' in html
        assert '"toolbar": [["font", ["bold"]]]' in html

        widget = SummernoteWidget()
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert '"width": "640px"' in html
        assert '"height": 480' in html
        assert '"toolbar": [["font", ["bold"]]]' in html
コード例 #4
0
ファイル: tests.py プロジェクト: liqingqiya/blog
    def test_widget_inplace(self):
        from django_summernote.widgets import SummernoteInplaceWidget

        widget = SummernoteInplaceWidget()
        html = widget.render("foobar", "lorem ipsum", attrs={"id": "id_foobar"})

        assert "summernote" in html
コード例 #5
0
ファイル: tests.py プロジェクト: yuong1979/django-summernote
    def test_widgets_with_adhoc_settings(self):
        from django_summernote.widgets import (SummernoteWidget, SummernoteInplaceWidget)

        widget = SummernoteInplaceWidget(attrs={'summernote': {'toolbar': [['font', ['bold']]]}})
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert '"toolbar": [["font", ["bold"]]]' in html

        widget = SummernoteWidget(attrs={'summernote': {'toolbar': [['font', ['italic']]]}})
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert '"toolbar": [["font", ["italic"]]]' in html
コード例 #6
0
ファイル: tests.py プロジェクト: yuong1979/django-summernote
    def test_widgets_with_attributes(self):
        from django_summernote.widgets import (SummernoteWidget, SummernoteInplaceWidget)

        widget = SummernoteInplaceWidget(attrs={'class': 'special'})
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert 'class="special"' in html

        widget = SummernoteWidget(attrs={'class': 'special'})
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert 'class="special"' in html
コード例 #7
0
    def test_widget_inplace(self):
        from django_summernote.widgets import SummernoteInplaceWidget

        widget = SummernoteInplaceWidget()
        html = widget.render('foobar',
                             'lorem ipsum',
                             attrs={'id': 'id_foobar'})

        assert 'summernote' in html
コード例 #8
0
ファイル: tests.py プロジェクト: SebastianLasisz/Przepisy
    def test_widget_inplace(self):
        from django_summernote.widgets import SummernoteInplaceWidget

        widget = SummernoteInplaceWidget()
        html = widget.render(
            'foobar', 'lorem ipsum', attrs={'id': 'id_foobar'}
        )

        assert 'summernote' in html
コード例 #9
0
    def test_widget_inplace_with_ugettext_lazy(self):
        from django_summernote.widgets import SummernoteInplaceWidget
        from django.utils.translation import ugettext_lazy
        from django_summernote.widgets import __summernote_options__

        widget = SummernoteInplaceWidget()
        # Force an attribute to be an unevaluated __proxy__ type. This is how django handles string translations.
        html = widget.render('foobar',
                             'lorem ipsum',
                             attrs={
                                 x: ugettext_lazy('yada')
                                 for x in ['id'] + __summernote_options__
                             })

        assert 'summernote' in html