Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Commit dc80f5c

Browse files
committed
Refactor
1 parent 5969e9f commit dc80f5c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

app/tests/Browser/Form/LibrariesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function it_can_change_the_default_bound_values()
3737
->assertSeeIn('div[data-select-name="countries[]"] .choices__list--multiple', 'Germany')
3838
->assertSeeIn('div[data-select-name="countries[]"] .choices__list--multiple', 'Italy')
3939
->assertInputValue('date', '2022-08-22')
40-
->assertInputValue('time', '3:14')
41-
->assertInputValue('datetime', '2022-08-22 3:14')
40+
->assertInputValue('time', '03:14')
41+
->assertInputValue('datetime', '2022-08-22 03:14')
4242
->assertInputValue('daterange', '2022-08-22 to 2022-09-22');
4343
});
4444
}

src/Components/Form.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ public static function selected($name, $value): bool
8585

8686
$instance = Arr::last(static::$instances);
8787

88-
$data = $instance->guardedData() ?: $instance->defaultData();
88+
$data = data_get(
89+
$instance->guardedData() ?: $instance->defaultData(),
90+
static::dottedName($name)
91+
);
8992

90-
return data_get($data, static::dottedName($name)) === $value;
93+
return is_array($data) ? in_array($value, $data, true) : $data === $value;
9194
}
9295

9396
public static function defaultUnguarded(bool $state = true)

0 commit comments

Comments
 (0)