Skip to content

Commit

Permalink
Remove axe config obj in favor of callback
Browse files Browse the repository at this point in the history
maintain options object
  • Loading branch information
Juliette Pretot authored and jul-sh committed Dec 2, 2019
1 parent 08ba5e3 commit bdba977
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/AxeObserver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ export default class AxeObserver {
constructor(
violationsCallback,
{
axeCoreConfiguration = {
reporter: 'v2',
checks: [
{
id: 'color-contrast',
options: {
// Prevent axe from automatically scrolling
noScroll: true
axeCoreConfigurationCallback = function(axeInstance) {
axeInstance.configure({
reporter: 'v2',
checks: [
{
id: 'color-contrast',
options: {
// Prevent axe from automatically scrolling
noScroll: true
}
}
}
]
},
axeCoreInstanceCallback
]
})
}
} = {}
) {
if (typeof violationsCallback !== 'function') {
Expand All @@ -44,13 +45,10 @@ export default class AxeObserver {
// AuditQueue sequentially runs audits when the browser is idle.
this._auditQueue = new AuditQueue()

// Allow for registering plugins etc
// Configure axe, register plugins etc
if (typeof axeInstanceCallback === 'function') {
axeCoreInstanceCallback(axeCore)
axeCoreConfigurationCallback(axeCore)
}

// Configure axe
axeCore.configure(axeCoreConfiguration)
}
observe(targetNode) {
if (!targetNode) {
Expand Down

0 comments on commit bdba977

Please sign in to comment.