Ejemplo n.º 1
0
    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="{&quot;date&quot;: {&quot;format&quot;: &quot;dd/mm/yyyy&quot;, &quot;clear&quot;: &quot;Clear&quot;, &quot;monthsFull&quot;: [&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot;, &quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;August&quot;, &quot;September&quot;, &quot;October&quot;, &quot;November&quot;, &quot;December&quot;], &quot;weekdaysShort&quot;: [&quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot;], &quot;weekdaysFull&quot;: [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;, &quot;Sunday&quot;], &quot;monthsShort&quot;: [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;], &quot;formatSubmit&quot;: &quot;dd-mm-yyyy&quot;, &quot;today&quot;: &quot;Today&quot;}, &quot;time&quot;: &quot;false&quot;}"/>')  # 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="{&quot;date&quot;: {&quot;format&quot;: &quot;dd/mm/yyyy&quot;, &quot;clear&quot;: &quot;Clear&quot;, &quot;monthsFull&quot;: [&quot;Januar&quot;, &quot;Februar&quot;, &quot;M\\u00e4rz&quot;, &quot;April&quot;, &quot;Mai&quot;, &quot;Juni&quot;, &quot;Juli&quot;, &quot;August&quot;, &quot;September&quot;, &quot;Oktober&quot;, &quot;November&quot;, &quot;Dezember&quot;], &quot;weekdaysShort&quot;: [&quot;Mo&quot;, &quot;Di&quot;, &quot;Mi&quot;, &quot;Do&quot;, &quot;Fr&quot;, &quot;Sa&quot;, &quot;So&quot;], &quot;weekdaysFull&quot;: [&quot;Montag&quot;, &quot;Dienstag&quot;, &quot;Mittwoch&quot;, &quot;Donnerstag&quot;, &quot;Freitag&quot;, &quot;Samstag&quot;, &quot;Sonntag&quot;], &quot;monthsShort&quot;: [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mrz&quot;, &quot;Apr&quot;, &quot;Mai&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Okt&quot;, &quot;Nov&quot;, &quot;Dez&quot;], &quot;formatSubmit&quot;: &quot;dd-mm-yyyy&quot;, &quot;today&quot;: &quot;Today&quot;}, &quot;time&quot;: &quot;false&quot;}"/>')  # noqa
Ejemplo n.º 2
0
    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="{&quot;date&quot;: {&quot;format&quot;: &quot;dd/mm/yyyy&quot;, &quot;clear&quot;: &quot;Clear&quot;, &quot;monthsFull&quot;: [&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot;, &quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;August&quot;, &quot;September&quot;, &quot;October&quot;, &quot;November&quot;, &quot;December&quot;], &quot;weekdaysShort&quot;: [&quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot;], &quot;weekdaysFull&quot;: [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;, &quot;Sunday&quot;], &quot;monthsShort&quot;: [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;], &quot;formatSubmit&quot;: &quot;dd-mm-yyyy&quot;, &quot;today&quot;: &quot;Today&quot;}, &quot;time&quot;: &quot;false&quot;}"/>'
                         )  # 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="{&quot;date&quot;: {&quot;format&quot;: &quot;dd/mm/yyyy&quot;, &quot;clear&quot;: &quot;Clear&quot;, &quot;monthsFull&quot;: [&quot;Januar&quot;, &quot;Februar&quot;, &quot;M\\u00e4rz&quot;, &quot;April&quot;, &quot;Mai&quot;, &quot;Juni&quot;, &quot;Juli&quot;, &quot;August&quot;, &quot;September&quot;, &quot;Oktober&quot;, &quot;November&quot;, &quot;Dezember&quot;], &quot;weekdaysShort&quot;: [&quot;Mo&quot;, &quot;Di&quot;, &quot;Mi&quot;, &quot;Do&quot;, &quot;Fr&quot;, &quot;Sa&quot;, &quot;So&quot;], &quot;weekdaysFull&quot;: [&quot;Montag&quot;, &quot;Dienstag&quot;, &quot;Mittwoch&quot;, &quot;Donnerstag&quot;, &quot;Freitag&quot;, &quot;Samstag&quot;, &quot;Sonntag&quot;], &quot;monthsShort&quot;: [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mrz&quot;, &quot;Apr&quot;, &quot;Mai&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Okt&quot;, &quot;Nov&quot;, &quot;Dez&quot;], &quot;formatSubmit&quot;: &quot;dd-mm-yyyy&quot;, &quot;today&quot;: &quot;Today&quot;}, &quot;time&quot;: &quot;false&quot;}"/>'
                         )  # noqa
Ejemplo n.º 3
0
 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="{&quot;date&quot;: {&quot;formatSubmit&quot;: &quot;dd-mm-yyyy&quot;, &quot;format&quot;: &quot;dd/mm/yyyy&quot;}, &quot;time&quot;: &quot;false&quot;}"/>')  # noqa
Ejemplo n.º 4
0
 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="{&quot;date&quot;: {&quot;formatSubmit&quot;: &quot;dd-mm-yyyy&quot;, &quot;format&quot;: &quot;dd/mm/yyyy&quot;}, &quot;time&quot;: &quot;false&quot;}"/>'
                      )  # noqa