0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00

Add release notes for form data helpers

This commit is contained in:
Matt Westcott 2018-02-14 17:17:22 +00:00
parent 5962d3da0c
commit bed10c31cb
2 changed files with 27 additions and 0 deletions

View File

@ -55,6 +55,7 @@ Changelog
* Update React and related dependencies to latest versions (Janneke Janssen, Hugo van den Berg)
* Remove Hallo editor `.richtext` CSS class in favour of more explicit extension points (Thibaud Colas)
* Expose React-related dependencies as global variables for extension in the admin interface (Thibaud Colas)
* Added helper functions for constructing form data for use with `assertCanCreate` (Tim Heap, Matt Westcott)
* Fix: Do not remove stopwords when generating slugs from non-ASCII titles, to avoid issues with incorrect word boundaries (Sævar Öfjörð Magnússon)
* Fix: The PostgreSQL search backend now preserves ordering of the `QuerySet` when searching with `order_by_relevance=False` (Bertrand Bordage)
* Fix: Using `modeladmin_register` as a decorator no longer replaces the decorated class with `None` (Tim Heap)

View File

@ -72,6 +72,7 @@ Other features
* Simplified edit handler API (Florent Osmont, Bertrand Bordage)
* Made 'add/change/delete collection' permissions configurable from the group edit page (Matt Westcott)
* Expose React-related dependencies as global variables for extension in the admin interface (Thibaud Colas)
* Added helper functions for constructing form data for use with ``assertCanCreate``. See :ref:`form_data_test_helpers` (Tim Heap, Matt Westcott)
Bug fixes
@ -216,6 +217,31 @@ The Draftail rich text editor has a substantially different API from Hallo.js, i
}
Data format for rich text fields in ``assertCanCreate`` tests has been updated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``assertCanCreate`` test method (see :doc:`/advanced_topics/testing`) requires data to be passed in the same format that the page edit form would submit. The Draftail rich text editor posts this data in a non-HTML format, and so any existing ``assertCanCreate`` tests involving rich text fields will fail when Draftail is in use:
.. code-block:: python
self.assertCanCreate(root_page, ContentPage, {
'title': 'About us',
'body': '<p>Lorem ipsum dolor sit amet</p>', # will not work
})
Wagtail now provides a set of helper functions for constructing form data: see :ref:`form_data_test_helpers`. The above assertion can now be rewritten as:
.. code-block:: python
from wagtail.tests.utils.form_data import rich_text
self.assertCanCreate(root_page, ContentPage, {
'title': 'About us',
'body': rich_text('<p>Lorem ipsum dolor sit amet</p>'),
})
Removed support for Elasticsearch 1.x
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~