Skip to content

Commit 72b6554

Browse files
committed
Add test for form validation and amp-next-page
1 parent bc1e70b commit 72b6554

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

tests/php/test-tag-and-attribute-sanitizer.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,19 @@ public function get_body_data() {
427427
[ 'amp-next-page' ],
428428
],
429429

430+
'amp-next-page-hide-and-replace' => [
431+
'
432+
<header class="my-header" next-page-hide>
433+
<h2>Text here.</h2>
434+
</header>
435+
<div class="sticky" next-page-replace="sticky-123">
436+
<h2>The second sticky will replace me once you scroll past my page</h2>
437+
</div>
438+
',
439+
null,
440+
[ 'amp-next-page' ],
441+
],
442+
430443
// AMP-NEXT-PAGE > [separator].
431444
'reference-point-amp-next-page-separator' => [
432445
'<amp-next-page src="https://example.com/config.json" xssi-prefix=")]}"><div separator><h1>Keep reading</h1></div></amp-next-page>',
@@ -721,6 +734,48 @@ static function () {
721734
[ 'amp-form' ],
722735
],
723736

737+
'form-visible-when-invalid' => [
738+
'
739+
<form method="post"
740+
action-xhr="https://example.com/subscribe"
741+
custom-validation-reporting="show-all-on-submit" target="_blank">
742+
<fieldset>
743+
<label>
744+
<span>Name:</span>
745+
<input type="text"
746+
name="name"
747+
id="name5"
748+
required
749+
pattern="\w+\s\w+">
750+
<span visible-when-invalid="valueMissing"
751+
validation-for="name5"></span>
752+
<span visible-when-invalid="patternMismatch"
753+
validation-for="name5">
754+
Please enter your first and last name separated by a space (e.g. Jane Miller)
755+
</span>
756+
</label>
757+
<br>
758+
<label>
759+
<span>Email:</span>
760+
<input type="email"
761+
name="email"
762+
id="email5"
763+
required>
764+
<span visible-when-invalid="valueMissing"
765+
validation-for="email5"></span>
766+
<span visible-when-invalid="typeMismatch"
767+
validation-for="email5"></span>
768+
</label>
769+
<br>
770+
<input type="submit"
771+
value="Subscribe">
772+
</fieldset>
773+
</form>
774+
',
775+
null,
776+
[ 'amp-form' ],
777+
],
778+
724779
'gfycat' => [
725780
'<amp-gfycat data-gfyid="BareSecondaryFlamingo" width="225" height="400"></amp-gfycat>',
726781
'<amp-gfycat data-gfyid="BareSecondaryFlamingo" width="225" height="400"></amp-gfycat>',

0 commit comments

Comments
 (0)