diff --git a/src/Infolists/Components/MoneyEntry.php b/src/Infolists/Components/MoneyEntry.php index a298a99..bef459e 100644 --- a/src/Infolists/Components/MoneyEntry.php +++ b/src/Infolists/Components/MoneyEntry.php @@ -27,7 +27,7 @@ protected function setUp(): void }); } - public function short($showCurrencySymbol = true): static + public function short(bool $showCurrencySymbol = true): static { $this->formatStateUsing(function (MoneyEntry $component, null|int|string $state) use ($showCurrencySymbol) { return MoneyFormatter::formatShort( diff --git a/src/Tables/Columns/MoneyColumn.php b/src/Tables/Columns/MoneyColumn.php index 1e05560..b1b9e05 100644 --- a/src/Tables/Columns/MoneyColumn.php +++ b/src/Tables/Columns/MoneyColumn.php @@ -27,7 +27,7 @@ protected function setUp(): void }); } - public function short($showCurrencySymbol = true): static + public function short(bool $showCurrencySymbol = true): static { $this->formatStateUsing(function (MoneyColumn $component, null|int|string $state) use ($showCurrencySymbol) { return MoneyFormatter::formatShort( diff --git a/tests/MoneyEntryTest.php b/tests/MoneyEntryTest.php index 3e7064d..a6688af 100644 --- a/tests/MoneyEntryTest.php +++ b/tests/MoneyEntryTest.php @@ -33,8 +33,8 @@ $entry = MoneyEntry::make('price')->short(); $component = ComponentContainer::make(InfolistTestComponent::make()) - ->components([$entry]) - ->state([$entry->getName() => 123456789]); + ->components([$entry]) + ->state([$entry->getName() => 123456789]); $entry = $component->getComponent('price'); @@ -45,8 +45,8 @@ $entry = MoneyEntry::make('price')->short()->decimals(4); $component = ComponentContainer::make(InfolistTestComponent::make()) - ->components([$entry]) - ->state([$entry->getName() => 123456789]); + ->components([$entry]) + ->state([$entry->getName() => 123456789]); $entry = $component->getComponent('price'); @@ -65,13 +65,12 @@ expect($entry->formatState($entry->getState()))->toEqual(replaceNonBreakingSpaces('1,23K kr')); }); - it('formats infolist money in sek with no decimals', function () { $entry = MoneyEntry::make('price')->currency('SEK')->locale('sv_SE')->decimals(0); $component = ComponentContainer::make(InfolistTestComponent::make()) - ->components([$entry]) - ->state([$entry->getName() => 1000000]); + ->components([$entry]) + ->state([$entry->getName() => 1000000]); $entry = $component->getComponent('price');