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

Exclude color-contrast for disabled fields using disabled attribute. #168

Open
sandeep-chennupati opened this issue Dec 21, 2023 · 0 comments

Comments

@sandeep-chennupati
Copy link

sandeep-chennupati commented Dec 21, 2023

Hi, I am trying to disable/exclude color-contrast only on disabled fields in cypress-axe. Is it possible?

const off = [
    'html-has-lang',
    'landmark-one-main',
    'page-has-heading-one',
    'region',
];

// config: https://github.com/component-driven/cypress-axe#cyconfigureaxe
// context, options: https://github.com/component-driven/cypress-axe#cychecka11y
export default (
    node = null,
    config = {rules: []},
    {context = null, options = null} = {
        context: null,
        options: null,
    },
    delay = 0
) => {
    init({
        ...config,
        rules: off
            .map(id => ({
                id,
                enabled: false,
            }))
            .concat(config.rules),
    });

    // add a .wait to make sure a render cycle is run before checkA11y so that
    // the styles for the element(s) can be applied before a11y tests are executed
    return mount(node).wait(delay).checkA11y(context, options, terminalLog);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant