Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form interaction problems #11

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/BrowserTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,28 @@ public function can_save_source(): void
$this->assertStringContainsString('<h1>h1 title</h1>', $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);
Expand Down
10 changes: 10 additions & 0 deletions tests/Fixture/files/page1.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,15 @@ <h1>h1 title</h1>

<button>Submit</button>
</form>

<h1>Non-Form Inputs</h1>
<label for="input8">Input 8</label>
<input type="checkbox" id="input8" checked />

<h1>Inputs Without Name</h1>
<form>
<label for="input9">Input 9</label>
<input type="checkbox" id="input9" checked />
</form>
</body>
</html>