testaro 27.0.0 → 28.0.0
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/CONTRIBUTING.md +3 -1
- package/README.md +14 -3
- package/package.json +2 -1
- package/procs/aslint.js +83 -0
- package/procs/nav.js +56 -14
- package/procs/standardize.js +36 -0
- package/run.js +35 -22
- package/tests/aslint.js +83 -0
- package/tests/axe.js +4 -0
- package/tests/qualWeb.js +6 -0
- package/aslint/LICENSE +0 -362
- package/aslint/README.md +0 -260
- package/aslint/app/rules/abstract-rule.ts +0 -83
- package/aslint/app/rules/aslint/incorrect-technique-for-hiding-content/incorrect-technique-for-hiding-content.documentation.md +0 -36
- package/aslint/app/rules/aslint/incorrect-technique-for-hiding-content/incorrect-technique-for-hiding-content.test.ts +0 -113
- package/aslint/app/rules/aslint/incorrect-technique-for-hiding-content/incorrect-technique-for-hiding-content.ts +0 -103
- package/aslint/app/rules/aslint/invalid-attribute-dir-value/invalid-attribute-dir-value.documentation.md +0 -34
- package/aslint/app/rules/aslint/invalid-attribute-dir-value/invalid-attribute-dir-value.test.ts +0 -82
- package/aslint/app/rules/aslint/invalid-attribute-dir-value/invalid-attribute-dir-value.ts +0 -44
- package/aslint/app/rules/aslint/label-duplicated-content-title/label-duplicated-content-title.documentation.md +0 -40
- package/aslint/app/rules/aslint/label-duplicated-content-title/label-duplicated-content-title.test.ts +0 -48
- package/aslint/app/rules/aslint/label-duplicated-content-title/label-duplicated-content-title.ts +0 -37
- package/aslint/app/rules/aslint/links-language-destination/links-language-destination.test.ts +0 -50
- package/aslint/app/rules/aslint/links-language-destination/links-language-destination.ts +0 -70
- package/aslint/app/rules/aslint/main-element-only-one/main-element-only-one.test.ts +0 -55
- package/aslint/app/rules/aslint/main-element-only-one/main-element-only-one.ts +0 -83
- package/aslint/app/rules/aslint/main-landmark-must-be-top-level/main-landmark-must-be-top-level.test.ts +0 -12
- package/aslint/app/rules/aslint/main-landmark-must-be-top-level/main-landmark-must-be-top-level.ts +0 -73
- package/aslint/app/rules/aslint/minimum-font-size/minimum-font-size.test.ts +0 -12
- package/aslint/app/rules/aslint/minimum-font-size/minimum-font-size.ts +0 -87
- package/aslint/app/rules/aslint/missing-href-on-a/missing-href-on-a.test.ts +0 -48
- package/aslint/app/rules/aslint/missing-href-on-a/missing-href-on-a.ts +0 -40
- package/aslint/app/rules/aslint/misused-aria-on-focusable-element/misused-aria-on-focusable-element.test.ts +0 -12
- package/aslint/app/rules/aslint/misused-aria-on-focusable-element/misused-aria-on-focusable-element.ts +0 -66
- package/aslint/app/rules/aslint/misused-input-attribute/misused-input-attribute.test.ts +0 -12
- package/aslint/app/rules/aslint/misused-input-attribute/misused-input-attribute.ts +0 -134
- package/aslint/app/rules/aslint/misused-required-attribute/misused-required-attribute.test.ts +0 -12
- package/aslint/app/rules/aslint/misused-required-attribute/misused-required-attribute.ts +0 -90
- package/aslint/app/rules/aslint/navigation-landmark-restrictions/navigation-landmark-restrictions.test.ts +0 -12
- package/aslint/app/rules/aslint/navigation-landmark-restrictions/navigation-landmark-restrictions.ts +0 -48
- package/aslint/app/rules/aslint/obsolete-html-attributes/obsolete-html-attributes.test.ts +0 -12
- package/aslint/app/rules/aslint/obsolete-html-attributes/obsolete-html-attributes.ts +0 -148
- package/aslint/app/rules/aslint/obsolete-html-elements/obsolete-html-elements.test.ts +0 -12
- package/aslint/app/rules/aslint/obsolete-html-elements/obsolete-html-elements.ts +0 -66
- package/aslint/app/rules/aslint/outline-zero/outline-zero.test.ts +0 -12
- package/aslint/app/rules/aslint/outline-zero/outline-zero.ts +0 -85
- package/aslint/app/rules/aslint/overlay/overlay.test.ts +0 -122
- package/aslint/app/rules/aslint/overlay/overlay.ts +0 -141
- package/aslint/app/rules/aslint/redundant/aria-role-dialog/aria-role-dialog.documentation.md +0 -49
- package/aslint/app/rules/aslint/redundant/aria-role-dialog/aria-role-dialog.test.ts +0 -91
- package/aslint/app/rules/aslint/redundant/aria-role-dialog/aria-role-dialog.ts +0 -62
- package/aslint/app/rules/aslint/redundant/capital-letters-words/capital-letters-words.documentation.md +0 -44
- package/aslint/app/rules/aslint/redundant/capital-letters-words/capital-letters-words.test.ts +0 -111
- package/aslint/app/rules/aslint/redundant/capital-letters-words/capital-letters-words.ts +0 -120
- package/aslint/app/rules/aslint/redundant/contentinfo-landmark-only-one/contentinfo-landmark-only-one.documentation.md +0 -45
- package/aslint/app/rules/aslint/redundant/contentinfo-landmark-only-one/contentinfo-landmark-only-one.test.ts +0 -63
- package/aslint/app/rules/aslint/redundant/contentinfo-landmark-only-one/contentinfo-landmark-only-one.ts +0 -44
- package/aslint/app/rules/aslint/redundant/empty-title-attribute/empty-title-attribute.documentation.md +0 -55
- package/aslint/app/rules/aslint/redundant/empty-title-attribute/empty-title-attribute.test.ts +0 -80
- package/aslint/app/rules/aslint/redundant/empty-title-attribute/empty-title-attribute.ts +0 -58
- package/aslint/app/rules/aslint/redundant/flash-content/flash-content.documentation.md +0 -48
- package/aslint/app/rules/aslint/redundant/flash-content/flash-content.test.ts +0 -52
- package/aslint/app/rules/aslint/redundant/flash-content/flash-content.ts +0 -32
- package/aslint/app/rules/aslint/redundant/font-style-italic/font-style-italic.documentation.md +0 -44
- package/aslint/app/rules/aslint/redundant/font-style-italic/font-style-italic.test.ts +0 -12
- package/aslint/app/rules/aslint/redundant/font-style-italic/font-style-italic.ts +0 -83
- package/aslint/app/rules/aslint/redundant/h1-must-be/h1-must-be.documentation.md +0 -46
- package/aslint/app/rules/aslint/redundant/h1-must-be/h1-must-be.test.ts +0 -46
- package/aslint/app/rules/aslint/redundant/h1-must-be/h1-must-be.ts +0 -36
- package/aslint/app/rules/aslint/role-application/role-application.test.ts +0 -48
- package/aslint/app/rules/aslint/role-application/role-application.ts +0 -38
- package/aslint/app/rules/aslint/rtl-content/rtl-content.test.ts +0 -12
- package/aslint/app/rules/aslint/rtl-content/rtl-content.ts +0 -75
- package/aslint/app/rules/aslint/unclear-uri-on-a/unclear-anchor-uri.test.ts +0 -12
- package/aslint/app/rules/aslint/unclear-uri-on-a/unclear-anchor-uri.ts +0 -48
- package/aslint/app/rules/aslint/unimportant/aria-hidden-false/aria-hidden-false.test.ts +0 -73
- package/aslint/app/rules/aslint/unimportant/aria-hidden-false/aria-hidden-false.ts +0 -34
- package/aslint/app/rules/aslint/unimportant/aria-hidden-false/aria-hidden.documentation.md +0 -32
- package/aslint/app/rules/aslint/unimportant/content-editable-missing-attributes/content-editable-missing-attributes.docmentation.md +0 -48
- package/aslint/app/rules/aslint/unimportant/content-editable-missing-attributes/content-editable-missing-attributes.test.ts +0 -67
- package/aslint/app/rules/aslint/unimportant/content-editable-missing-attributes/content-editable-missing-attributes.ts +0 -63
- package/aslint/app/rules/aslint/unsupported-role-on-element/unsupported-role-on-element.test.ts +0 -12
- package/aslint/app/rules/aslint/unsupported-role-on-element/unsupported-role-on-element.ts +0 -63
- package/aslint/app/rules/aslint/used/elements-not-allowed-in-head/elements-not-allowed-in-head.documentation.md +0 -65
- package/aslint/app/rules/aslint/used/elements-not-allowed-in-head/elements-not-allowed-in-head.test.ts +0 -53
- package/aslint/app/rules/aslint/used/elements-not-allowed-in-head/elements-not-allowed-in-head.ts +0 -47
- package/aslint/app/rules/aslint/used/headings-sibling-unique/headings-sibling-unique.documentation.md +0 -57
- package/aslint/app/rules/aslint/used/headings-sibling-unique/headings-sibling-unique.test.ts +0 -52
- package/aslint/app/rules/aslint/used/headings-sibling-unique/headings-sibling-unique.ts +0 -63
- package/aslint/app/rules/aslint/used/horizontal-rule/horizontal-rule.documentation.md +0 -39
- package/aslint/app/rules/aslint/used/horizontal-rule/horizontal-rule.test.ts +0 -66
- package/aslint/app/rules/aslint/used/horizontal-rule/horizontal-rule.ts +0 -37
- package/aslint/utils/aria.test.ts +0 -12
- package/aslint/utils/aria.ts +0 -120
- package/aslint/utils/async.test.ts +0 -25
- package/aslint/utils/async.ts +0 -22
- package/aslint/utils/common.test.ts +0 -239
- package/aslint/utils/common.ts +0 -168
- package/aslint/utils/console.test.ts +0 -85
- package/aslint/utils/console.ts +0 -89
- package/aslint/utils/css.test.ts +0 -153
- package/aslint/utils/css.ts +0 -191
- package/aslint/utils/dom.test.ts +0 -627
- package/aslint/utils/dom.ts +0 -1051
- package/aslint/utils/env.test.ts +0 -14
- package/aslint/utils/env.ts +0 -8
- package/aslint/utils/func.test.ts +0 -160
- package/aslint/utils/func.ts +0 -70
- package/aslint/utils/global.test.ts +0 -12
- package/aslint/utils/global.ts +0 -25
- package/aslint/utils/object.test.ts +0 -524
- package/aslint/utils/object.ts +0 -278
- package/aslint/utils/report.test.ts +0 -56
- package/aslint/utils/report.ts +0 -36
- package/aslint/utils/text.test.ts +0 -270
- package/aslint/utils/text.ts +0 -165
- package/aslint/utils/time.test.ts +0 -43
- package/aslint/utils/time.ts +0 -33
package/aslint/utils/env.test.ts
DELETED
package/aslint/utils/env.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Global } from './global';
|
|
2
|
-
import { Func } from './func';
|
|
3
|
-
|
|
4
|
-
describe('Func', () => {
|
|
5
|
-
|
|
6
|
-
describe('#extend', () => {
|
|
7
|
-
let objectToExtend: { defaultProperty?: any; defaultMethod?: any; o?: any },
|
|
8
|
-
objectExtendDefault: { defaultProperty: number; defaultMethod: () => any },
|
|
9
|
-
objectExtendDeep: { defaultProperty: number; defaultMethod: () => any; o: { arr: any[] } };
|
|
10
|
-
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
objectToExtend = {};
|
|
13
|
-
|
|
14
|
-
objectExtendDefault = {
|
|
15
|
-
defaultMethod: () => {
|
|
16
|
-
return null;
|
|
17
|
-
},
|
|
18
|
-
defaultProperty: 1
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
objectExtendDeep = {
|
|
22
|
-
defaultMethod: () => {
|
|
23
|
-
return null;
|
|
24
|
-
},
|
|
25
|
-
defaultProperty: 1,
|
|
26
|
-
o: {
|
|
27
|
-
arr: []
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('extend empty object with default values', () => {
|
|
33
|
-
Func.mixin(objectToExtend, objectExtendDefault);
|
|
34
|
-
expect(objectToExtend.defaultProperty).toBe(1);
|
|
35
|
-
expect(typeof objectToExtend.defaultMethod).toBe('function');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('extend filled object with default values, overwrite values', () => {
|
|
39
|
-
objectToExtend.defaultProperty = 2;
|
|
40
|
-
Func.mixin(objectToExtend, objectExtendDefault);
|
|
41
|
-
expect(objectToExtend.defaultProperty).toBe(1);
|
|
42
|
-
expect(typeof objectToExtend.defaultMethod).toBe('function');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('deep extend filled object with default values, overwrite values', () => {
|
|
46
|
-
Func.mixin(objectToExtend, objectExtendDeep);
|
|
47
|
-
expect(objectToExtend.defaultProperty).toBe(1);
|
|
48
|
-
expect(typeof objectToExtend.defaultMethod).toBe('function');
|
|
49
|
-
expect(typeof objectToExtend.o).toBe('object');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('#defaults', () => {
|
|
55
|
-
|
|
56
|
-
let target: { str: any; num: any; bool: any; arr: any; obj: any; und: any; nul: any; a?: any; zero?: any };
|
|
57
|
-
|
|
58
|
-
beforeEach(() => {
|
|
59
|
-
target = {
|
|
60
|
-
arr: [1, 2, 3],
|
|
61
|
-
bool: true,
|
|
62
|
-
nul: null,
|
|
63
|
-
num: 42,
|
|
64
|
-
obj: {
|
|
65
|
-
bar: 'bar',
|
|
66
|
-
foo: 'foo'
|
|
67
|
-
},
|
|
68
|
-
str: 'str',
|
|
69
|
-
und: undefined
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
afterEach(() => {
|
|
74
|
-
target = undefined;
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('add properties to the target object if the property is not previously defined', () => {
|
|
78
|
-
Func.defaults(target, {
|
|
79
|
-
a: 'a',
|
|
80
|
-
und: 'defined',
|
|
81
|
-
zero: 0
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
expect(target.str).toBe('str');
|
|
85
|
-
expect(target.num).toBe(42);
|
|
86
|
-
expect(target.bool).toBe(true);
|
|
87
|
-
expect(target.arr).toEqual([1, 2, 3]);
|
|
88
|
-
expect(target.obj).toEqual({
|
|
89
|
-
bar: 'bar',
|
|
90
|
-
foo: 'foo'
|
|
91
|
-
});
|
|
92
|
-
expect(target.und).toBe('defined');
|
|
93
|
-
expect(target.nul).toBe(null);
|
|
94
|
-
expect(target.a).toBe('a');
|
|
95
|
-
expect(target.zero).toBe(0);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('does not add a property to the target object if it is already defined', () => {
|
|
99
|
-
Func.defaults(target, {
|
|
100
|
-
nul: 'null',
|
|
101
|
-
str: 'newstr',
|
|
102
|
-
und: 'defined'
|
|
103
|
-
});
|
|
104
|
-
expect(target.str).toBe('str');
|
|
105
|
-
expect(target.nul).toBe(null);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('returns a new object with all merged defaults if target is null or undefined', () => {
|
|
109
|
-
const defaulted = Func.defaults(null, {
|
|
110
|
-
a: 'a',
|
|
111
|
-
zero: 0
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
expect(defaulted).toEqual({
|
|
115
|
-
a: 'a',
|
|
116
|
-
zero: 0
|
|
117
|
-
});
|
|
118
|
-
expect(defaulted).not.toBe({
|
|
119
|
-
a: 'a',
|
|
120
|
-
zero: 0
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
describe('#namespace', () => {
|
|
126
|
-
const ns = 'Test.Foo.Bar.Baz';
|
|
127
|
-
|
|
128
|
-
beforeEach(() => {
|
|
129
|
-
expect(Global.context.Test).toBeUndefined();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
afterEach(() => {
|
|
133
|
-
delete Global.context.Test;
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('returns the global object if it exists for the given namespace', () => {
|
|
137
|
-
Global.context.Test = {
|
|
138
|
-
Already: 'here'
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const baz = Func.namespace(ns);
|
|
142
|
-
|
|
143
|
-
expect(Global.context.Test).toBeDefined();
|
|
144
|
-
expect(Global.context.Test.Already).toBe('here');
|
|
145
|
-
expect(Global.context.Test.Foo.Bar).toBeDefined();
|
|
146
|
-
expect(Global.context.Test.Foo.Bar.Baz).toBeDefined();
|
|
147
|
-
expect(Global.context.Test.Foo.Bar.Baz).toBe(baz);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('returns a new object if no global object exists for the given namespace', () => {
|
|
151
|
-
const baz = Func.namespace(ns);
|
|
152
|
-
|
|
153
|
-
expect(Global.context.Test.Foo).toBeDefined();
|
|
154
|
-
expect(Global.context.Test.Foo.Bar).toBeDefined();
|
|
155
|
-
expect(Global.context.Test.Foo.Bar.Baz).toBeDefined();
|
|
156
|
-
expect(Global.context.Test.Foo.Bar.Baz).toBe(baz);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
});
|
package/aslint/utils/func.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export class Func {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Deep object mixin, extending destination object with properties of source object
|
|
5
|
-
* @method
|
|
6
|
-
* @param {Object} destination object with original values/ new object
|
|
7
|
-
* @param {Object} source object with default values
|
|
8
|
-
* @return {Object} extended object
|
|
9
|
-
*/
|
|
10
|
-
public static mixin(targetObject: any, ...sources: any[]): any {
|
|
11
|
-
const target: any = targetObject ? targetObject : {};
|
|
12
|
-
|
|
13
|
-
const processSources = (src: any): any => {
|
|
14
|
-
if (src) {
|
|
15
|
-
const copyValue = (key: string): any => {
|
|
16
|
-
target[key] = src[key];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
Object.keys(src).forEach(copyValue);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
sources.forEach(processSources);
|
|
24
|
-
|
|
25
|
-
return target;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* similar to mixin, but only adds to the target the properties which are undefined
|
|
30
|
-
* @param {object} targetObject - the object to extend
|
|
31
|
-
* @param {...object} sources - an object(s) with properties to be added to the target if the property doesn't exist on the target or on a previous source
|
|
32
|
-
* @returns {object} modified target with added defaults
|
|
33
|
-
*/
|
|
34
|
-
public static defaults(targetObject: any, sources: any): any {
|
|
35
|
-
let target: any = {};
|
|
36
|
-
|
|
37
|
-
if (targetObject) {
|
|
38
|
-
target = targetObject;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (sources) {
|
|
42
|
-
const processSrc = (key: string): void => {
|
|
43
|
-
if (typeof target[key] === 'undefined') {
|
|
44
|
-
target[key] = sources[key];
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
Object.keys(sources).forEach(processSrc);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return target;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public static namespace(namespace: any, context?: any): any {
|
|
55
|
-
const parts: string[] = namespace.split('.');
|
|
56
|
-
const len: number = parts.length;
|
|
57
|
-
let parent: any = context || global;
|
|
58
|
-
|
|
59
|
-
for (let i = 0; i < len; i += 1) {
|
|
60
|
-
if (parent[parts[i]] === undefined) {
|
|
61
|
-
parent[parts[i]] = {};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
parent = parent[parts[i]];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return parent;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}
|
package/aslint/utils/global.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export class Global {
|
|
3
|
-
|
|
4
|
-
public static get context(): any {
|
|
5
|
-
return (function (): any {
|
|
6
|
-
if (typeof globalThis === 'object') {
|
|
7
|
-
return globalThis;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(Object.prototype, '__magic__', {
|
|
11
|
-
configurable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
/* @ts-ignore */
|
|
18
|
-
__magic__.globalThis = __magic__;
|
|
19
|
-
|
|
20
|
-
/* @ts-ignore */
|
|
21
|
-
delete Object.prototype.__magic__;
|
|
22
|
-
}());
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}
|