Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Taxonomy][Form] Taxon slug generator including parent slug also in update mode #15220

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 24 additions & 5 deletions features/taxonomy/managing_taxons/editing_taxon_slug.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: Editing taxon's slug
Then this taxon slug should be "mw"

@ui @javascript
Scenario: Creating a taxon with an autogenerated slug for parent
Scenario: Creating a child taxon with an autogenerated slug
Given the store has "Medieval weapons" taxonomy
When I want to create a new taxon for "Medieval weapons"
And I specify its code as "SIEGE_ENGINES"
Expand All @@ -35,7 +35,7 @@ Feature: Editing taxon's slug
Then this taxon slug should be "medieval-weapons/siege-engines"

@ui
Scenario: Creating a taxon with a custom slug for parent
Scenario: Creating a child taxon with a custom slug
Given the store has "Medieval weapons" taxonomy
When I want to create a new taxon for "Medieval weapons"
And I specify its code as "SIEGE_ENGINES"
Expand All @@ -59,7 +59,7 @@ Feature: Editing taxon's slug
Then the slug of the "Renaissance weapons" taxon should still be "medieval-weapons"

@ui @javascript
Scenario: Automatically changing a taxon's slug while editing a taxon's name
Scenario: Automatically changing a root taxon's slug while editing a taxon's name
Given the store has "Medieval weapons" taxonomy
When I want to modify the "Medieval weapons" taxon
And I enable slug modification
Expand All @@ -68,7 +68,17 @@ Feature: Editing taxon's slug
Then the slug of the "Renaissance weapons" taxon should be "renaissance-weapons"

@ui @javascript
Scenario: Manually changing a taxon's slug while editing a taxon's name
Scenario: Automatically changing a child taxon's slug while editing a taxon's name
Given the store has "Medieval weapons" taxonomy
And the "Medieval weapons" taxon has child taxon "Pikes"
When I want to modify the "Pikes" taxon
And I enable slug modification
And I rename it to "Javelins" in "English (United States)"
And I save my changes
Then the slug of the "Javelins" taxon should be "medieval-weapons/javelins"

@ui @javascript
Scenario: Manually changing a root taxon's slug while editing a taxon's name
Given the store has "Medieval weapons" taxonomy
When I want to modify the "Medieval weapons" taxon
And I enable slug modification
Expand All @@ -77,4 +87,13 @@ Feature: Editing taxon's slug
And I save my changes
Then the slug of the "Renaissance weapons" taxon should be "renaissance"


@ui @javascript
Scenario: Manually changing a child taxon's slug while editing a taxon's name
Given the store has "Medieval weapons" taxonomy
And the "Medieval weapons" taxon has child taxon "Pikes"
When I want to modify the "Pikes" taxon
And I enable slug modification
And I rename it to "Javelins" in "English (United States)"
And I set its slug to "javelins" in "English (United States)"
And I save my changes
Then the slug of the "Javelins" taxon should be "javelins"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ form_widget(slugField, {'attr': {'data-url': path('sylius_admin_ajax_generate_taxon_slug'), 'data-parent': app.request.attributes.get('id')}}) }}
{% else %}
<div class="ui action input">
{{ form_widget(slugField, {'attr': {'readonly': 'readonly', 'data-url': path('sylius_admin_ajax_generate_taxon_slug')}}) }}
{{ form_widget(slugField, {'attr': {'readonly': 'readonly', 'data-url': path('sylius_admin_ajax_generate_taxon_slug'), 'data-parent': resource.parent ? resource.parent.id : null}}) }}
<span class="ui icon button toggle-taxon-slug-modification">
<i class="lock icon"></i>
</span>
Expand Down