How to use the ember-a11y-testing/utils/is-background-replaced-element function in ember-a11y-testing

To help you get started, we’ve selected a few ember-a11y-testing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-a11y / ember-a11y-testing / addon / instance-initializers / axe-component.js View on Github external
nodes = violation.nodes;

            if (isEmpty(nodes) || nodes.length === 0) {
              console.error(formatViolation(violation), violation); // eslint-disable-line no-console
              violationsHelper.push(violation);
            }

            for (let j = 0, k = nodes.length; j < k; j++) {
              nodeData = nodes[j];

              console.error(formatViolation(violation, nodeData.html), violation); // eslint-disable-line no-console
              violationsHelper.push(violation);

              if (nodeData) {
                nodeElem = document.querySelector(nodeData.target.join(','));
                classNamesToAdd = isBackgroundReplacedElement(nodeElem) ? [VIOLATION_CLASS_MAP.REPLACED_ELEMENT] : violationClasses;

                nodeElem.classList.remove(...VIOLATION_CLASS_NAMES);

                if (visualNoiseLevel > 0) {
                  nodeElem.classList.add(...classNamesToAdd);
                }
              }
            }
          }

          if (this.axeCallback) {
            assert('axeCallback should be a function.', typeof this.axeCallback === 'function');
            this.axeCallback(results);
          }

          scheduleOnce('afterRender', violationsHelper, violationsHelper.logTip);