Skip to content

Commit

Permalink
[fc] Repository: plone.app.z3cform
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2017-02-10T00:48:51+01:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: plone/plone.app.z3cform@f2f829c

Test fixes for plone.app.widgets 2.1.

Files changed:
M CHANGES.rst
M plone/app/z3cform/tests/test_widgets.py
Repository: plone.app.z3cform
Branch: refs/heads/master
Date: 2017-02-10T01:04:46+01:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: plone/plone.app.z3cform@a807cf4

Do not show the Clear button for required Date or DateTime fields.

Files changed:
M CHANGES.rst
M plone/app/z3cform/tests/test_widgets.py
M plone/app/z3cform/widget.py
Repository: plone.app.z3cform
Branch: refs/heads/master
Date: 2017-02-10T11:03:47+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.z3cform@c899002

Merge pull request #60 from plone/thet-pawidgets

pickadate optimizations

Files changed:
M CHANGES.rst
M plone/app/z3cform/tests/test_widgets.py
M plone/app/z3cform/widget.py
  • Loading branch information
jensens committed Feb 10, 2017
1 parent 6af565c commit 2c390fa
Showing 1 changed file with 225 additions and 37 deletions.
262 changes: 225 additions & 37 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
Repository: Products.Archetypes
Repository: plone.app.z3cform


Branch: refs/heads/master
Date: 2017-02-10T00:47:46+01:00
Date: 2017-02-10T00:48:51+01:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: https://github.com/plone/Products.Archetypes/commit/2fdcca0dd9457e56141e8bedd9a741e94a509694
Commit: https://github.com/plone/plone.app.z3cform/commit/f2f829cede913647b955eb0dcc2619e6eeb54f9d

Fix tests to work with latest plone.app.widgets 2.1.
Test fixes for plone.app.widgets 2.1.

Files changed:
M Products/Archetypes/tests/test_pawidgets.py
M CHANGES.rst
M plone/app/z3cform/tests/test_widgets.py

diff --git a/Products/Archetypes/tests/test_pawidgets.py b/Products/Archetypes/tests/test_pawidgets.py
index cb5e32f..101f7b8 100644
--- a/Products/Archetypes/tests/test_pawidgets.py
+++ b/Products/Archetypes/tests/test_pawidgets.py
@@ -90,7 +90,6 @@ def test_widget(self):
diff --git a/CHANGES.rst b/CHANGES.rst
index 3a8ab1f..bcb29c7 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,6 +14,9 @@ New features:

Bug fixes:

+- Test fixes for plone.app.widgets 2.1.
+ [thet]
+
- remove deprecated __of__ for browserviews
[pbauer]

diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py
index d6c94c1..9cbd095 100644
--- a/plone/app/z3cform/tests/test_widgets.py
+++ b/plone/app/z3cform/tests/test_widgets.py
@@ -164,7 +164,6 @@ def test_widget(self):
'firstDay': 0,
'min': [current_year - 100, 1, 1],
'max': [current_year + 20, 1, 1],
- 'clear': u'Clear',
'format': 'mmmm d, yyyy',
'monthsFull': [u'January', u'February', u'March',
u'April', u'May', u'June', u'July',
@@ -101,14 +100,16 @@ def test_widget(self):
@@ -175,14 +174,15 @@ def test_widget(self):
'weekdaysFull': [u'Sunday', u'Monday', u'Tuesday',
u'Wednesday', u'Thursday', u'Friday',
u'Saturday'],
Expand All @@ -38,69 +53,194 @@ index cb5e32f..101f7b8 100644
+ 'time': False,
+ 'today': u'Today',
+ 'clear': u'Clear',
+
}
},
self.widget._base_args(self.context, self.field, self.request),
@@ -160,7 +161,6 @@ def test_widget(self):
self.widget._base_args(),
@@ -258,7 +258,6 @@ def test_widget(self):
'firstDay': 0,
'min': [current_year - 100, 1, 1],
'max': [current_year + 20, 1, 1],
- 'clear': u'Clear',
'format': 'mmmm d, yyyy',
'monthsFull': [u'January', u'February', u'March',
u'April', u'May', u'June', u'July',
@@ -171,7 +171,6 @@ def test_widget(self):
@@ -269,7 +268,6 @@ def test_widget(self):
'weekdaysFull': [u'Sunday', u'Monday', u'Tuesday',
u'Wednesday', u'Thursday', u'Friday',
u'Saturday'],
- 'today': u'Today',
'selectYears': 200,
'placeholder': u'Enter date...',
'monthsShort': [u'Jan', u'Feb', u'Mar', u'Apr', u'May',
@@ -180,9 +179,10 @@ def test_widget(self):
@@ -278,10 +276,11 @@ def test_widget(self):
},
'time': {
'placeholder': u'Enter time...',
- 'today': u'Today',
'format': 'h:i a'
'format': 'h:i a',
'interval': 15
- }
+ },
+ 'today': u'Today',
+ 'clear': u'Clear',
}
},
self.widget._base_args(self.context, self.field, self.request),
self.widget._base_args(),


Repository: plone.app.z3cform


Branch: refs/heads/master
Date: 2017-02-10T01:04:46+01:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: https://github.com/plone/plone.app.z3cform/commit/a807cf4f57bd0bd68899ced2f606d383cde10f8e

Do not show the Clear button for required Date or DateTime fields.

Files changed:
M CHANGES.rst
M plone/app/z3cform/tests/test_widgets.py
M plone/app/z3cform/widget.py

diff --git a/CHANGES.rst b/CHANGES.rst
index bcb29c7..7379430 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -10,7 +10,8 @@ Breaking changes:

New features:

-- *add item here*
+- Do not show the "Clear" button for required Date or DateTime fields.
+ [thet]

Bug fixes:

diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py
index 9cbd095..61a3e01 100644
--- a/plone/app/z3cform/tests/test_widgets.py
+++ b/plone/app/z3cform/tests/test_widgets.py
@@ -148,6 +148,7 @@ def setUp(self):

self.request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'})
self.field = Date(__name__='datefield')
+ self.field.required = False
self.widget = DateWidget(self.request)
self.widget.field = self.field
self.widget.pattern_options = {'date': {'firstDay': 0}}
@@ -188,6 +189,13 @@ def test_widget(self):
self.widget._base_args(),
)

+ def test_widget_required(self):
+ """Required fields should not have a "Clear" button.
+ """
+ self.field.required = True
+ base_args = self.widget._base_args()
+ self.assertEqual(base_args['pattern_options']['clear'], False)
+
def test_data_converter(self):
from plone.app.z3cform.widget import DateWidgetConverter
converter = DateWidgetConverter(self.field, self.widget)
@@ -240,7 +248,9 @@ def setUp(self):

self.request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'})
self.field = Datetime(__name__='datetimefield')
+ self.field.required = False
self.widget = DatetimeWidget(self.request)
+ self.widget.field = self.field
self.widget.pattern_options = {
'date': {'firstDay': 0},
'time': {'interval': 15}
@@ -286,6 +296,13 @@ def test_widget(self):
self.widget._base_args(),
)

+ def test_widget_required(self):
+ """Required fields should not have a "Clear" button.
+ """
+ self.field.required = True
+ base_args = self.widget._base_args()
+ self.assertEqual(base_args['pattern_options']['clear'], False)
+
def test_data_converter(self):
from plone.app.z3cform.widget import DatetimeWidgetConverter
converter = DatetimeWidgetConverter(self.field, self.widget)
diff --git a/plone/app/z3cform/widget.py b/plone/app/z3cform/widget.py
index 56cec14..9d8406e 100644
--- a/plone/app/z3cform/widget.py
+++ b/plone/app/z3cform/widget.py
@@ -135,6 +135,9 @@ def _base_args(self):
self.value) or u'').strip()

args.setdefault('pattern_options', {})
+ if self.field.required:
+ # Required fields should not have a "Clear" button
+ args['pattern_options']['clear'] = False
args['pattern_options'] = dict_merge(
get_date_options(self.request),
args['pattern_options'])


Repository: Products.Archetypes
Repository: plone.app.z3cform


Branch: refs/heads/master
Date: 2017-02-10T11:03:37+01:00
Date: 2017-02-10T11:03:47+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/Products.Archetypes/commit/0785edf622d14466bfc20f02a21f2817578cc3c8
Commit: https://github.com/plone/plone.app.z3cform/commit/c899002f4604e64e21d56565108bc6beee071b55

Merge pull request #78 from plone/thet-fixtests
Merge pull request #60 from plone/thet-pawidgets

Fix tests to work with latest plone.app.widgets 2.1.
pickadate optimizations

Files changed:
M Products/Archetypes/tests/test_pawidgets.py
M CHANGES.rst
M plone/app/z3cform/tests/test_widgets.py
M plone/app/z3cform/widget.py

diff --git a/Products/Archetypes/tests/test_pawidgets.py b/Products/Archetypes/tests/test_pawidgets.py
index cb5e32f..101f7b8 100644
--- a/Products/Archetypes/tests/test_pawidgets.py
+++ b/Products/Archetypes/tests/test_pawidgets.py
@@ -90,7 +90,6 @@ def test_widget(self):
diff --git a/CHANGES.rst b/CHANGES.rst
index 3a8ab1f..7379430 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -10,10 +10,14 @@ Breaking changes:

New features:

-- *add item here*
+- Do not show the "Clear" button for required Date or DateTime fields.
+ [thet]

Bug fixes:

+- Test fixes for plone.app.widgets 2.1.
+ [thet]
+
- remove deprecated __of__ for browserviews
[pbauer]

diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py
index d6c94c1..61a3e01 100644
--- a/plone/app/z3cform/tests/test_widgets.py
+++ b/plone/app/z3cform/tests/test_widgets.py
@@ -148,6 +148,7 @@ def setUp(self):

self.request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'})
self.field = Date(__name__='datefield')
+ self.field.required = False
self.widget = DateWidget(self.request)
self.widget.field = self.field
self.widget.pattern_options = {'date': {'firstDay': 0}}
@@ -164,7 +165,6 @@ def test_widget(self):
'firstDay': 0,
'min': [current_year - 100, 1, 1],
'max': [current_year + 20, 1, 1],
- 'clear': u'Clear',
'format': 'mmmm d, yyyy',
'monthsFull': [u'January', u'February', u'March',
u'April', u'May', u'June', u'July',
@@ -101,14 +100,16 @@ def test_widget(self):
@@ -175,19 +175,27 @@ def test_widget(self):
'weekdaysFull': [u'Sunday', u'Monday', u'Tuesday',
u'Wednesday', u'Thursday', u'Friday',
u'Saturday'],
Expand All @@ -115,38 +255,86 @@ index cb5e32f..101f7b8 100644
+ 'time': False,
+ 'today': u'Today',
+ 'clear': u'Clear',
+
}
},
self.widget._base_args(self.context, self.field, self.request),
@@ -160,7 +161,6 @@ def test_widget(self):
self.widget._base_args(),
)

+ def test_widget_required(self):
+ """Required fields should not have a "Clear" button.
+ """
+ self.field.required = True
+ base_args = self.widget._base_args()
+ self.assertEqual(base_args['pattern_options']['clear'], False)
+
def test_data_converter(self):
from plone.app.z3cform.widget import DateWidgetConverter
converter = DateWidgetConverter(self.field, self.widget)
@@ -240,7 +248,9 @@ def setUp(self):

self.request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'})
self.field = Datetime(__name__='datetimefield')
+ self.field.required = False
self.widget = DatetimeWidget(self.request)
+ self.widget.field = self.field
self.widget.pattern_options = {
'date': {'firstDay': 0},
'time': {'interval': 15}
@@ -258,7 +268,6 @@ def test_widget(self):
'firstDay': 0,
'min': [current_year - 100, 1, 1],
'max': [current_year + 20, 1, 1],
- 'clear': u'Clear',
'format': 'mmmm d, yyyy',
'monthsFull': [u'January', u'February', u'March',
u'April', u'May', u'June', u'July',
@@ -171,7 +171,6 @@ def test_widget(self):
@@ -269,7 +278,6 @@ def test_widget(self):
'weekdaysFull': [u'Sunday', u'Monday', u'Tuesday',
u'Wednesday', u'Thursday', u'Friday',
u'Saturday'],
- 'today': u'Today',
'selectYears': 200,
'placeholder': u'Enter date...',
'monthsShort': [u'Jan', u'Feb', u'Mar', u'Apr', u'May',
@@ -180,9 +179,10 @@ def test_widget(self):
@@ -278,15 +286,23 @@ def test_widget(self):
},
'time': {
'placeholder': u'Enter time...',
- 'today': u'Today',
'format': 'h:i a'
'format': 'h:i a',
'interval': 15
- }
+ },
+ 'today': u'Today',
+ 'clear': u'Clear',
}
},
self.widget._base_args(self.context, self.field, self.request),
self.widget._base_args(),
)

+ def test_widget_required(self):
+ """Required fields should not have a "Clear" button.
+ """
+ self.field.required = True
+ base_args = self.widget._base_args()
+ self.assertEqual(base_args['pattern_options']['clear'], False)
+
def test_data_converter(self):
from plone.app.z3cform.widget import DatetimeWidgetConverter
converter = DatetimeWidgetConverter(self.field, self.widget)
diff --git a/plone/app/z3cform/widget.py b/plone/app/z3cform/widget.py
index 56cec14..9d8406e 100644
--- a/plone/app/z3cform/widget.py
+++ b/plone/app/z3cform/widget.py
@@ -135,6 +135,9 @@ def _base_args(self):
self.value) or u'').strip()

args.setdefault('pattern_options', {})
+ if self.field.required:
+ # Required fields should not have a "Clear" button
+ args['pattern_options']['clear'] = False
args['pattern_options'] = dict_merge(
get_date_options(self.request),
args['pattern_options'])


0 comments on commit 2c390fa

Please sign in to comment.