From c4dd2cd0f89f6a63cd24f127a6f6a3b0504d4884 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Wed, 23 Dec 2020 16:31:36 -0500 Subject: [PATCH] [bug] demonstrate some form issues: - cannot access fields not in a
- cannot access fields without name attribute --- tests/BrowserTests.php | 22 ++++++++++++++++++++++ tests/Fixture/files/page1.html | 10 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/tests/BrowserTests.php b/tests/BrowserTests.php index b6d4e5c..d47dca6 100644 --- a/tests/BrowserTests.php +++ b/tests/BrowserTests.php @@ -211,6 +211,28 @@ public function can_save_source(): void $this->assertStringContainsString('

h1 title

', $contents); } + /** + * @test + */ + public function can_interact_with_inputs_not_in_form_element(): void + { + $this->browser() + ->visit('/page1') + ->assertChecked('Input 8') + ; + } + + /** + * @test + */ + public function can_interact_with_inputs_without_name_attribute(): void + { + $this->browser() + ->visit('/page1') + ->assertChecked('Input 9') + ; + } + protected static function catchFileContents(string $expectedFile, callable $callback): string { (new Filesystem())->remove($expectedFile); diff --git a/tests/Fixture/files/page1.html b/tests/Fixture/files/page1.html index 2b7c703..1e6934a 100644 --- a/tests/Fixture/files/page1.html +++ b/tests/Fixture/files/page1.html @@ -47,5 +47,15 @@

h1 title

+ +

Non-Form Inputs

+ + + +

Inputs Without Name

+
+ + +