@markuplint/types 3.0.0-canary.5 → 3.0.0-dev.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/lib/check-multi-types.d.ts +4 -1
  3. package/lib/check-multi-types.js +5 -4
  4. package/lib/check.d.ts +6 -5
  5. package/lib/check.spec.js +64 -58
  6. package/lib/css-syntax.js +49 -47
  7. package/lib/css-syntax.spec.js +152 -149
  8. package/lib/defs.js +2 -2
  9. package/lib/enum.d.ts +2 -1
  10. package/lib/enum.js +1 -1
  11. package/lib/get-candidate.d.ts +4 -1
  12. package/lib/keyword-type.js +3 -2
  13. package/lib/list.d.ts +2 -1
  14. package/lib/list.js +2 -1
  15. package/lib/list.spec.js +118 -117
  16. package/lib/match-result.d.ts +21 -8
  17. package/lib/match-result.js +2 -1
  18. package/lib/number.d.ts +1 -1
  19. package/lib/primitive/index.spec.js +53 -52
  20. package/lib/primitive/is-quantity.d.ts +5 -1
  21. package/lib/primitive/is-uint.d.ts +6 -3
  22. package/lib/primitive/split-unit.d.ts +2 -2
  23. package/lib/primitive/split-unit.js +2 -2
  24. package/lib/rfc/is-bcp-47.spec.js +9 -8
  25. package/lib/token/token-collection.d.ts +71 -56
  26. package/lib/token/token-collection.js +30 -23
  27. package/lib/token/token-collection.spec.js +156 -134
  28. package/lib/token/token.d.ts +58 -52
  29. package/lib/token/token.js +19 -20
  30. package/lib/token/types.d.ts +3 -0
  31. package/lib/token/types.js +2 -0
  32. package/lib/types.d.ts +79 -55
  33. package/lib/types.schema.d.ts +1084 -31
  34. package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
  35. package/lib/whatwg/check-autocomplete.js +6 -6
  36. package/lib/whatwg/check-autocomplete.spec.js +361 -360
  37. package/lib/whatwg/check-datetime/datetime-tokens.d.ts +21 -1
  38. package/lib/whatwg/check-datetime/datetime-tokens.js +9 -6
  39. package/lib/whatwg/check-datetime/duration-string.js +12 -2
  40. package/lib/whatwg/check-datetime/index.spec.js +277 -276
  41. package/lib/whatwg/check-datetime/local-date-and-time-string.js +6 -2
  42. package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +1 -1
  43. package/lib/whatwg/check-datetime/time-zone-offset-string.js +3 -2
  44. package/lib/whatwg/check-mime-type.d.ts +4 -4
  45. package/lib/whatwg/check-mime-type.js +1 -1
  46. package/lib/whatwg/check-mime-type.spec.js +53 -52
  47. package/lib/whatwg/is-abs-url.spec.js +6 -5
  48. package/lib/whatwg/is-itemprop-name.js +1 -1
  49. package/package.json +12 -10
  50. package/{src/check.spec.ts → test/check.spec.js} +7 -1
  51. package/{src/css-syntax.spec.ts → test/css-syntax.spec.js} +10 -12
  52. package/{src/list.spec.ts → test/list.spec.js} +7 -7
  53. package/{src/primitive/index.spec.ts → test/primitive/index.spec.js} +1 -1
  54. package/{src/rfc/is-bcp-47.spec.ts → test/rfc/is-bcp-47.spec.js} +1 -1
  55. package/{src/token/token-collection.spec.ts → test/token/token-collection.spec.js} +2 -3
  56. package/{src/w3c/check-serialized-permissions-policy.spec.ts → test/w3c/check-serialized-permissions-policy.spec.js} +1 -3
  57. package/{src/whatwg/check-autocomplete.spec.ts → test/whatwg/check-autocomplete.spec.js} +1 -1
  58. package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js} +18 -15
  59. package/{src/whatwg/check-mime-type.spec.ts → test/whatwg/check-mime-type.spec.js} +1 -1
  60. package/{src/whatwg/is-abs-url.spec.ts → test/whatwg/is-abs-url.spec.js} +1 -1
  61. package/types.schema.json +369 -318
  62. package/gen/specific-schema.json +0 -98
  63. package/gen/types.ts +0 -66
  64. package/src/check-multi-types.ts +0 -35
  65. package/src/check.ts +0 -48
  66. package/src/css-syntax.ts +0 -188
  67. package/src/debug.ts +0 -3
  68. package/src/defs.ts +0 -811
  69. package/src/enum.ts +0 -25
  70. package/src/get-candidate.ts +0 -24
  71. package/src/index.ts +0 -3
  72. package/src/keyword-type.ts +0 -64
  73. package/src/list.ts +0 -34
  74. package/src/match-result.ts +0 -49
  75. package/src/number.ts +0 -46
  76. package/src/primitive/index.ts +0 -7
  77. package/src/primitive/is-float.ts +0 -8
  78. package/src/primitive/is-int.ts +0 -8
  79. package/src/primitive/is-non-zero-uint.ts +0 -8
  80. package/src/primitive/is-quantity.ts +0 -38
  81. package/src/primitive/is-uint.ts +0 -15
  82. package/src/primitive/range.ts +0 -14
  83. package/src/primitive/split-unit.ts +0 -20
  84. package/src/rfc/is-bcp-47.ts +0 -13
  85. package/src/token/index.ts +0 -2
  86. package/src/token/token-collection.ts +0 -444
  87. package/src/token/token.ts +0 -144
  88. package/src/types.schema.ts +0 -1062
  89. package/src/types.ts +0 -118
  90. package/src/w3c/check-serialized-permissions-policy.ts +0 -303
  91. package/src/whatwg/check-autocomplete.ts +0 -380
  92. package/src/whatwg/check-datetime/date-string.ts +0 -44
  93. package/src/whatwg/check-datetime/datetime-tokens.ts +0 -600
  94. package/src/whatwg/check-datetime/duration-string.ts +0 -399
  95. package/src/whatwg/check-datetime/global-date-and-time-string.ts +0 -96
  96. package/src/whatwg/check-datetime/index.ts +0 -36
  97. package/src/whatwg/check-datetime/local-date-and-time-string.ts +0 -163
  98. package/src/whatwg/check-datetime/month-string.ts +0 -31
  99. package/src/whatwg/check-datetime/time-string.ts +0 -49
  100. package/src/whatwg/check-datetime/time-zone-offset-string.ts +0 -93
  101. package/src/whatwg/check-datetime/week-string.ts +0 -41
  102. package/src/whatwg/check-datetime/year-string.ts +0 -26
  103. package/src/whatwg/check-datetime/yearless-date-string.ts +0 -38
  104. package/src/whatwg/check-mime-type.ts +0 -46
  105. package/src/whatwg/is-abs-url.ts +0 -31
  106. package/src/whatwg/is-browser-context-name.ts +0 -16
  107. package/src/whatwg/is-custom-element-name.ts +0 -76
  108. package/src/whatwg/is-itemprop-name.ts +0 -17
  109. package/tsconfig.test.json +0 -3
  110. package/tsconfig.tsbuildinfo +0 -1
@@ -1,379 +1,380 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const check_autocomplete_1 = require("./check-autocomplete");
1
+ 'use strict';
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+ const check_autocomplete_1 = require('./check-autocomplete');
4
5
  const check = (0, check_autocomplete_1.checkAutoComplete)();
5
6
  test('basic', () => {
6
- expect(check('on').matched).toBe(true);
7
- expect(check('on webauthn').matched).toBe(false);
8
- expect(check('off').matched).toBe(true);
9
- expect(check('off webauthn').matched).toBe(false);
10
- expect(check('name').matched).toBe(true);
11
- expect(check('given-name').matched).toBe(true);
12
- expect(check('given-name webauthn').matched).toBe(true);
13
- expect(check('given-name webauthun').matched).toBe(false);
14
- expect(check('section-').matched).toBe(true);
15
- expect(check('section-foo').matched).toBe(true);
16
- expect(check('section-foo webauthn').matched).toBe(true);
17
- expect(check('section-foo name').matched).toBe(true);
18
- expect(check('section-foo name webauthn').matched).toBe(true);
19
- expect(check('section-foo shipping name').matched).toBe(true);
20
- expect(check('section-foo billing name').matched).toBe(true);
21
- expect(check('section-foo billing home').matched).toBe(true);
22
- expect(check('section-foo billing work').matched).toBe(true);
23
- expect(check('section-foo billing home tel').matched).toBe(true);
24
- expect(check('section-foo billing work email').matched).toBe(true);
25
- expect(check('section-foo billing work email webauthn').matched).toBe(true);
26
- expect(check('shipping name').matched).toBe(true);
27
- expect(check('billing name').matched).toBe(true);
28
- expect(check('billing home').matched).toBe(true);
29
- expect(check('billing work').matched).toBe(true);
30
- expect(check('billing home tel').matched).toBe(true);
31
- expect(check('billing work email').matched).toBe(true);
32
- expect(check('billing work email webauthn').matched).toBe(true);
33
- expect(check('home tel').matched).toBe(true);
34
- expect(check('work email').matched).toBe(true);
35
- expect(check('work email webauthn').matched).toBe(true);
7
+ expect(check('on').matched).toBe(true);
8
+ expect(check('on webauthn').matched).toBe(false);
9
+ expect(check('off').matched).toBe(true);
10
+ expect(check('off webauthn').matched).toBe(false);
11
+ expect(check('name').matched).toBe(true);
12
+ expect(check('given-name').matched).toBe(true);
13
+ expect(check('given-name webauthn').matched).toBe(true);
14
+ expect(check('given-name webauthun').matched).toBe(false);
15
+ expect(check('section-').matched).toBe(true);
16
+ expect(check('section-foo').matched).toBe(true);
17
+ expect(check('section-foo webauthn').matched).toBe(true);
18
+ expect(check('section-foo name').matched).toBe(true);
19
+ expect(check('section-foo name webauthn').matched).toBe(true);
20
+ expect(check('section-foo shipping name').matched).toBe(true);
21
+ expect(check('section-foo billing name').matched).toBe(true);
22
+ expect(check('section-foo billing home').matched).toBe(true);
23
+ expect(check('section-foo billing work').matched).toBe(true);
24
+ expect(check('section-foo billing home tel').matched).toBe(true);
25
+ expect(check('section-foo billing work email').matched).toBe(true);
26
+ expect(check('section-foo billing work email webauthn').matched).toBe(true);
27
+ expect(check('shipping name').matched).toBe(true);
28
+ expect(check('billing name').matched).toBe(true);
29
+ expect(check('billing home').matched).toBe(true);
30
+ expect(check('billing work').matched).toBe(true);
31
+ expect(check('billing home tel').matched).toBe(true);
32
+ expect(check('billing work email').matched).toBe(true);
33
+ expect(check('billing work email webauthn').matched).toBe(true);
34
+ expect(check('home tel').matched).toBe(true);
35
+ expect(check('work email').matched).toBe(true);
36
+ expect(check('work email webauthn').matched).toBe(true);
36
37
  });
37
38
  test('unexpected-token', () => {
38
- expect(check('section-foo , name')).toStrictEqual({
39
- matched: false,
40
- raw: ',',
41
- offset: 12,
42
- length: 1,
43
- line: 1,
44
- column: 13,
45
- reason: 'unexpected-token',
46
- expects: [
47
- { type: 'const', value: 'billing' },
48
- { type: 'const', value: 'shipping' },
49
- { type: 'common', value: 'autofill field name' },
50
- ],
51
- candidate: undefined,
52
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
53
- });
39
+ expect(check('section-foo , name')).toStrictEqual({
40
+ matched: false,
41
+ raw: ',',
42
+ offset: 12,
43
+ length: 1,
44
+ line: 1,
45
+ column: 13,
46
+ reason: 'unexpected-token',
47
+ expects: [
48
+ { type: 'const', value: 'billing' },
49
+ { type: 'const', value: 'shipping' },
50
+ { type: 'common', value: 'autofill field name' },
51
+ ],
52
+ candidate: undefined,
53
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
54
+ });
54
55
  });
55
56
  test('unexpected-token', () => {
56
- expect(check('xxx')).toStrictEqual({
57
- matched: false,
58
- raw: 'xxx',
59
- offset: 0,
60
- length: 3,
61
- line: 1,
62
- column: 1,
63
- reason: 'unexpected-token',
64
- expects: [
65
- { type: 'common', value: 'autofill named group' },
66
- { type: 'common', value: 'autofill field name' },
67
- ],
68
- candidate: undefined,
69
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
70
- });
57
+ expect(check('xxx')).toStrictEqual({
58
+ matched: false,
59
+ raw: 'xxx',
60
+ offset: 0,
61
+ length: 3,
62
+ line: 1,
63
+ column: 1,
64
+ reason: 'unexpected-token',
65
+ expects: [
66
+ { type: 'common', value: 'autofill named group' },
67
+ { type: 'common', value: 'autofill field name' },
68
+ ],
69
+ candidate: undefined,
70
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
71
+ });
71
72
  });
72
73
  test('unexpected-token', () => {
73
- expect(check('section-foo neme')).toStrictEqual({
74
- matched: false,
75
- raw: 'neme',
76
- offset: 12,
77
- length: 4,
78
- line: 1,
79
- column: 13,
80
- reason: 'unexpected-token',
81
- expects: [
82
- { type: 'const', value: 'billing' },
83
- { type: 'const', value: 'shipping' },
84
- { type: 'common', value: 'autofill field name' },
85
- ],
86
- candidate: 'name',
87
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
88
- });
89
- expect(check('section-foo shipping neme')).toStrictEqual({
90
- matched: false,
91
- raw: 'neme',
92
- offset: 21,
93
- length: 4,
94
- line: 1,
95
- column: 22,
96
- reason: 'unexpected-token',
97
- expects: [
98
- { type: 'common', value: 'autofill field name' },
99
- { type: 'const', value: 'home' },
100
- { type: 'const', value: 'work' },
101
- { type: 'const', value: 'mobile' },
102
- { type: 'const', value: 'fax' },
103
- { type: 'const', value: 'pager' },
104
- ],
105
- candidate: 'name',
106
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
107
- });
108
- expect(check('section-foo shipping home name')).toStrictEqual({
109
- matched: false,
110
- raw: 'name',
111
- offset: 26,
112
- length: 4,
113
- line: 1,
114
- column: 27,
115
- reason: 'unexpected-token',
116
- expects: [
117
- { type: 'const', value: 'tel' },
118
- { type: 'const', value: 'tel-country-code' },
119
- { type: 'const', value: 'tel-national' },
120
- { type: 'const', value: 'tel-area-code' },
121
- { type: 'const', value: 'tel-local' },
122
- { type: 'const', value: 'tel-local-prefix' },
123
- { type: 'const', value: 'tel-local-suffix' },
124
- { type: 'const', value: 'tel-extension' },
125
- { type: 'const', value: 'email' },
126
- { type: 'const', value: 'impp' },
127
- ],
128
- candidate: undefined,
129
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel',
130
- });
131
- expect(check('section-foo shipping home emall')).toStrictEqual({
132
- matched: false,
133
- raw: 'emall',
134
- offset: 26,
135
- length: 5,
136
- line: 1,
137
- column: 27,
138
- reason: 'unexpected-token',
139
- expects: [
140
- { type: 'const', value: 'tel' },
141
- { type: 'const', value: 'tel-country-code' },
142
- { type: 'const', value: 'tel-national' },
143
- { type: 'const', value: 'tel-area-code' },
144
- { type: 'const', value: 'tel-local' },
145
- { type: 'const', value: 'tel-local-prefix' },
146
- { type: 'const', value: 'tel-local-suffix' },
147
- { type: 'const', value: 'tel-extension' },
148
- { type: 'const', value: 'email' },
149
- { type: 'const', value: 'impp' },
150
- ],
151
- candidate: 'email',
152
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel',
153
- });
74
+ expect(check('section-foo neme')).toStrictEqual({
75
+ matched: false,
76
+ raw: 'neme',
77
+ offset: 12,
78
+ length: 4,
79
+ line: 1,
80
+ column: 13,
81
+ reason: 'unexpected-token',
82
+ expects: [
83
+ { type: 'const', value: 'billing' },
84
+ { type: 'const', value: 'shipping' },
85
+ { type: 'common', value: 'autofill field name' },
86
+ ],
87
+ candidate: 'name',
88
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
89
+ });
90
+ expect(check('section-foo shipping neme')).toStrictEqual({
91
+ matched: false,
92
+ raw: 'neme',
93
+ offset: 21,
94
+ length: 4,
95
+ line: 1,
96
+ column: 22,
97
+ reason: 'unexpected-token',
98
+ expects: [
99
+ { type: 'common', value: 'autofill field name' },
100
+ { type: 'const', value: 'home' },
101
+ { type: 'const', value: 'work' },
102
+ { type: 'const', value: 'mobile' },
103
+ { type: 'const', value: 'fax' },
104
+ { type: 'const', value: 'pager' },
105
+ ],
106
+ candidate: 'name',
107
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
108
+ });
109
+ expect(check('section-foo shipping home name')).toStrictEqual({
110
+ matched: false,
111
+ raw: 'name',
112
+ offset: 26,
113
+ length: 4,
114
+ line: 1,
115
+ column: 27,
116
+ reason: 'unexpected-token',
117
+ expects: [
118
+ { type: 'const', value: 'tel' },
119
+ { type: 'const', value: 'tel-country-code' },
120
+ { type: 'const', value: 'tel-national' },
121
+ { type: 'const', value: 'tel-area-code' },
122
+ { type: 'const', value: 'tel-local' },
123
+ { type: 'const', value: 'tel-local-prefix' },
124
+ { type: 'const', value: 'tel-local-suffix' },
125
+ { type: 'const', value: 'tel-extension' },
126
+ { type: 'const', value: 'email' },
127
+ { type: 'const', value: 'impp' },
128
+ ],
129
+ candidate: undefined,
130
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel',
131
+ });
132
+ expect(check('section-foo shipping home emall')).toStrictEqual({
133
+ matched: false,
134
+ raw: 'emall',
135
+ offset: 26,
136
+ length: 5,
137
+ line: 1,
138
+ column: 27,
139
+ reason: 'unexpected-token',
140
+ expects: [
141
+ { type: 'const', value: 'tel' },
142
+ { type: 'const', value: 'tel-country-code' },
143
+ { type: 'const', value: 'tel-national' },
144
+ { type: 'const', value: 'tel-area-code' },
145
+ { type: 'const', value: 'tel-local' },
146
+ { type: 'const', value: 'tel-local-prefix' },
147
+ { type: 'const', value: 'tel-local-suffix' },
148
+ { type: 'const', value: 'tel-extension' },
149
+ { type: 'const', value: 'email' },
150
+ { type: 'const', value: 'impp' },
151
+ ],
152
+ candidate: 'email',
153
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel',
154
+ });
154
155
  });
155
156
  test('duplicated', () => {
156
- expect(check('name name')).toStrictEqual({
157
- matched: false,
158
- raw: 'name',
159
- offset: 5,
160
- length: 4,
161
- line: 1,
162
- column: 6,
163
- partName: 'the content of the list',
164
- reason: 'duplicated',
165
- expects: [{ type: 'format', value: 'autocomplete' }],
166
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete',
167
- });
168
- expect(check('on on')).toStrictEqual({
169
- matched: false,
170
- raw: 'on',
171
- offset: 3,
172
- length: 2,
173
- line: 1,
174
- column: 4,
175
- partName: 'the content of the list',
176
- reason: 'duplicated',
177
- expects: [{ type: 'format', value: 'autocomplete' }],
178
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete',
179
- });
157
+ expect(check('name name')).toStrictEqual({
158
+ matched: false,
159
+ raw: 'name',
160
+ offset: 5,
161
+ length: 4,
162
+ line: 1,
163
+ column: 6,
164
+ partName: 'the content of the list',
165
+ reason: 'duplicated',
166
+ expects: [{ type: 'format', value: 'autocomplete' }],
167
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete',
168
+ });
169
+ expect(check('on on')).toStrictEqual({
170
+ matched: false,
171
+ raw: 'on',
172
+ offset: 3,
173
+ length: 2,
174
+ line: 1,
175
+ column: 4,
176
+ partName: 'the content of the list',
177
+ reason: 'duplicated',
178
+ expects: [{ type: 'format', value: 'autocomplete' }],
179
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete',
180
+ });
180
181
  });
181
182
  test('extra-token', () => {
182
- expect(check('on off')).toStrictEqual({
183
- matched: false,
184
- raw: 'off',
185
- offset: 3,
186
- length: 3,
187
- line: 1,
188
- column: 4,
189
- reason: 'extra-token',
190
- expects: [{ type: 'format', value: 'autocomplete' }],
191
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
192
- });
193
- expect(check('off on')).toStrictEqual({
194
- matched: false,
195
- raw: 'on',
196
- offset: 4,
197
- length: 2,
198
- line: 1,
199
- column: 5,
200
- reason: 'extra-token',
201
- expects: [{ type: 'format', value: 'autocomplete' }],
202
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
203
- });
204
- expect(check('on name')).toStrictEqual({
205
- matched: false,
206
- raw: 'name',
207
- offset: 3,
208
- length: 4,
209
- line: 1,
210
- column: 4,
211
- reason: 'extra-token',
212
- expects: [{ type: 'format', value: 'autocomplete' }],
213
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
214
- });
215
- expect(check('name on')).toStrictEqual({
216
- matched: false,
217
- raw: 'on',
218
- offset: 5,
219
- length: 2,
220
- line: 1,
221
- column: 6,
222
- reason: 'extra-token',
223
- expects: [{ type: 'format', value: 'autocomplete' }],
224
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
225
- });
226
- expect(check('section-foo name on')).toStrictEqual({
227
- matched: false,
228
- raw: 'on',
229
- offset: 17,
230
- length: 2,
231
- line: 1,
232
- column: 18,
233
- reason: 'extra-token',
234
- expects: [{ type: 'format', value: 'autocomplete' }],
235
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
236
- });
237
- expect(check('section-foo billing name on')).toStrictEqual({
238
- matched: false,
239
- raw: 'on',
240
- offset: 25,
241
- length: 2,
242
- line: 1,
243
- column: 26,
244
- reason: 'extra-token',
245
- expects: [{ type: 'format', value: 'autocomplete' }],
246
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
247
- });
248
- expect(check('billing name on')).toStrictEqual({
249
- matched: false,
250
- raw: 'on',
251
- offset: 13,
252
- length: 2,
253
- line: 1,
254
- column: 14,
255
- reason: 'extra-token',
256
- expects: [{ type: 'format', value: 'autocomplete' }],
257
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
258
- });
259
- expect(check('tel on')).toStrictEqual({
260
- matched: false,
261
- raw: 'on',
262
- offset: 4,
263
- length: 2,
264
- line: 1,
265
- column: 5,
266
- reason: 'extra-token',
267
- expects: [{ type: 'format', value: 'autocomplete' }],
268
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
269
- });
270
- expect(check('home tel on')).toStrictEqual({
271
- matched: false,
272
- raw: 'on',
273
- offset: 9,
274
- length: 2,
275
- line: 1,
276
- column: 10,
277
- reason: 'extra-token',
278
- expects: [{ type: 'format', value: 'autocomplete' }],
279
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
280
- });
281
- expect(check('billing home tel on')).toStrictEqual({
282
- matched: false,
283
- raw: 'on',
284
- offset: 17,
285
- length: 2,
286
- line: 1,
287
- column: 18,
288
- reason: 'extra-token',
289
- expects: [{ type: 'format', value: 'autocomplete' }],
290
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
291
- });
292
- expect(check('billing home tel on')).toStrictEqual({
293
- matched: false,
294
- raw: 'on',
295
- offset: 17,
296
- length: 2,
297
- line: 1,
298
- column: 18,
299
- reason: 'extra-token',
300
- expects: [{ type: 'format', value: 'autocomplete' }],
301
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
302
- });
303
- expect(check('section-foo billing home tel on')).toStrictEqual({
304
- matched: false,
305
- raw: 'on',
306
- offset: 29,
307
- length: 2,
308
- line: 1,
309
- column: 30,
310
- reason: 'extra-token',
311
- expects: [{ type: 'format', value: 'autocomplete' }],
312
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
313
- });
314
- expect(check('section-foo home tel on')).toStrictEqual({
315
- matched: false,
316
- raw: 'on',
317
- offset: 21,
318
- length: 2,
319
- line: 1,
320
- column: 22,
321
- reason: 'extra-token',
322
- expects: [{ type: 'format', value: 'autocomplete' }],
323
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
324
- });
325
- expect(check('section-foo tel on')).toStrictEqual({
326
- matched: false,
327
- raw: 'on',
328
- offset: 16,
329
- length: 2,
330
- line: 1,
331
- column: 17,
332
- reason: 'extra-token',
333
- expects: [{ type: 'format', value: 'autocomplete' }],
334
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
335
- });
183
+ expect(check('on off')).toStrictEqual({
184
+ matched: false,
185
+ raw: 'off',
186
+ offset: 3,
187
+ length: 3,
188
+ line: 1,
189
+ column: 4,
190
+ reason: 'extra-token',
191
+ expects: [{ type: 'format', value: 'autocomplete' }],
192
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
193
+ });
194
+ expect(check('off on')).toStrictEqual({
195
+ matched: false,
196
+ raw: 'on',
197
+ offset: 4,
198
+ length: 2,
199
+ line: 1,
200
+ column: 5,
201
+ reason: 'extra-token',
202
+ expects: [{ type: 'format', value: 'autocomplete' }],
203
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
204
+ });
205
+ expect(check('on name')).toStrictEqual({
206
+ matched: false,
207
+ raw: 'name',
208
+ offset: 3,
209
+ length: 4,
210
+ line: 1,
211
+ column: 4,
212
+ reason: 'extra-token',
213
+ expects: [{ type: 'format', value: 'autocomplete' }],
214
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2',
215
+ });
216
+ expect(check('name on')).toStrictEqual({
217
+ matched: false,
218
+ raw: 'on',
219
+ offset: 5,
220
+ length: 2,
221
+ line: 1,
222
+ column: 6,
223
+ reason: 'extra-token',
224
+ expects: [{ type: 'format', value: 'autocomplete' }],
225
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
226
+ });
227
+ expect(check('section-foo name on')).toStrictEqual({
228
+ matched: false,
229
+ raw: 'on',
230
+ offset: 17,
231
+ length: 2,
232
+ line: 1,
233
+ column: 18,
234
+ reason: 'extra-token',
235
+ expects: [{ type: 'format', value: 'autocomplete' }],
236
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
237
+ });
238
+ expect(check('section-foo billing name on')).toStrictEqual({
239
+ matched: false,
240
+ raw: 'on',
241
+ offset: 25,
242
+ length: 2,
243
+ line: 1,
244
+ column: 26,
245
+ reason: 'extra-token',
246
+ expects: [{ type: 'format', value: 'autocomplete' }],
247
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
248
+ });
249
+ expect(check('billing name on')).toStrictEqual({
250
+ matched: false,
251
+ raw: 'on',
252
+ offset: 13,
253
+ length: 2,
254
+ line: 1,
255
+ column: 14,
256
+ reason: 'extra-token',
257
+ expects: [{ type: 'format', value: 'autocomplete' }],
258
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
259
+ });
260
+ expect(check('tel on')).toStrictEqual({
261
+ matched: false,
262
+ raw: 'on',
263
+ offset: 4,
264
+ length: 2,
265
+ line: 1,
266
+ column: 5,
267
+ reason: 'extra-token',
268
+ expects: [{ type: 'format', value: 'autocomplete' }],
269
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
270
+ });
271
+ expect(check('home tel on')).toStrictEqual({
272
+ matched: false,
273
+ raw: 'on',
274
+ offset: 9,
275
+ length: 2,
276
+ line: 1,
277
+ column: 10,
278
+ reason: 'extra-token',
279
+ expects: [{ type: 'format', value: 'autocomplete' }],
280
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
281
+ });
282
+ expect(check('billing home tel on')).toStrictEqual({
283
+ matched: false,
284
+ raw: 'on',
285
+ offset: 17,
286
+ length: 2,
287
+ line: 1,
288
+ column: 18,
289
+ reason: 'extra-token',
290
+ expects: [{ type: 'format', value: 'autocomplete' }],
291
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
292
+ });
293
+ expect(check('billing home tel on')).toStrictEqual({
294
+ matched: false,
295
+ raw: 'on',
296
+ offset: 17,
297
+ length: 2,
298
+ line: 1,
299
+ column: 18,
300
+ reason: 'extra-token',
301
+ expects: [{ type: 'format', value: 'autocomplete' }],
302
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
303
+ });
304
+ expect(check('section-foo billing home tel on')).toStrictEqual({
305
+ matched: false,
306
+ raw: 'on',
307
+ offset: 29,
308
+ length: 2,
309
+ line: 1,
310
+ column: 30,
311
+ reason: 'extra-token',
312
+ expects: [{ type: 'format', value: 'autocomplete' }],
313
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
314
+ });
315
+ expect(check('section-foo home tel on')).toStrictEqual({
316
+ matched: false,
317
+ raw: 'on',
318
+ offset: 21,
319
+ length: 2,
320
+ line: 1,
321
+ column: 22,
322
+ reason: 'extra-token',
323
+ expects: [{ type: 'format', value: 'autocomplete' }],
324
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
325
+ });
326
+ expect(check('section-foo tel on')).toStrictEqual({
327
+ matched: false,
328
+ raw: 'on',
329
+ offset: 16,
330
+ length: 2,
331
+ line: 1,
332
+ column: 17,
333
+ reason: 'extra-token',
334
+ expects: [{ type: 'format', value: 'autocomplete' }],
335
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
336
+ });
336
337
  });
337
338
  test('duplicated section', () => {
338
- expect(check('section-foo section-bar')).toStrictEqual({
339
- matched: false,
340
- raw: 'section-bar',
341
- offset: 12,
342
- length: 11,
343
- line: 1,
344
- column: 13,
345
- partName: 'autofill named group',
346
- reason: 'duplicated',
347
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-section',
348
- });
339
+ expect(check('section-foo section-bar')).toStrictEqual({
340
+ matched: false,
341
+ raw: 'section-bar',
342
+ offset: 12,
343
+ length: 11,
344
+ line: 1,
345
+ column: 13,
346
+ partName: 'autofill named group',
347
+ reason: 'duplicated',
348
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-section',
349
+ });
349
350
  });
350
351
  test('duplicated part', () => {
351
- expect(check('shipping billing')).toStrictEqual({
352
- matched: false,
353
- raw: 'billing',
354
- offset: 9,
355
- length: 7,
356
- line: 1,
357
- column: 10,
358
- reason: 'duplicated',
359
- expects: [{ type: 'format', value: 'autocomplete' }],
360
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-shipping',
361
- });
352
+ expect(check('shipping billing')).toStrictEqual({
353
+ matched: false,
354
+ raw: 'billing',
355
+ offset: 9,
356
+ length: 7,
357
+ line: 1,
358
+ column: 10,
359
+ reason: 'duplicated',
360
+ expects: [{ type: 'format', value: 'autocomplete' }],
361
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-shipping',
362
+ });
362
363
  });
363
364
  test('typo', () => {
364
- expect(check('secsion-foo name')).toStrictEqual({
365
- matched: false,
366
- raw: 'secsion-foo',
367
- offset: 0,
368
- length: 11,
369
- line: 1,
370
- column: 1,
371
- reason: 'unexpected-token',
372
- expects: [
373
- { type: 'common', value: 'autofill named group' },
374
- { type: 'common', value: 'autofill field name' },
375
- ],
376
- candidate: 'section-foo',
377
- ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
378
- });
365
+ expect(check('secsion-foo name')).toStrictEqual({
366
+ matched: false,
367
+ raw: 'secsion-foo',
368
+ offset: 0,
369
+ length: 11,
370
+ line: 1,
371
+ column: 1,
372
+ reason: 'unexpected-token',
373
+ expects: [
374
+ { type: 'common', value: 'autofill named group' },
375
+ { type: 'common', value: 'autofill field name' },
376
+ ],
377
+ candidate: 'section-foo',
378
+ ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field',
379
+ });
379
380
  });