Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<target state="new">Delete</target>
<note>key: ibexa.chip.delete-btn.label</note>
</trans-unit>
<trans-unit id="61c7070a29f932eb0b1a343509d049aa52c92c09" resname="ibexa.clear-btn.label">
<trans-unit id="325602325410dfc0d83e43dec9a10976368c7154" resname="ibexa.clear-button.label">
<source>Clear</source>
<target state="new">Clear</target>
<note>key: ibexa.clear-btn.label</note>
<note>key: ibexa.clear-button.label</note>
</trans-unit>
<trans-unit id="8bd385b5e5cc2e1edee94e57245b6d8a42f50aac" resname="ibexa.dropdown.placeholder">
<source>Select an item</source>
Expand All @@ -36,6 +36,11 @@
<target state="new">Show</target>
<note>key: ibexa.expander.label.expand</note>
</trans-unit>
<trans-unit id="0af0c0b3e944e524dba4b327905685b9300f40e4" resname="ids.dropdown.placeholder">
<source>Select an item</source>
<target state="new">Select an item</target>
<note>key: ids.dropdown.placeholder</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
%}

{% set clear_action %}
<twig:ibexa:ui:clear_btn :disabled="disabled" />
<twig:ibexa:ui:clear_button :disabled="disabled" />
{% endset %}

{% set actions = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% trans_default_domain 'ibexa_design_system_twig' %}

{% set clear_msg = 'ibexa.clear-btn.label'|trans|desc('Clear') %}
{% set clear_msg = 'ibexa.clear-button.label'|trans|desc('Clear') %}

<twig:ibexa:button
type="tertiary-alt"
Expand Down
4 changes: 1 addition & 3 deletions src/lib/Twig/Components/AbstractDropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
abstract class AbstractDropdown
{
private const string TRANSLATION_DOMAIN = 'ibexa_design_system_twig';

public string $name;

public bool $disabled = false;
Expand Down Expand Up @@ -75,7 +73,7 @@ public function validate(array $props): array
/** @Desc("Select an item") */
'ids.dropdown.placeholder',
[],
self::TRANSLATION_DOMAIN
'ibexa_design_system_twig'
)
);
$resolver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
use Symfony\UX\TwigComponent\Attribute\PreMount;

#[AsTwigComponent('ibexa:ui:clear_btn')]
final class ClearBtn
#[AsTwigComponent('ibexa:ui:clear_button')]
final class ClearButton
{
public bool $disabled = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@

namespace Ibexa\Tests\Integration\DesignSystemTwig\Twig\Components\UI;

use Ibexa\DesignSystemTwig\Twig\Components\UI\ClearBtn;
use Ibexa\DesignSystemTwig\Twig\Components\UI\ClearButton;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\UX\TwigComponent\Test\InteractsWithTwigComponents;

final class ClearBtnTest extends KernelTestCase
final class ClearButtonTest extends KernelTestCase
{
use InteractsWithTwigComponents;

public function testMount(): void
{
$component = $this->mountTwigComponent(ClearBtn::class, ['disabled' => true]);
$component = $this->mountTwigComponent(ClearButton::class, ['disabled' => true]);

self::assertInstanceOf(ClearBtn::class, $component, 'Component should mount as UI\\ClearBtn.');
self::assertInstanceOf(ClearButton::class, $component, 'Component should mount as UI\\ClearButton.');
self::assertTrue($component->disabled, 'Prop "disabled" should be true.');
}

public function testDefaultRenderProducesConfiguredButton(): void
{
$crawler = $this->renderTwigComponent(ClearBtn::class)->crawler();
$crawler = $this->renderTwigComponent(ClearButton::class)->crawler();

$button = $this->getButton($crawler);
$class = $this->getClassAttr($button);
Expand All @@ -53,7 +53,7 @@ public function testDefaultRenderProducesConfiguredButton(): void

public function testDisabledTrueAddsAttributeAndClass(): void
{
$crawler = $this->renderTwigComponent(ClearBtn::class, ['disabled' => true])->crawler();
$crawler = $this->renderTwigComponent(ClearButton::class, ['disabled' => true])->crawler();

$button = $this->getButton($crawler);
$class = $this->getClassAttr($button);
Expand All @@ -65,7 +65,7 @@ public function testDisabledTrueAddsAttributeAndClass(): void
public function testInvalidDisabledTypeCausesResolverErrorOnMount(): void
{
$this->expectException(InvalidOptionsException::class);
$this->mountTwigComponent(ClearBtn::class, ['disabled' => 'yes']);
$this->mountTwigComponent(ClearButton::class, ['disabled' => 'yes']);
}

private function getButton(Crawler $crawler): Crawler
Expand Down