def test_localization(self): from plone.app.widgets.base import DateWidget request_en = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'}) widget_en = DateWidget(request=request_en) self.assertEqual( widget_en.render(), '<input class="pat-pickadate" type="date" data-pat-pickadate="{"date": {"format": "dd/mm/yyyy", "clear": "Clear", "monthsFull": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "weekdaysShort": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], "weekdaysFull": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], "monthsShort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], "formatSubmit": "dd-mm-yyyy", "today": "Today"}, "time": "false"}"/>') # noqa request_de = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'de'}) widget_de = DateWidget(request=request_de) self.assertEqual( widget_de.render(), '<input class="pat-pickadate" type="date" data-pat-pickadate="{"date": {"format": "dd/mm/yyyy", "clear": "Clear", "monthsFull": ["Januar", "Februar", "M\\u00e4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], "weekdaysShort": ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"], "weekdaysFull": ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"], "monthsShort": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], "formatSubmit": "dd-mm-yyyy", "today": "Today"}, "time": "false"}"/>') # noqa
def test_localization(self): from plone.app.widgets.base import DateWidget request_en = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'}) widget_en = DateWidget(request=request_en) self.assertEqual(widget_en.render( ), '<input class="pat-pickadate" type="date" data-pat-pickadate="{"date": {"format": "dd/mm/yyyy", "clear": "Clear", "monthsFull": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "weekdaysShort": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], "weekdaysFull": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], "monthsShort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], "formatSubmit": "dd-mm-yyyy", "today": "Today"}, "time": "false"}"/>' ) # noqa request_de = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'de'}) widget_de = DateWidget(request=request_de) self.assertEqual(widget_de.render( ), '<input class="pat-pickadate" type="date" data-pat-pickadate="{"date": {"format": "dd/mm/yyyy", "clear": "Clear", "monthsFull": ["Januar", "Februar", "M\\u00e4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], "weekdaysShort": ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"], "weekdaysFull": ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"], "monthsShort": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], "formatSubmit": "dd-mm-yyyy", "today": "Today"}, "time": "false"}"/>' ) # noqa
def test_defaults(self): from plone.app.widgets.base import DateWidget widget = DateWidget() self.assertEqual( widget.render(), '<input class="pat-pickadate" type="date" data-pat-pickadate="{"date": {"formatSubmit": "dd-mm-yyyy", "format": "dd/mm/yyyy"}, "time": "false"}"/>') # noqa
def test_defaults(self): from plone.app.widgets.base import DateWidget widget = DateWidget() self.assertEqual(widget.render( ), '<input class="pat-pickadate" type="date" data-pat-pickadate="{"date": {"formatSubmit": "dd-mm-yyyy", "format": "dd/mm/yyyy"}, "time": "false"}"/>' ) # noqa