def test_base(self): from plone.app.widgets.dx import BaseWidget request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'}) widget = BaseWidget(request) widget.name = 'example' self.assertEqual( widget._widget_args(), { 'name': 'example', 'pattern': None, 'pattern_options': {}, }, )
def test_widget_pattern_notimplemented(self): from plone.app.widgets.dx import BaseWidget from plone.app.widgets.utils import NotImplemented widget = BaseWidget(self.request) widget.field = self.field self.assertRaises(NotImplemented, widget._base_args) widget.pattern = 'example' self.assertEqual({ 'pattern': 'example', 'pattern_options': {} }, widget._base_args())
def test_widget_base_notimplemented(self): from plone.app.widgets.dx import BaseWidget from plone.app.widgets.base import InputWidget from plone.app.widgets.utils import NotImplemented widget = BaseWidget(self.request) widget.field = self.field widget.pattern = 'example' self.assertRaises( NotImplemented, widget.render) widget._base = InputWidget self.assertEqual( '<input class="pat-example" type="text"/>', widget.render())
def test_widget_pattern_notimplemented(self): from plone.app.widgets.dx import BaseWidget from plone.app.widgets.utils import NotImplemented widget = BaseWidget(self.request) widget.field = self.field self.assertRaises( NotImplemented, widget._base_args) widget.pattern = 'example' self.assertEqual( { 'pattern': 'example', 'pattern_options': {} }, widget._base_args())
def test_widget_base_notimplemented(self): from plone.app.widgets.dx import BaseWidget from plone.app.widgets.base import InputWidget from plone.app.widgets.utils import NotImplemented widget = BaseWidget(self.request) widget.field = self.field widget.pattern = 'example' self.assertRaises(NotImplemented, widget.render) widget._base = InputWidget self.assertEqual('<input class="pat-example" type="text"/>', widget.render())