File tree Expand file tree Collapse file tree
tests/Browser/Playwright/Locator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5858 " rector --dry-run" ,
5959 " pint --test"
6060 ],
61- "test:unit" : " pest --parallel --coverage --exactly=84.8 " ,
61+ "test:unit" : " pest --parallel --coverage --exactly=84.6 " ,
6262 "test:types" : " phpstan" ,
6363 "test" : [
6464 " @test:lint" ,
Original file line number Diff line number Diff line change @@ -22,22 +22,6 @@ public function __construct(
2222 //
2323 }
2424
25- /**
26- * Check element.
27- */
28- public function check (): void
29- {
30- $ this ->processVoidResponse ($ this ->sendMessage ('check ' ));
31- }
32-
33- /**
34- * Uncheck element.
35- */
36- public function uncheck (): void
37- {
38- $ this ->processVoidResponse ($ this ->sendMessage ('uncheck ' ));
39- }
40-
4125 /**
4226 * Tap the element (touch screen interaction).
4327 *
Original file line number Diff line number Diff line change @@ -585,23 +585,6 @@ public function selectText(): void
585585 $ element ->selectText ();
586586 }
587587
588- /**
589- * Set the checked state of a checkbox or radio.
590- */
591- public function setChecked (bool $ checked ): void
592- {
593- $ element = $ this ->elementHandle ();
594- if (! $ element instanceof Element) {
595- throw new RuntimeException ('Element not found ' );
596- }
597-
598- if ($ checked ) {
599- $ element ->check ();
600- } else {
601- $ element ->uncheck ();
602- }
603- }
604-
605588 /**
606589 * Take a screenshot of the element.
607590 *
Original file line number Diff line number Diff line change 1717 $ page = page ()->goto ('/test/element-tests ' );
1818 $ checkbox = $ page ->getByTestId ('checkbox-input ' );
1919
20- $ checkbox ->setChecked ( true );
20+ $ checkbox ->check ( );
2121 expect ($ checkbox ->isChecked ())->toBeTrue ();
2222
23- $ checkbox ->setChecked ( false );
23+ $ checkbox ->uncheck ( );
2424 expect ($ checkbox ->isChecked ())->toBeFalse ();
2525
26- $ checkbox ->setChecked ( true );
26+ $ checkbox ->check ( );
2727 expect ($ checkbox ->isChecked ())->toBeTrue ();
2828});
2929
3535 ->toThrow (RuntimeException::class, 'Element not found ' );
3636});
3737
38- it ('throws RuntimeException when setChecked element is not found ' , function (): void {
39- $ page = page ()->goto ('/test/element-tests ' );
40- $ locator = $ page ->locator ('.non-existent-element ' );
4138
42- expect (fn () => $ locator ->setChecked (true ))
43- ->toThrow (RuntimeException::class, 'Element not found ' );
44- });
You can’t perform that action at this time.
0 commit comments