Skip to content

Commit b4632b7

Browse files
Add assertIndeterminate assertion for checkbox. (#986)
* Add `assertIndeterminate` assertion for checkbox. Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * Update MakesAssertions.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent f8ef634 commit b4632b7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Concerns/MakesAssertions.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,26 @@ public function assertNotChecked($field, $value = null)
486486
return $this;
487487
}
488488

489+
/**
490+
* Assert that the given checkbox is in an indeterminate state.
491+
*
492+
* @param string $field
493+
* @param string|null $value
494+
* @return $this
495+
*/
496+
public function assertIndeterminate($field, $value = null)
497+
{
498+
$this->assertNotChecked($field, $value);
499+
500+
PHPUnit::assertSame(
501+
'true',
502+
$this->resolver->findOrFail($field)->getAttribute('indeterminate'),
503+
"Checkbox [{$field}] was not in indeterminate state."
504+
);
505+
506+
return $this;
507+
}
508+
489509
/**
490510
* Assert that the given radio field is selected.
491511
*

0 commit comments

Comments
 (0)