@featherds/utils
Advanced tools
Comparing version 0.9.6 to 0.10.0
const getSafeId = function (str) { | ||
str = str || "feather"; | ||
const random = Math.floor(Math.random() * 1000000000); | ||
return [str.replace(/\s+/g, "-"), Date.now(), random].join("-"); | ||
str = str || "feather"; | ||
const random = Math.floor(Math.random() * 1000000000); | ||
return [str.replace(/\s+/g, "-"), Date.now(), random].join("-"); | ||
}; | ||
export { getSafeId }; |
29
keys.js
@@ -1,17 +0,16 @@ | ||
var KEYCODES = { | ||
PAGEUP: 33, | ||
PAGEDOWN: 34, | ||
UP: 38, | ||
DOWN: 40, | ||
LEFT: 37, | ||
RIGHT: 39, | ||
HOME: 36, | ||
END: 35, | ||
ENTER: 13, | ||
SPACE: 32, | ||
ESCAPE: 27, | ||
BACKSPACE: 8, | ||
DELETE: 46, | ||
const KEYCODES = { | ||
PAGEUP: 33, | ||
PAGEDOWN: 34, | ||
UP: 38, | ||
DOWN: 40, | ||
LEFT: 37, | ||
RIGHT: 39, | ||
HOME: 36, | ||
END: 35, | ||
ENTER: 13, | ||
SPACE: 32, | ||
ESCAPE: 27, | ||
BACKSPACE: 8, | ||
DELETE: 46, | ||
}; | ||
export { KEYCODES }; |
@@ -1,16 +0,16 @@ | ||
var translateKey = { | ||
props: { | ||
translationKey: { | ||
type: String, | ||
default: "", | ||
const translateKey = { | ||
props: { | ||
translationKey: { | ||
type: String, | ||
default: "", | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
translate: function (key) { | ||
return this.$t | ||
? this.$t(this.translationKey + key) | ||
: "Vue i18n is not loaded"; | ||
methods: { | ||
translate: function (key) { | ||
return this.$t | ||
? this.$t(this.translationKey + key) | ||
: "Vue i18n is not loaded"; | ||
}, | ||
}, | ||
}, | ||
}; | ||
export { translateKey }; |
{ | ||
"name": "@featherds/utils", | ||
"version": "0.9.6", | ||
"version": "0.10.0", | ||
"publishConfig": { | ||
@@ -8,3 +8,5 @@ "access": "public" | ||
"author": "NantHealth", | ||
"scripts": {}, | ||
"scripts": { | ||
"compile": "tsc --declaration" | ||
}, | ||
"keywords": [ | ||
@@ -14,4 +16,3 @@ "vue", | ||
], | ||
"types": "./src/index.d.ts", | ||
"gitHead": "04a74207e8bfa8d39acc470365e30dd6c90b2e8e" | ||
"gitHead": "9871b17eaedcfc90174b78b21acb0cc06afd594c" | ||
} |
@@ -1,13 +0,12 @@ | ||
var toView = function (el, parent) { | ||
if (!el || !parent) { | ||
return; | ||
} | ||
var elHeight = el.getBoundingClientRect().height; | ||
const compStyle = getComputedStyle(el); | ||
elHeight += parseInt(compStyle["margin-top"], 10); | ||
elHeight += parseInt(compStyle["margin-bottom"], 10); | ||
parent.scrollTop = | ||
el.offsetTop - parent.getBoundingClientRect().height + elHeight; | ||
const toView = function (el, parent) { | ||
if (!el || !parent) { | ||
return; | ||
} | ||
let elHeight = el.getBoundingClientRect().height; | ||
const compStyle = getComputedStyle(el); | ||
elHeight += parseInt(compStyle.getPropertyValue("margin-top"), 10); | ||
elHeight += parseInt(compStyle.getPropertyValue("margin-bottom"), 10); | ||
parent.scrollTop = | ||
el.offsetTop - parent.getBoundingClientRect().height + elHeight; | ||
}; | ||
export { toView }; |
126
test/axe.js
@@ -1,79 +0,59 @@ | ||
const { configureAxe } = require("jest-axe"); | ||
const chalk = require("chalk"); | ||
const { printReceived, matcherHint } = require("jest-matcher-utils"); | ||
import { configureAxe } from "jest-axe"; | ||
import chalk from "chalk"; | ||
import { printReceived, matcherHint } from "jest-matcher-utils"; | ||
const toHaveNoViolations = { | ||
toHaveNoViolations(results) { | ||
if (typeof results.violations === "undefined") { | ||
throw new Error("No violations found in aXe results object"); | ||
} | ||
const violations = results.violations.concat( | ||
results.incomplete.filter((x) => x.impact === "critical") | ||
); | ||
const reporter = (violations) => { | ||
if (violations.length === 0) { | ||
return []; | ||
} | ||
const lineBreak = "\n\n"; | ||
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"; | ||
return violations | ||
.map((violation) => { | ||
const errorBody = violation.nodes | ||
.map((node) => { | ||
const selector = node.target.join(", "); | ||
const expectedText = | ||
`Expected the HTML found at $('${selector}') to have no violations:` + | ||
lineBreak; | ||
return ( | ||
expectedText + | ||
chalk.grey(node.html) + | ||
lineBreak + | ||
`Received:` + | ||
lineBreak + | ||
printReceived(`${violation.help} (${violation.id})`) + | ||
lineBreak + | ||
chalk.yellow(node.failureSummary) + | ||
lineBreak + | ||
(violation.helpUrl | ||
? `You can find more information on this issue here: \n${chalk.blue( | ||
violation.helpUrl | ||
)}` | ||
: "") | ||
); | ||
toHaveNoViolations(results) { | ||
if (typeof results.violations === "undefined") { | ||
throw new Error("No violations found in aXe results object"); | ||
} | ||
const violations = results.violations.concat(results.incomplete.filter((x) => x.impact === "critical")); | ||
const reporter = (violations) => { | ||
if (violations.length === 0) { | ||
return []; | ||
} | ||
const lineBreak = "\n\n"; | ||
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"; | ||
return violations | ||
.map((violation) => { | ||
const errorBody = violation.nodes | ||
.map((node) => { | ||
const selector = node.target.join(", "); | ||
const expectedText = `Expected the HTML found at $('${selector}') to have no violations:` + | ||
lineBreak; | ||
return (expectedText + | ||
chalk.grey(node.html) + | ||
lineBreak + | ||
`Received:` + | ||
lineBreak + | ||
printReceived(`${violation.help} (${violation.id})`) + | ||
lineBreak + | ||
chalk.yellow(node.failureSummary || "") + | ||
lineBreak + | ||
(violation.helpUrl | ||
? `You can find more information on this issue here: \n${chalk.blue(violation.helpUrl)}` | ||
: "")); | ||
}) | ||
.join(lineBreak); | ||
return errorBody; | ||
}) | ||
.join(lineBreak); | ||
return errorBody; | ||
}) | ||
.join(lineBreak + horizontalLine + lineBreak); | ||
}; | ||
const formatedViolations = reporter(violations); | ||
const pass = formatedViolations.length === 0; | ||
const message = () => { | ||
if (pass) { | ||
return; | ||
} | ||
return ( | ||
matcherHint(".toHaveNoViolations") + "\n\n" + `${formatedViolations}` | ||
); | ||
}; | ||
return { actual: violations, message, pass }; | ||
}, | ||
.join(lineBreak + horizontalLine + lineBreak); | ||
}; | ||
const formatedViolations = reporter(violations); | ||
const pass = formatedViolations.length === 0; | ||
const message = () => { | ||
if (pass) { | ||
return; | ||
} | ||
return (matcherHint(".toHaveNoViolations") + "\n\n" + `${formatedViolations}`); | ||
}; | ||
return { actual: violations, message, pass }; | ||
}, | ||
}; | ||
expect.extend(toHaveNoViolations); | ||
export default configureAxe({ | ||
runOnly: { | ||
type: "tag", | ||
values: ["wcag2a", "wcag2aa"], | ||
}, | ||
reporter: "v2", | ||
runOnly: { | ||
type: "tag", | ||
values: ["wcag2a", "wcag2aa"], | ||
}, | ||
reporter: "v2", | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21262
21
315
1