Skip to content

Commit d5f798b

Browse files
committed
Merge branch '4.x' of https://github.com/filamentphp/filament into 4.x
2 parents bb23bb6 + 480786b commit d5f798b

4 files changed

Lines changed: 17 additions & 1 deletion

File tree

packages/schemas/src/Components/Concerns/CanTrimState.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Filament\Schemas\Components\Concerns;
44

55
use Closure;
6+
use Illuminate\Support\Str;
67

78
trait CanTrimState
89
{
@@ -32,6 +33,6 @@ protected function trimState(mixed $state): mixed
3233
return $state;
3334
}
3435

35-
return trim($state);
36+
return Str::trim($state);
3637
}
3738
}

tests/src/Forms/Components/TagsInputTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
[null, null],
2727
[[], []],
2828
[[' tag1 ', 123, ' tag2 '], ['tag1', 123, 'tag2']],
29+
[["\t tag1 \n", "\n tag2 \t"], ['tag1', 'tag2']],
30+
[[' tag1 ', ' tag2 '], ['tag1', 'tag2']],
31+
[[" \t tag1 \n ", "  tag2\t "], ['tag1', 'tag2']],
32+
[[' ', "\t\n "], ['', '']],
33+
[[' tag1 ', null, true, ' tag2 '], ['tag1', null, true, 'tag2']],
2934
]);
3035

3136
it('can strip characters from TagsInput array values', function (mixed $input, mixed $expected): void {

tests/src/Forms/Components/TextInputTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
[null, null],
2828
['', ''],
2929
[123, 123],
30+
["\t test value \n", 'test value'],
31+
[' test value ', 'test value'],
32+
[" \t test value \n ", 'test value'],
33+
[' ', ''],
34+
["\t\n ", ''],
3035
]);
3136

3237
it('can strip characters before applying `numeric()` state cast', function (mixed $input, mixed $expected): void {

tests/src/Forms/Components/TextareaTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
[null, null],
2727
['', ''],
2828
[123, 123],
29+
["\t test content \n", 'test content'],
30+
[' test content ', 'test content'],
31+
[" \t test content \n ", 'test content'],
32+
[' ', ''],
33+
["\t\n ", ''],
2934
]);
3035

3136
it('can set `autosize()`', function (): void {

0 commit comments

Comments
 (0)