@markuplint/types 3.0.0-canary.5 → 3.0.0-dev.177
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.
- package/README.md +1 -1
- package/lib/check-multi-types.d.ts +4 -1
- package/lib/check-multi-types.js +5 -4
- package/lib/check.d.ts +6 -5
- package/lib/check.spec.js +64 -58
- package/lib/css-syntax.js +49 -47
- package/lib/css-syntax.spec.js +152 -149
- package/lib/defs.js +2 -2
- package/lib/enum.d.ts +2 -1
- package/lib/enum.js +1 -1
- package/lib/get-candidate.d.ts +4 -1
- package/lib/keyword-type.js +3 -2
- package/lib/list.d.ts +2 -1
- package/lib/list.js +2 -1
- package/lib/list.spec.js +118 -117
- package/lib/match-result.d.ts +21 -8
- package/lib/match-result.js +2 -1
- package/lib/number.d.ts +1 -1
- package/lib/primitive/index.spec.js +53 -52
- package/lib/primitive/is-quantity.d.ts +5 -1
- package/lib/primitive/is-uint.d.ts +6 -3
- package/lib/primitive/split-unit.d.ts +2 -2
- package/lib/primitive/split-unit.js +2 -2
- package/lib/rfc/is-bcp-47.spec.js +9 -8
- package/lib/token/token-collection.d.ts +71 -56
- package/lib/token/token-collection.js +30 -23
- package/lib/token/token-collection.spec.js +156 -134
- package/lib/token/token.d.ts +58 -52
- package/lib/token/token.js +19 -20
- package/lib/token/types.d.ts +3 -0
- package/lib/token/types.js +2 -0
- package/lib/types.d.ts +79 -55
- package/lib/types.schema.d.ts +1084 -31
- package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
- package/lib/whatwg/check-autocomplete.js +6 -6
- package/lib/whatwg/check-autocomplete.spec.js +361 -360
- package/lib/whatwg/check-datetime/datetime-tokens.d.ts +21 -1
- package/lib/whatwg/check-datetime/datetime-tokens.js +9 -6
- package/lib/whatwg/check-datetime/duration-string.js +12 -2
- package/lib/whatwg/check-datetime/index.spec.js +277 -276
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +6 -2
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +3 -2
- package/lib/whatwg/check-mime-type.d.ts +4 -4
- package/lib/whatwg/check-mime-type.js +1 -1
- package/lib/whatwg/check-mime-type.spec.js +53 -52
- package/lib/whatwg/is-abs-url.spec.js +6 -5
- package/lib/whatwg/is-itemprop-name.js +1 -1
- package/package.json +12 -10
- package/{src/check.spec.ts → test/check.spec.js} +7 -1
- package/{src/css-syntax.spec.ts → test/css-syntax.spec.js} +10 -12
- package/{src/list.spec.ts → test/list.spec.js} +7 -7
- package/{src/primitive/index.spec.ts → test/primitive/index.spec.js} +1 -1
- package/{src/rfc/is-bcp-47.spec.ts → test/rfc/is-bcp-47.spec.js} +1 -1
- package/{src/token/token-collection.spec.ts → test/token/token-collection.spec.js} +2 -3
- package/{src/w3c/check-serialized-permissions-policy.spec.ts → test/w3c/check-serialized-permissions-policy.spec.js} +1 -3
- package/{src/whatwg/check-autocomplete.spec.ts → test/whatwg/check-autocomplete.spec.js} +1 -1
- package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js} +18 -15
- package/{src/whatwg/check-mime-type.spec.ts → test/whatwg/check-mime-type.spec.js} +1 -1
- package/{src/whatwg/is-abs-url.spec.ts → test/whatwg/is-abs-url.spec.js} +1 -1
- package/types.schema.json +369 -318
- package/gen/specific-schema.json +0 -98
- package/gen/types.ts +0 -66
- package/src/check-multi-types.ts +0 -35
- package/src/check.ts +0 -48
- package/src/css-syntax.ts +0 -188
- package/src/debug.ts +0 -3
- package/src/defs.ts +0 -811
- package/src/enum.ts +0 -25
- package/src/get-candidate.ts +0 -24
- package/src/index.ts +0 -3
- package/src/keyword-type.ts +0 -64
- package/src/list.ts +0 -34
- package/src/match-result.ts +0 -49
- package/src/number.ts +0 -46
- package/src/primitive/index.ts +0 -7
- package/src/primitive/is-float.ts +0 -8
- package/src/primitive/is-int.ts +0 -8
- package/src/primitive/is-non-zero-uint.ts +0 -8
- package/src/primitive/is-quantity.ts +0 -38
- package/src/primitive/is-uint.ts +0 -15
- package/src/primitive/range.ts +0 -14
- package/src/primitive/split-unit.ts +0 -20
- package/src/rfc/is-bcp-47.ts +0 -13
- package/src/token/index.ts +0 -2
- package/src/token/token-collection.ts +0 -444
- package/src/token/token.ts +0 -144
- package/src/types.schema.ts +0 -1062
- package/src/types.ts +0 -118
- package/src/w3c/check-serialized-permissions-policy.ts +0 -303
- package/src/whatwg/check-autocomplete.ts +0 -380
- package/src/whatwg/check-datetime/date-string.ts +0 -44
- package/src/whatwg/check-datetime/datetime-tokens.ts +0 -600
- package/src/whatwg/check-datetime/duration-string.ts +0 -399
- package/src/whatwg/check-datetime/global-date-and-time-string.ts +0 -96
- package/src/whatwg/check-datetime/index.ts +0 -36
- package/src/whatwg/check-datetime/local-date-and-time-string.ts +0 -163
- package/src/whatwg/check-datetime/month-string.ts +0 -31
- package/src/whatwg/check-datetime/time-string.ts +0 -49
- package/src/whatwg/check-datetime/time-zone-offset-string.ts +0 -93
- package/src/whatwg/check-datetime/week-string.ts +0 -41
- package/src/whatwg/check-datetime/year-string.ts +0 -26
- package/src/whatwg/check-datetime/yearless-date-string.ts +0 -38
- package/src/whatwg/check-mime-type.ts +0 -46
- package/src/whatwg/is-abs-url.ts +0 -31
- package/src/whatwg/is-browser-context-name.ts +0 -16
- package/src/whatwg/is-custom-element-name.ts +0 -76
- package/src/whatwg/is-itemprop-name.ts +0 -17
- package/tsconfig.test.json +0 -3
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -91,8 +91,12 @@ const checkNormalizedLocalDateAndTimeString = () => function checkNormalizedLoca
|
|
|
91
91
|
* > if the given time is zero seconds past the minute)
|
|
92
92
|
*/
|
|
93
93
|
const [, , , , , , , , , , second, , fp] = tokens;
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
if (!second || !fp) {
|
|
95
|
+
(0, debug_1.log)('Failed: %O', res);
|
|
96
|
+
return res;
|
|
97
|
+
}
|
|
98
|
+
const _second = second.toNumber();
|
|
99
|
+
const _fp = fp.toNumber();
|
|
96
100
|
(0, debug_1.log)('Omitting the seconds component: "%s.%s" => %d, %d', second === null || second === void 0 ? void 0 : second.value, fp === null || fp === void 0 ? void 0 : fp.value, _second, _fp);
|
|
97
101
|
if (second.value && _second === 0 && (!fp.value || (fp.value && _fp === 0))) {
|
|
98
102
|
const res = second.unmatched({
|
|
@@ -4,4 +4,4 @@ import type { CustomSyntaxChecker } from '../../types';
|
|
|
4
4
|
* @see https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#time-zones
|
|
5
5
|
*/
|
|
6
6
|
export declare const checkTimeZoneOffsetString: CustomSyntaxChecker;
|
|
7
|
-
export declare function parseTimeZone(zone: string | Token): import(
|
|
7
|
+
export declare function parseTimeZone(zone: string | Readonly<Token>): import('../../types').Result;
|
|
@@ -27,6 +27,7 @@ function parseTimeZone(zone) {
|
|
|
27
27
|
]);
|
|
28
28
|
(0, debug_1.log)('Time-zone Part: "%s" => %O', value, zoneTokens);
|
|
29
29
|
const res = zoneTokens.eachCheck((sign, tail) => {
|
|
30
|
+
var _a, _b;
|
|
30
31
|
if (!sign || !sign.value) {
|
|
31
32
|
return (0, match_result_1.unmatched)(value, 'missing-token', {
|
|
32
33
|
expects: [
|
|
@@ -39,9 +40,9 @@ function parseTimeZone(zone) {
|
|
|
39
40
|
}
|
|
40
41
|
if (sign.match('Z')) {
|
|
41
42
|
if (tail.value) {
|
|
42
|
-
return tail[0].unmatched({
|
|
43
|
+
return ((_b = (_a = tail[0]) === null || _a === void 0 ? void 0 : _a.unmatched({
|
|
43
44
|
reason: 'extra-token',
|
|
44
|
-
});
|
|
45
|
+
})) !== null && _b !== void 0 ? _b : (0, match_result_1.unmatched)(tail.value, 'extra-token'));
|
|
45
46
|
}
|
|
46
47
|
return (0, match_result_1.matched)();
|
|
47
48
|
}
|
|
@@ -4,8 +4,8 @@ import type { CustomSyntaxChecker } from '../types';
|
|
|
4
4
|
* @see https://mimesniff.spec.whatwg.org/#valid-mime-type
|
|
5
5
|
*/
|
|
6
6
|
export declare const checkMIMEType: CustomSyntaxChecker<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @see https://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters
|
|
9
|
+
*/
|
|
10
|
+
withoutParameters?: boolean;
|
|
11
11
|
}>;
|
|
@@ -27,7 +27,7 @@ const checkMIMEType = options => value => {
|
|
|
27
27
|
if (value.toLowerCase() === mimeType.essence) {
|
|
28
28
|
return (0, match_result_1.matched)();
|
|
29
29
|
}
|
|
30
|
-
if (!withoutParameters && mimeType.parameters.size) {
|
|
30
|
+
if (!withoutParameters && mimeType.parameters.size > 0) {
|
|
31
31
|
return (0, match_result_1.matched)();
|
|
32
32
|
}
|
|
33
33
|
const extraToken = value.slice(mimeType.essence.length);
|
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
const check_mime_type_1 = require('./check-mime-type');
|
|
4
5
|
const check = (0, check_mime_type_1.checkMIMEType)();
|
|
5
6
|
const checkNoParam = (0, check_mime_type_1.checkMIMEType)({ withoutParameters: true });
|
|
6
7
|
test('valid', () => {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
expect(check('x/y').matched).toBe(true);
|
|
9
|
+
expect(check('x/y;a=b;c=D;E="F"').matched).toBe(true);
|
|
9
10
|
});
|
|
10
11
|
test('excrescence-token', () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
12
|
+
expect(check('xy;')).toStrictEqual({
|
|
13
|
+
column: 1,
|
|
14
|
+
expects: [{ type: 'format', value: 'MIME Type' }],
|
|
15
|
+
length: 3,
|
|
16
|
+
line: 1,
|
|
17
|
+
matched: false,
|
|
18
|
+
offset: 0,
|
|
19
|
+
raw: 'xy;',
|
|
20
|
+
reason: 'syntax-error',
|
|
21
|
+
ref: null,
|
|
22
|
+
});
|
|
23
|
+
expect(check('x/y;')).toStrictEqual({
|
|
24
|
+
candidate: 'x/y',
|
|
25
|
+
column: 4,
|
|
26
|
+
expects: [{ type: 'format', value: 'MIME Type' }],
|
|
27
|
+
length: 1,
|
|
28
|
+
line: 1,
|
|
29
|
+
matched: false,
|
|
30
|
+
offset: 3,
|
|
31
|
+
raw: ';',
|
|
32
|
+
reason: 'extra-token',
|
|
33
|
+
ref: null,
|
|
34
|
+
});
|
|
35
|
+
expect(checkNoParam('x/y;')).toStrictEqual({
|
|
36
|
+
candidate: 'x/y',
|
|
37
|
+
column: 4,
|
|
38
|
+
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
39
|
+
length: 1,
|
|
40
|
+
line: 1,
|
|
41
|
+
matched: false,
|
|
42
|
+
offset: 3,
|
|
43
|
+
raw: ';',
|
|
44
|
+
reason: 'extra-token',
|
|
45
|
+
ref: null,
|
|
46
|
+
});
|
|
47
|
+
expect(checkNoParam('x/y;a=b;c=D;E="F"')).toStrictEqual({
|
|
48
|
+
candidate: 'x/y',
|
|
49
|
+
column: 4,
|
|
50
|
+
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
51
|
+
length: 14,
|
|
52
|
+
line: 1,
|
|
53
|
+
matched: false,
|
|
54
|
+
offset: 3,
|
|
55
|
+
raw: ';a=b;c=D;E="F"',
|
|
56
|
+
reason: 'extra-token',
|
|
57
|
+
ref: null,
|
|
58
|
+
});
|
|
58
59
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
const is_abs_url_1 = require('./is-abs-url');
|
|
4
5
|
const is = (0, is_abs_url_1.isAbsURL)();
|
|
5
6
|
test('valid', () => {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
expect(is('https://markuplint.dev')).toBe(true);
|
|
8
|
+
expect(is('markuplint.dev')).toBe(false);
|
|
8
9
|
});
|
|
@@ -13,7 +13,7 @@ exports.isItempropName = void 0;
|
|
|
13
13
|
*/
|
|
14
14
|
const isItempropName = () => {
|
|
15
15
|
return value => {
|
|
16
|
-
return value.
|
|
16
|
+
return !value.includes(':') && !value.includes('.') && !value.includes(' ');
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
exports.isItempropName = isItempropName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/types",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-dev.177+e94f3601",
|
|
4
4
|
"description": "Type declaration and value checker",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -11,23 +11,25 @@
|
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
|
+
"typedoc": {
|
|
15
|
+
"entryPoint": "./src/index.ts"
|
|
16
|
+
},
|
|
14
17
|
"scripts": {
|
|
15
18
|
"build": "tsc",
|
|
16
19
|
"clean": "tsc --build --clean",
|
|
17
20
|
"schema": "ts-node './gen/types.ts'; json2ts './types.schema.json' > './src/types.schema.ts'; prettier './src/types.schema.ts' './types.schema.json' --write; eslint './src/types.schema.ts' --fix; tsc;"
|
|
18
21
|
},
|
|
19
22
|
"dependencies": {
|
|
23
|
+
"@types/bcp-47": "1",
|
|
24
|
+
"@types/css-tree": "^2.0.1",
|
|
25
|
+
"@types/debug": "^4.1.7",
|
|
26
|
+
"@types/whatwg-mimetype": "3.0.0",
|
|
20
27
|
"bcp-47": "1",
|
|
21
|
-
"css-tree": "1",
|
|
28
|
+
"css-tree": "^2.3.1",
|
|
22
29
|
"debug": "^4.3.4",
|
|
23
30
|
"leven": "3",
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@types/bcp-47": "1",
|
|
28
|
-
"@types/css-tree": "1",
|
|
29
|
-
"@types/debug": "^4.1.7",
|
|
30
|
-
"@types/whatwg-mimetype": "2"
|
|
31
|
+
"type-fest": "^3.8.0",
|
|
32
|
+
"whatwg-mimetype": "^3.0.0"
|
|
31
33
|
},
|
|
32
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "e94f3601bf93366d1a2c7385ff7235817d82f7c9"
|
|
33
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const { check } = require('../lib/check');
|
|
2
2
|
|
|
3
3
|
test('Any', () => {
|
|
4
4
|
expect(check('', 'Any').matched).toBe(true);
|
|
@@ -81,3 +81,9 @@ test('Non-exist types', () => {
|
|
|
81
81
|
// @ts-ignore
|
|
82
82
|
expect(check('abc', '').matched).toBe(true);
|
|
83
83
|
});
|
|
84
|
+
|
|
85
|
+
test('ItemProp', () => {
|
|
86
|
+
expect(check('itemListElement', 'ItemProp').matched).toBe(true);
|
|
87
|
+
expect(check('item', 'ItemProp').matched).toBe(true);
|
|
88
|
+
expect(check('position', 'ItemProp').matched).toBe(true);
|
|
89
|
+
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cssSyntaxMatch } from './css-syntax';
|
|
1
|
+
const { cssSyntaxMatch } = require('../lib/css-syntax');
|
|
4
2
|
|
|
5
3
|
test('CSS Standard', () => {
|
|
6
4
|
expect(cssSyntaxMatch('10px', '<length>').matched).toBe(true);
|
|
@@ -9,7 +7,7 @@ test('CSS Standard', () => {
|
|
|
9
7
|
});
|
|
10
8
|
|
|
11
9
|
test('Extends', () => {
|
|
12
|
-
const sourceSizeList
|
|
10
|
+
const sourceSizeList = {
|
|
13
11
|
ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes',
|
|
14
12
|
syntax: {
|
|
15
13
|
apply: '<source-size-list>',
|
|
@@ -34,7 +32,7 @@ test('Extends', () => {
|
|
|
34
32
|
}).matched,
|
|
35
33
|
).toBe(true);
|
|
36
34
|
|
|
37
|
-
const keyTimes
|
|
35
|
+
const keyTimes = {
|
|
38
36
|
ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
|
|
39
37
|
syntax: {
|
|
40
38
|
apply: '<key-times>',
|
|
@@ -48,7 +46,7 @@ test('Extends', () => {
|
|
|
48
46
|
expect(cssSyntaxMatch('20; 20; abc;', keyTimes).matched).toBe(false);
|
|
49
47
|
expect(cssSyntaxMatch('20; 20; ;', keyTimes).matched).toBe(false);
|
|
50
48
|
|
|
51
|
-
const SVGViewBox
|
|
49
|
+
const SVGViewBox = {
|
|
52
50
|
ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute',
|
|
53
51
|
syntax: {
|
|
54
52
|
apply: '<view-box>',
|
|
@@ -65,7 +63,7 @@ test('Extends', () => {
|
|
|
65
63
|
expect(cssSyntaxMatch('0 0, 30, 10', SVGViewBox).matched).toBe(true);
|
|
66
64
|
expect(cssSyntaxMatch('0 0, 30', SVGViewBox).matched).toBe(false);
|
|
67
65
|
|
|
68
|
-
const percentageList
|
|
66
|
+
const percentageList = {
|
|
69
67
|
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage',
|
|
70
68
|
syntax: {
|
|
71
69
|
apply: '<percentage-list>',
|
|
@@ -79,7 +77,7 @@ test('Extends', () => {
|
|
|
79
77
|
expect(cssSyntaxMatch('0', percentageList).matched).toBe(true);
|
|
80
78
|
expect(cssSyntaxMatch('', percentageList).matched).toBe(false);
|
|
81
79
|
|
|
82
|
-
const custom
|
|
80
|
+
const custom = {
|
|
83
81
|
ref: 'n/a',
|
|
84
82
|
syntax: {
|
|
85
83
|
apply: '<custom>',
|
|
@@ -96,7 +94,7 @@ test('Extends', () => {
|
|
|
96
94
|
});
|
|
97
95
|
|
|
98
96
|
test('custom-type-checking', () => {
|
|
99
|
-
const custom
|
|
97
|
+
const custom = {
|
|
100
98
|
ref: 'n/a',
|
|
101
99
|
caseSensitive: true,
|
|
102
100
|
syntax: {
|
|
@@ -117,7 +115,7 @@ test('custom-type-checking', () => {
|
|
|
117
115
|
});
|
|
118
116
|
|
|
119
117
|
test('case-sensitive', () => {
|
|
120
|
-
const custom
|
|
118
|
+
const custom = {
|
|
121
119
|
ref: 'n/a',
|
|
122
120
|
caseSensitive: true,
|
|
123
121
|
syntax: {
|
|
@@ -143,7 +141,7 @@ test('case-sensitive', () => {
|
|
|
143
141
|
expects: [
|
|
144
142
|
{
|
|
145
143
|
type: 'syntax',
|
|
146
|
-
value: '
|
|
144
|
+
value: '<custom>',
|
|
147
145
|
},
|
|
148
146
|
],
|
|
149
147
|
});
|
|
@@ -160,7 +158,7 @@ test('case-sensitive', () => {
|
|
|
160
158
|
expects: [
|
|
161
159
|
{
|
|
162
160
|
type: 'syntax',
|
|
163
|
-
value: '
|
|
161
|
+
value: '<custom>',
|
|
164
162
|
},
|
|
165
163
|
],
|
|
166
164
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const { checkList } = require('../lib/list');
|
|
2
2
|
|
|
3
3
|
test('Zero space', () => {
|
|
4
|
-
const type = { token: 'Zero', separator: 'space' }
|
|
4
|
+
const type = { token: 'Zero', separator: 'space' };
|
|
5
5
|
expect(checkList('0', type).matched).toBe(true);
|
|
6
6
|
expect(checkList(' 0 ', type).matched).toBe(true);
|
|
7
7
|
expect(checkList(' 0 0', type).matched).toBe(true);
|
|
@@ -19,7 +19,7 @@ test('Zero space', () => {
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
test('Zero comma', () => {
|
|
22
|
-
const type = { token: 'Zero', separator: 'comma' }
|
|
22
|
+
const type = { token: 'Zero', separator: 'comma' };
|
|
23
23
|
expect(checkList('0', type).matched).toBe(true);
|
|
24
24
|
expect(checkList(' 0 ', type).matched).toBe(true);
|
|
25
25
|
expect(checkList(' 0 0', type).matched).toBe(false);
|
|
@@ -33,7 +33,7 @@ test('Zero comma', () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
test('Zero comma (disallowToSurroundBySpaces)', () => {
|
|
36
|
-
const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true }
|
|
36
|
+
const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true };
|
|
37
37
|
expect(checkList('0', type).matched).toBe(true);
|
|
38
38
|
expect(checkList(' 0 ', type).matched).toBe(false);
|
|
39
39
|
expect(checkList(' 0 0', type).matched).toBe(false);
|
|
@@ -48,7 +48,7 @@ test('Zero comma (disallowToSurroundBySpaces)', () => {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
test('Location of the token', () => {
|
|
51
|
-
const type = { token: 'Accept', separator: 'comma' }
|
|
51
|
+
const type = { token: 'Accept', separator: 'comma' };
|
|
52
52
|
expect(checkList('x/y;a=b', type)).toStrictEqual({
|
|
53
53
|
candidate: 'x/y',
|
|
54
54
|
column: 4,
|
|
@@ -91,7 +91,7 @@ test('Location of the token', () => {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
test('Expected comma', () => {
|
|
94
|
-
const type = { token: 'Accept', separator: 'comma' }
|
|
94
|
+
const type = { token: 'Accept', separator: 'comma' };
|
|
95
95
|
expect(checkList('x/y,', type)).toStrictEqual({
|
|
96
96
|
column: 4,
|
|
97
97
|
expects: undefined,
|
|
@@ -117,7 +117,7 @@ test('Expected comma', () => {
|
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
test('Missing comma', () => {
|
|
120
|
-
const type = { token: 'Accept', separator: 'comma' }
|
|
120
|
+
const type = { token: 'Accept', separator: 'comma' };
|
|
121
121
|
expect(checkList('a/b,x/y a/z', type)).toStrictEqual({
|
|
122
122
|
column: 9,
|
|
123
123
|
candidate: ',a/z',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Token } from '.';
|
|
1
|
+
const { Token } = require('../../lib/token/token');
|
|
2
|
+
const { TokenCollection } = require('../../lib/token/token-collection');
|
|
4
3
|
|
|
5
4
|
test('parse', () => {
|
|
6
5
|
expect(new TokenCollection(' a b c ').toJSON()).toStrictEqual([
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { checkSerializedPermissionsPolicy } from './check-serialized-permissions-policy';
|
|
1
|
+
const { checkSerializedPermissionsPolicy } = require('../../lib/w3c/check-serialized-permissions-policy');
|
|
4
2
|
|
|
5
3
|
const check = checkSerializedPermissionsPolicy();
|
|
6
4
|
|
package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js}
RENAMED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
const { checkDateTime } = require('../../../lib/whatwg/check-datetime');
|
|
2
|
+
const { checkDateString } = require('../../../lib/whatwg/check-datetime/date-string');
|
|
3
|
+
const { getMaxWeekNum } = require('../../../lib/whatwg/check-datetime/datetime-tokens');
|
|
4
|
+
const {
|
|
5
|
+
checkDurationISO8601LikeString,
|
|
6
|
+
checkDurationComponentListString,
|
|
7
|
+
} = require('../../../lib/whatwg/check-datetime/duration-string');
|
|
8
|
+
const { checkGlobalDateAndTimeString } = require('../../../lib/whatwg/check-datetime/global-date-and-time-string');
|
|
9
|
+
const {
|
|
10
|
+
checkLocalDateAndTimeString,
|
|
11
|
+
checkNormalizedLocalDateAndTimeString,
|
|
12
|
+
} = require('../../../lib/whatwg/check-datetime/local-date-and-time-string');
|
|
13
|
+
const { checkMonthString } = require('../../../lib/whatwg/check-datetime/month-string');
|
|
14
|
+
const { checkTimeString } = require('../../../lib/whatwg/check-datetime/time-string');
|
|
15
|
+
const { checkTimeZoneOffsetString } = require('../../../lib/whatwg/check-datetime/time-zone-offset-string');
|
|
16
|
+
const { checkWeekString } = require('../../../lib/whatwg/check-datetime/week-string');
|
|
17
|
+
const { checkYearString } = require('../../../lib/whatwg/check-datetime/year-string');
|
|
18
|
+
const { checkYearlessDateString } = require('../../../lib/whatwg/check-datetime/yearless-date-string');
|
|
16
19
|
|
|
17
20
|
const isMonth = checkMonthString();
|
|
18
21
|
const isDate = checkDateString();
|