Fix subsequent slugify / title sync values for non-ascii characters

- Wagtail 5.0 regression where subsequent changes to slugify field from a sync source were not comparing against the originally set urlify'd value
- Fixes #10532
- Regression caused by migration of 'slugFollowsTitle' approach not consistently comparing to the urlify version of the util on when the user focuses on the title field, broke in #10189
pull/10567/head
LB Johnston 2023-06-11 12:57:26 +10:00 zatwierdzone przez Matt Westcott
rodzic 741c272819
commit ccec24b888
3 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -1579,7 +1579,7 @@ class TestPageEdit(WagtailTestUtils, TestCase):
reverse("wagtailadmin_pages:edit", args=(self.child_page.id,))
)
input_field_for_draft_slug = '<input type="text" name="slug" value="revised-slug-in-draft-only" data-controller="w-slug" data-action="blur-&gt;w-slug#slugify w-sync:check-&gt;w-slug#compare w-sync:apply-&gt;w-slug#urlify:prevent" data-w-slug-allow-unicode-value maxlength="255" aria-describedby="panel-child-promote-child-for_search_engines-child-slug-helptext" required id="id_slug">'
input_field_for_draft_slug = '<input type="text" name="slug" value="revised-slug-in-draft-only" data-controller="w-slug" data-action="blur-&gt;w-slug#slugify w-sync:check-&gt;w-slug#compare w-sync:apply-&gt;w-slug#urlify:prevent" data-w-slug-compare-as-param="urlify" data-w-slug-allow-unicode-value maxlength="255" aria-describedby="panel-child-promote-child-for_search_engines-child-slug-helptext" required id="id_slug">'
input_field_for_live_slug = '<input type="text" name="slug" value="hello-world" maxlength="255" aria-describedby="panel-child-promote-child-for_search_engines-child-slug-helptext" required id="id_slug" />'
# Status Link should be the live page (not revision)

Wyświetl plik

@ -660,7 +660,7 @@ class TestSlugInput(TestCase):
html = widget.render("test", None, attrs={"id": "test-id"})
self.assertInHTML(
'<input type="text" name="test" data-controller="w-slug" data-action="blur-&gt;w-slug#slugify w-sync:check-&gt;w-slug#compare w-sync:apply-&gt;w-slug#urlify:prevent" data-w-slug-allow-unicode-value id="test-id">',
'<input type="text" name="test" data-controller="w-slug" data-action="blur-&gt;w-slug#slugify w-sync:check-&gt;w-slug#compare w-sync:apply-&gt;w-slug#urlify:prevent" data-w-slug-allow-unicode-value data-w-slug-compare-as-param="urlify" id="test-id">',
html,
)

Wyświetl plik

@ -10,6 +10,7 @@ class SlugInput(widgets.TextInput):
"data-w-slug-allow-unicode-value": getattr(
settings, "WAGTAIL_ALLOW_UNICODE_SLUGS", True
),
"data-w-slug-compare-as-param": "urlify",
}
if attrs:
default_attrs.update(attrs)