Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(preload): cssom assets #958

Merged
merged 60 commits into from
Aug 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
321f4f1
feat(rule): css-orientation-lock raw structure
jeeyyy Jun 5, 2018
33205ec
feat: adding preload config object.
jeeyyy Jun 6, 2018
5e4f463
fix: merge > from develop
jeeyyy Jun 6, 2018
a3ea7c1
chore: merge from > develop
jeeyyy Jun 7, 2018
7119f2d
fix: wip new rule - css orientation
jeeyyy Jun 7, 2018
3782006
chore: merge from > develop
jeeyyy Jun 7, 2018
508c795
fix: wip - cssom work
jeeyyy Jun 7, 2018
b78ac30
style: update eslint to allow spread operator for object spreading.
jeeyyy Jun 19, 2018
4e590a5
feat: cssom preloading async
jeeyyy Jun 19, 2018
18b87e3
refactor: remove css-orientation-lock work from cssom preloading.
jeeyyy Jun 19, 2018
771bd88
refactor: comments and clean-up
jeeyyy Jun 19, 2018
eac06ac
feat: audit run queue to await cssom fetching.
jeeyyy Jun 20, 2018
cad3bb6
refactor: change promise to q implementation.
jeeyyy Jun 20, 2018
d9ab58f
refactor: q plumbing from preloading to audit run.
jeeyyy Jun 20, 2018
858710f
feat: refactor data marshalling of preloadedAssets.
jeeyyy Jun 20, 2018
678da39
style: fix linting errors.
jeeyyy Jun 20, 2018
f763dec
refactor: seperate preload configuration method to utils for better c…
jeeyyy Jun 25, 2018
1b847ea
test: additional tests for cssom.
jeeyyy Jun 25, 2018
50229a0
style: formamtting updates.
jeeyyy Jun 25, 2018
8426fab
style: update tests to not have any es6 keywords
jeeyyy Jun 25, 2018
46ae47c
fix: valid-lang integration tests.
jeeyyy Jun 25, 2018
b03981b
docs: add preload configuration to api documentation
jeeyyy Jun 25, 2018
0ba0ef9
docs: fix markdown lint.
jeeyyy Jun 25, 2018
ba00d6b
refactor: lint, test & docs updates.
jeeyyy Jun 26, 2018
4fa9d6a
fix: merge from develop
jeeyyy Jul 1, 2018
2074cc9
docs: update api documentation for preload configuration
jeeyyy Jul 1, 2018
9f57cdb
chore: remove merge redundant files
jeeyyy Jul 1, 2018
f18db7f
refactor: revert preload changes to run/ audit/ checks
jeeyyy Jul 2, 2018
1434751
fix: preload changes based on review
jeeyyy Jul 2, 2018
b64309c
refactor: revert formatting changes
jeeyyy Jul 2, 2018
5ea88d5
fix: update shadown dom test to not pollute fixture
jeeyyy Jul 2, 2018
28bdcdd
fix: markdown lint
jeeyyy Jul 2, 2018
87820da
Merge branch 'develop' into preload-cssom
jeeyyy Jul 2, 2018
ae59586
fix: refactor based on review
jeeyyy Jul 4, 2018
15d71f1
fix: merge from origin
jeeyyy Jul 4, 2018
3a10d63
Merge branch 'develop' into preload-cssom
jeeyyy Jul 12, 2018
222f05b
fix: implement axios against xhrQ
jeeyyy Jul 12, 2018
7f061ae
fix: refactor based on comments/ review
jeeyyy Jul 12, 2018
0fca2d1
refactor: try catch block for stylesheet cssRules
jeeyyy Jul 12, 2018
2155df8
refactor: changes based on code review
jeeyyy Jul 17, 2018
0923c36
style: revert formatting changes
jeeyyy Jul 17, 2018
29e3c61
docs: update documentation for preload configuration
jeeyyy Jul 17, 2018
9ecba9e
test: add integration tests for preload-cssom
jeeyyy Jul 17, 2018
0b9d62d
docs: fix markdown lint
jeeyyy Jul 17, 2018
f06701b
Merge branch 'develop' into preload-cssom
jeeyyy Jul 17, 2018
20e6f7d
fix: code review based refactor
jeeyyy Jul 30, 2018
06f6dfc
Merge branch 'develop' into preload-cssom
jeeyyy Jul 30, 2018
9e28b8a
Merge branch 'develop' into preload-cssom
jeeyyy Jul 30, 2018
483bcd8
test: update tests based on code review
jeeyyy Jul 30, 2018
a3ecee7
Merge branch 'develop' into preload-cssom
jeeyyy Jul 30, 2018
3436cc0
fix: updates based on review.
jeeyyy Jul 31, 2018
12008e7
Merge branch 'develop' into preload-cssom
jeeyyy Jul 31, 2018
8da721e
fix: shadowDOM support and review updates
jeeyyy Jul 31, 2018
30a0819
Merge branch 'develop' into preload-cssom
jeeyyy Jul 31, 2018
027b3a1
chore: merge from develop
jeeyyy Jul 31, 2018
567ef3c
fix: updates based on review
jeeyyy Aug 6, 2018
b5c3f4f
Merge branch 'develop' into preload-cssom
jeeyyy Aug 6, 2018
a8c74ad
Merge branch 'develop' into preload-cssom
jeeyyy Aug 8, 2018
63cc5b4
fix: update preload function and tests
jeeyyy Aug 8, 2018
247a7cb
Merge branch 'develop' into preload-cssom
jeeyyy Aug 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: refactor based on comments/ review
  • Loading branch information
jeeyyy committed Jul 12, 2018
commit 7f061aeb2f220e458360aa397fc44b45b355324c
2 changes: 1 addition & 1 deletion lib/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
resultGroups: [],
resultGroupMap: {},
impact: Object.freeze(['minor', 'moderate', 'serious', 'critical']),
preloadAssets: Object.freeze(['cssom']),
preloadAssets: Object.freeze(['cssom']), // overtime this array will grow with other preload asset types, this constant is to verify if a requested preload type by the user via the configuration is supported by axe.
preloadAssetsTimeout: 10000
};

Expand Down
28 changes: 9 additions & 19 deletions lib/core/utils/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function shouldPreload(options) {
return false;
}

if (typeof options.preload === typeof true) {
if (typeof options.preload === 'boolean') {
return options.preload;
}

Expand Down Expand Up @@ -63,16 +63,9 @@ function getPreloadConfig(options) {
);
}

// check if assets are valid items
const areRequestedAssetsValid = options.preload.assets.reduce(
(out, asset) => {
const a = asset.toLowerCase();
if (!axe.constants.preloadAssets.includes(a)) {
out = false;
}
return out;
},
true
// check if requested assets to preload are valid items
const areRequestedAssetsValid = options.preload.assets.every(a =>
axe.constants.preloadAssets.includes(a.toLowerCase())
);

if (!areRequestedAssetsValid) {
Expand All @@ -82,14 +75,11 @@ function getPreloadConfig(options) {
);
}

out.assets = options.preload.assets.reduce((out, asset) => {
const a = asset.toLowerCase();
// unique assets to load, in case user had requested same asset type many times.
if (!out.includes(a)) {
out.push(a);
}
return out;
}, []);
// unique assets to load, in case user had requested same asset type many times.
out.assets = axe.utils.uniqueArray(
options.preload.assets.map(a => a.toLowerCase()),
[]
);

if (
options.preload.timeout &&
Expand Down