Skip to content

Commit 5bc8f65

Browse files
committed
Add tests for autofill values
1 parent 6d6f63e commit 5bc8f65

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

unittests/files/autocomplete.ts

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// @ts-expect-error should be a string
2+
document.body.getElementsByTagName("input")[0].autocomplete = false;
3+
// @ts-expect-error should not be empty
4+
document.body.getElementsByTagName("input")[0].autocomplete = "";
5+
// @ts-expect-error wrong value for this attribute
6+
document.body.getElementsByTagName("input")[0].autocomplete = "undefined";
7+
// @ts-expect-error does not accept boolean attributes
8+
document.body.getElementsByTagName("input")[0].autocomplete = "true";
9+
// @ts-expect-error does not accept boolean attributes
10+
document.body.getElementsByTagName("input")[0].autocomplete = "false";
11+
12+
// @ts-expect-error missing autofill token before webauthn
13+
document.body.getElementsByTagName("input")[0].autocomplete = "webauthn";
14+
15+
// @ts-expect-error wrong order for webauthn token
16+
document.body.getElementsByTagName("input")[0].autocomplete =
17+
"webauthn username";
18+
19+
// @ts-expect-error wrong order for contact specifier
20+
document.body.getElementsByTagName("input")[0].autocomplete = "tel mobile";
21+
22+
// @ts-expect-error off should be standalone
23+
document.body.getElementsByTagName("input")[0].autocomplete =
24+
"section-wrong off";
25+
26+
// @ts-expect-error on should be standalone
27+
document.body.getElementsByTagName("input")[0].autocomplete = "on username";
28+
29+
// @ts-expect-error home, work or mobile are only for contact tokens
30+
document.body.getElementsByTagName("input")[0].autocomplete = "mobile username";
31+
32+
// @ts-expect-error should probably be current-password or new-password
33+
document.body.getElementsByTagName("input")[0].autocomplete = "password";
34+
35+
document.body.getElementsByTagName("input")[0].autocomplete = "on";
36+
document.body.getElementsByTagName("input")[0].autocomplete = "off";
37+
document.body.getElementsByTagName("input")[0].autocomplete = "new-password";
38+
document.body.getElementsByTagName("input")[0].autocomplete =
39+
"current-password";
40+
41+
document.body.getElementsByTagName("input")[0].autocomplete =
42+
"username webauthn";
43+
44+
document.body.getElementsByTagName("input")[0].autocomplete =
45+
"shipping street-address";
46+
document.body.getElementsByTagName("input")[0].autocomplete =
47+
"section-custom shipping street-address";
48+
49+
document.body.getElementsByTagName("input")[0].autocomplete = "work email";
50+
document.body.getElementsByTagName("input")[0].autocomplete =
51+
"section-custom billing mobile tel";
52+
53+
// @ts-expect-error only on and off are available on a form
54+
document.body.getElementsByTagName("form")[0].autocomplete = "new-password";
55+
56+
document.body.getElementsByTagName("form")[0].autocomplete = "off";
57+
58+
// @ts-expect-error autocomplete attribute is only for form elements
59+
document.body.getElementsByTagName("p")[0].autocomplete = "off";

0 commit comments

Comments
 (0)