Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:

name: build

permissions:
contents: read

jobs:
phpunit:
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.1.1 under development

- no changes in this release.
- Enh #89: Add support for `yiisoft/html` version `^4.0` (@vjik)

## 1.1.0 December 23, 2025

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ext-mbstring": "*",
"psr/http-message": "^1.0 || ^2.0",
"yiisoft/form": "^1.0",
"yiisoft/html": "^3.3",
"yiisoft/html": "^3.3 || ^4.0",
"yiisoft/hydrator": "^1.3",
"yiisoft/strings": "^2.3",
"yiisoft/validator": "^2.5"
Expand Down
72 changes: 36 additions & 36 deletions tests/FieldFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testCheckbox(): void
$this->assertSame(
<<<HTML
<div>
<input type="hidden" name="TestForm[blue]" value="0"><label><input type="checkbox" id="testform-blue" name="TestForm[blue]" value="1"> Blue color</label>
<input type="hidden" name="TestForm[blue]" value="0"><label><input name="TestForm[blue]" value="1" id="testform-blue" type="checkbox"> Blue color</label>
</div>
HTML,
$result,
Expand All @@ -130,7 +130,7 @@ public function testCheckboxWithTheme(): void
$this->assertSame(
<<<HTML
<div class="green">
<input type="hidden" name="TestForm[blue]" value="0"><label><input type="checkbox" id="testform-blue" name="TestForm[blue]" value="1"> Blue color</label>
<input type="hidden" name="TestForm[blue]" value="0"><label><input name="TestForm[blue]" value="1" id="testform-blue" type="checkbox"> Blue color</label>
</div>
HTML,
$result,
Expand All @@ -150,8 +150,8 @@ public function testCheckboxList(): void
<div>
<label>Select one or more colors</label>
<div>
<label><input type="checkbox" name="TestForm[color2][]" value="red"> Red</label>
<label><input type="checkbox" name="TestForm[color2][]" value="blue"> Blue</label>
<label><input name="TestForm[color2][]" value="red" type="checkbox"> Red</label>
<label><input name="TestForm[color2][]" value="blue" type="checkbox"> Blue</label>
</div>
</div>
HTML;
Expand Down Expand Up @@ -181,8 +181,8 @@ public function testCheckboxListWithTheme(): void
<div class="green">
<label>Select one or more colors</label>
<div>
<label><input type="checkbox" name="TestForm[color2][]" value="red"> Red</label>
<label><input type="checkbox" name="TestForm[color2][]" value="blue"> Blue</label>
<label><input name="TestForm[color2][]" value="red" type="checkbox"> Red</label>
<label><input name="TestForm[color2][]" value="blue" type="checkbox"> Blue</label>
</div>
</div>
HTML;
Expand All @@ -197,7 +197,7 @@ public function testDate(): void
<<<HTML
<div>
<label for="testform-birthday">Birthday</label>
<input type="date" id="testform-birthday" name="TestForm[birthday]" value="1996-12-19">
<input type="date" name="TestForm[birthday]" value="1996-12-19" id="testform-birthday">
</div>
HTML,
$result,
Expand All @@ -220,7 +220,7 @@ public function testDateWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-birthday">Birthday</label>
<input type="date" id="testform-birthday" name="TestForm[birthday]" value="1996-12-19">
<input type="date" name="TestForm[birthday]" value="1996-12-19" id="testform-birthday">
</div>
HTML,
$result,
Expand All @@ -234,7 +234,7 @@ public function testDateTimeLocal(): void
<<<HTML
<div>
<label for="testform-partydate">Date of party</label>
<input type="datetime-local" id="testform-partydate" name="TestForm[partyDate]" value="2017-06-01T08:30">
<input type="datetime-local" name="TestForm[partyDate]" value="2017-06-01T08:30" id="testform-partydate">
</div>
HTML,
$result,
Expand All @@ -257,7 +257,7 @@ public function testDateTimeLocalWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-partydate">Date of party</label>
<input type="datetime-local" id="testform-partydate" name="TestForm[partyDate]" value="2017-06-01T08:30">
<input type="datetime-local" name="TestForm[partyDate]" value="2017-06-01T08:30" id="testform-partydate">
</div>
HTML,
$result,
Expand All @@ -271,7 +271,7 @@ public function testEmail(): void
<<<HTML
<div>
<label for="testform-mainemail">Main email</label>
<input type="email" id="testform-mainemail" name="TestForm[mainEmail]" value>
<input type="email" name="TestForm[mainEmail]" value id="testform-mainemail">
<div>Email for notifications.</div>
</div>
HTML,
Expand All @@ -295,7 +295,7 @@ public function testEmailWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-mainemail">Main email</label>
<input type="email" id="testform-mainemail" name="TestForm[mainEmail]" value>
<input type="email" name="TestForm[mainEmail]" value id="testform-mainemail">
<div>Email for notifications.</div>
</div>
HTML,
Expand Down Expand Up @@ -398,7 +398,7 @@ public function testFile(): void
<<<HTML
<div>
<label for="testform-avatar">Avatar</label>
<input type="file" id="testform-avatar" name="TestForm[avatar]">
<input name="TestForm[avatar]" id="testform-avatar" type="file">
</div>
HTML,
$result,
Expand All @@ -421,7 +421,7 @@ public function testFileWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-avatar">Avatar</label>
<input type="file" id="testform-avatar" name="TestForm[avatar]">
<input name="TestForm[avatar]" id="testform-avatar" type="file">
</div>
HTML,
$result,
Expand All @@ -432,7 +432,7 @@ public function testHidden(): void
{
$result = (new FieldFactory())->hidden(new TestForm(), 'key')->render();
$this->assertSame(
'<input type="hidden" id="testform-key" name="TestForm[key]" value="x100">',
'<input type="hidden" name="TestForm[key]" value="x100" id="testform-key">',
$result,
);
}
Expand All @@ -450,7 +450,7 @@ public function testHiddenWithTheme(): void

$result = (new FieldFactory('A'))->hidden(new TestForm(), 'key', theme: 'B')->render();
$this->assertSame(
'<input type="hidden" id="testform-key" class="controlB" name="TestForm[key]" value="x100">',
'<input type="hidden" name="TestForm[key]" value="x100" class="controlB" id="testform-key">',
$result,
);
}
Expand Down Expand Up @@ -516,7 +516,7 @@ public function testNumber(): void
<<<HTML
<div>
<label for="testform-age">Your age</label>
<input type="number" id="testform-age" name="TestForm[age]" value="42">
<input type="number" name="TestForm[age]" value="42" id="testform-age">
<div>Full years.</div>
</div>
HTML,
Expand All @@ -540,7 +540,7 @@ public function testNumberWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-age">Your age</label>
<input type="number" id="testform-age" name="TestForm[age]" value="42">
<input type="number" name="TestForm[age]" value="42" id="testform-age">
<div>Full years.</div>
</div>
HTML,
Expand All @@ -555,7 +555,7 @@ public function testPassword(): void
<<<HTML
<div>
<label for="testform-oldpassword">Old Password</label>
<input type="password" id="testform-oldpassword" name="TestForm[oldPassword]" value>
<input type="password" name="TestForm[oldPassword]" value id="testform-oldpassword">
<div>Enter your old password.</div>
</div>
HTML,
Expand All @@ -579,7 +579,7 @@ public function testPasswordWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-oldpassword">Old Password</label>
<input type="password" id="testform-oldpassword" name="TestForm[oldPassword]" value>
<input type="password" name="TestForm[oldPassword]" value id="testform-oldpassword">
<div>Enter your old password.</div>
</div>
HTML,
Expand All @@ -600,8 +600,8 @@ public function testRadioList(): void
<div>
<label>Select color</label>
<div>
<label><input type="radio" name="TestForm[color]" value="red"> Red</label>
<label><input type="radio" name="TestForm[color]" value="blue"> Blue</label>
<label><input name="TestForm[color]" value="red" type="radio"> Red</label>
<label><input name="TestForm[color]" value="blue" type="radio"> Blue</label>
</div>
<div>Color of box.</div>
</div>
Expand Down Expand Up @@ -632,8 +632,8 @@ public function testRadioListWithTheme(): void
<div class="green">
<label>Select color</label>
<div>
<label><input type="radio" name="TestForm[color]" value="red"> Red</label>
<label><input type="radio" name="TestForm[color]" value="blue"> Blue</label>
<label><input name="TestForm[color]" value="red" type="radio"> Red</label>
<label><input name="TestForm[color]" value="blue" type="radio"> Blue</label>
</div>
<div>Color of box.</div>
</div>
Expand All @@ -652,7 +652,7 @@ public function testRange(): void
<<<HTML
<div>
<label for="testform-volume">Volume</label>
<input type="range" id="testform-volume" name="TestForm[volume]" value="23" min="1" max="100">
<input name="TestForm[volume]" value="23" min="1" max="100" id="testform-volume" type="range">
</div>
HTML,
$result,
Expand All @@ -678,7 +678,7 @@ public function testRangeWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-volume">Volume</label>
<input type="range" id="testform-volume" name="TestForm[volume]" value="23" min="1" max="100">
<input name="TestForm[volume]" value="23" min="1" max="100" id="testform-volume" type="range">
</div>
HTML,
$result,
Expand Down Expand Up @@ -815,7 +815,7 @@ public function testTelephone(): void
<<<HTML
<div>
<label for="testform-number">Phone</label>
<input type="tel" id="testform-number" name="TestForm[number]" value>
<input type="tel" name="TestForm[number]" value id="testform-number">
<div>Enter your phone.</div>
</div>
HTML,
Expand All @@ -839,7 +839,7 @@ public function testTelephoneWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-number">Phone</label>
<input type="tel" id="testform-number" name="TestForm[number]" value>
<input type="tel" name="TestForm[number]" value id="testform-number">
<div>Enter your phone.</div>
</div>
HTML,
Expand All @@ -854,7 +854,7 @@ public function testText(): void
<<<HTML
<div>
<label for="testform-name">Name</label>
<input type="text" id="testform-name" name="TestForm[name]" value>
<input type="text" name="TestForm[name]" value id="testform-name">
<div>Input your full name.</div>
</div>
HTML,
Expand All @@ -878,7 +878,7 @@ public function testTextWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-name">Name</label>
<input type="text" id="testform-name" name="TestForm[name]" value>
<input type="text" name="TestForm[name]" value id="testform-name">
<div>Input your full name.</div>
</div>
HTML,
Expand All @@ -893,7 +893,7 @@ public function testTextarea(): void
<<<HTML
<div>
<label for="testform-desc">Description</label>
<textarea id="testform-desc" name="TestForm[desc]"></textarea>
<textarea name="TestForm[desc]" id="testform-desc"></textarea>
</div>
HTML,
$result,
Expand All @@ -916,7 +916,7 @@ public function testTextareaWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-desc">Description</label>
<textarea id="testform-desc" name="TestForm[desc]"></textarea>
<textarea name="TestForm[desc]" id="testform-desc"></textarea>
</div>
HTML,
$result,
Expand All @@ -930,7 +930,7 @@ public function testTime(): void
$expected = <<<HTML
<div>
<label for="testform-starttime">Start Time</label>
<input type="time" id="testform-starttime" name="TestForm[startTime]" value="14:00:23">
<input type="time" name="TestForm[startTime]" value="14:00:23" id="testform-starttime">
</div>
HTML;

Expand All @@ -953,7 +953,7 @@ public function testTimeWithTheme(): void
$expected = <<<HTML
<div class="green">
<label for="testform-starttime">Start Time</label>
<input type="time" id="testform-starttime" name="TestForm[startTime]" value="14:00:23">
<input type="time" name="TestForm[startTime]" value="14:00:23" id="testform-starttime">
</div>
HTML;

Expand All @@ -967,7 +967,7 @@ public function testUrl(): void
<<<HTML
<div>
<label for="testform-site">Your site</label>
<input type="url" id="testform-site" name="TestForm[site]" value>
<input type="url" name="TestForm[site]" value id="testform-site">
<div>Enter your site URL.</div>
</div>
HTML,
Expand All @@ -991,7 +991,7 @@ public function testUrlWithTheme(): void
<<<HTML
<div class="green">
<label for="testform-site">Your site</label>
<input type="url" id="testform-site" name="TestForm[site]" value>
<input type="url" name="TestForm[site]" value id="testform-site">
<div>Enter your site URL.</div>
</div>
HTML,
Expand Down
Loading
Loading