mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Choose menu taxon on channel form
This commit is contained in:
parent
9b86215312
commit
9b6ce70599
7 changed files with 19 additions and 9 deletions
|
|
@ -11,15 +11,11 @@ Feature: Adding a new channel with menu taxon
|
|||
And the store classifies its products as "Clothes" and "Guns"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @javascript
|
||||
Scenario: Adding a new channel with menu taxon
|
||||
Given I want to create a new channel
|
||||
When I specify its code as "MOBILE"
|
||||
And I name it "Mobile channel"
|
||||
And I choose "Euro" as the base currency
|
||||
And I choose "English (United States)" as a default locale
|
||||
And I specify company as "Ragnarok"
|
||||
And I specify tax ID as "1100110011"
|
||||
And I specify menu taxon as "Clothes"
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Feature: Editing menu taxon on channel
|
|||
And channel "Web Store" has menu taxon "Clothes"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
@ui @javascript
|
||||
Scenario: Editing menu taxon on the channel
|
||||
When I want to modify a channel "Web Store"
|
||||
And I change its menu taxon to "Guns"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use Sylius\Behat\Behaviour\NamesIt;
|
|||
use Sylius\Behat\Behaviour\SpecifiesItsCode;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
|
||||
use Sylius\Behat\Service\AutocompleteHelper;
|
||||
|
||||
class CreatePage extends BaseCreatePage implements CreatePageInterface
|
||||
{
|
||||
|
|
@ -94,7 +95,9 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
|
||||
public function specifyMenuTaxon(string $menuTaxon): void
|
||||
{
|
||||
$this->getElement('menu_taxon')->selectOption($menuTaxon);
|
||||
$menuTaxonElement = $this->getElement('menu_taxon')->getParent();
|
||||
|
||||
AutocompleteHelper::chooseValue($this->getSession(), $menuTaxonElement, $menuTaxon);
|
||||
}
|
||||
|
||||
protected function getToggleableElement(): NodeElement
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use Behat\Mink\Element\NodeElement;
|
|||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
use Sylius\Behat\Service\AutocompleteHelper;
|
||||
|
||||
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||
{
|
||||
|
|
@ -99,12 +100,14 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
|
||||
public function changeMenuTaxon(string $menuTaxon): void
|
||||
{
|
||||
$this->getElement('menu_taxon')->selectOption($menuTaxon);
|
||||
$menuTaxonElement = $this->getElement('menu_taxon')->getParent();
|
||||
|
||||
AutocompleteHelper::chooseValue($this->getSession(), $menuTaxonElement, $menuTaxon);
|
||||
}
|
||||
|
||||
public function getMenuTaxon(): string
|
||||
{
|
||||
return $this->getElement('menu_taxon')->find('css', 'option:selected')->getText();
|
||||
return $this->getElement('menu_taxon')->getParent()->find('css', '.search > .text')->getText();
|
||||
}
|
||||
|
||||
public function getUsedTheme(): string
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@
|
|||
{{ form_row(form.locales) }}
|
||||
{{ form_row(form.defaultLocale) }}
|
||||
</div>
|
||||
<div class="ui attached segment">
|
||||
{{ form_row(form.menuTaxon) }}
|
||||
</div>
|
||||
<div class="ui hidden divider"></div>
|
||||
<div class="ui attached segment">
|
||||
{{ form_row(form.skippingShippingStepAllowed) }}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use Sylius\Bundle\CoreBundle\Form\Type\ShopBillingDataType;
|
|||
use Sylius\Bundle\CoreBundle\Form\Type\TaxCalculationStrategyChoiceType;
|
||||
use Sylius\Bundle\CurrencyBundle\Form\Type\CurrencyChoiceType;
|
||||
use Sylius\Bundle\LocaleBundle\Form\Type\LocaleChoiceType;
|
||||
use Sylius\Bundle\TaxonomyBundle\Form\Type\TaxonAutocompleteChoiceType;
|
||||
use Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType;
|
||||
use Sylius\Component\Core\Model\Scope;
|
||||
use Symfony\Component\Form\AbstractTypeExtension;
|
||||
|
|
@ -86,6 +87,9 @@ final class ChannelTypeExtension extends AbstractTypeExtension
|
|||
->add('shopBillingData', ShopBillingDataType::class, [
|
||||
'label' => 'sylius.form.channel.shop_billing_data',
|
||||
])
|
||||
->add('menuTaxon', TaxonAutocompleteChoiceType::class, [
|
||||
'label' => 'sylius.form.channel.menu_taxon',
|
||||
])
|
||||
->addEventSubscriber(new AddBaseCurrencySubscriber())
|
||||
->addEventSubscriber(new ChannelFormSubscriber())
|
||||
;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ sylius:
|
|||
hostname: Hostname
|
||||
locale_default: Default locale
|
||||
locales: Locales
|
||||
menu_taxon: Menu taxon
|
||||
payment_methods: Payment Methods
|
||||
shipping_methods: Shipping Methods
|
||||
shop_billing_data: Shop billing data
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue