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(run-virtual-rule): new api to run rules using only virtual nodes #1594

Merged
merged 13 commits into from
Jun 10, 2019

Conversation

straker
Copy link
Contributor

@straker straker commented May 28, 2019

This api allows a user to run a rule without needing an actual DOM node. It completes the api needed to run a rule in a linter on individual virtual nodes.

const vNode = {
  shadowId: undefined,
  children: [],
  parent: undefined,
  _cache: {},
  _isHidden: null,
  _attrs: {
    type: 'text',
    autocomplete: 'not-on-my-watch',
  },
  props: {
    nodeType: 1,
    nodeName: 'input',
    id: null,
    type: 'text'
  },
  hasClass() {
    return false;
  },
  attr(attrName) {
    return this._attrs[attrName];
  },
  hasAttr(attrName) {
    return !!this._attrs[attrName];
  }
};

const results = axe.runVirtualRule('autocomplete-valid', vNode);

Linked issue: #1601

Reviewer checks

Required fields, to be filled out by PR reviewer(s)

  • Follows the commit message policy, appropriate for next version
  • Has documentation updated, a DU ticket, or requires no documentation change
  • Includes new tests, or was unnecessary
  • Code is reviewed for security by: @WilcoFiers

@straker straker changed the title feat(run-virtual-rule): new api to run rules using only virtual nodes [WIP] feat(run-virtual-rule): new api to run rules using only virtual nodes May 28, 2019
@straker straker changed the title [WIP] feat(run-virtual-rule): new api to run rules using only virtual nodes feat(run-virtual-rule): new api to run rules using only virtual nodes May 28, 2019
lib/core/public/run-virtual-rule.js Outdated Show resolved Hide resolved
test/core/public/run-virtual-rule.js Outdated Show resolved Hide resolved
test/core/public/run-virtual-rule.js Show resolved Hide resolved
@straker straker changed the title feat(run-virtual-rule): new api to run rules using only virtual nodes [WIP] feat(run-virtual-rule): new api to run rules using only virtual nodes May 29, 2019
@straker straker requested a review from a team as a code owner June 6, 2019 20:27
@straker straker changed the title [WIP] feat(run-virtual-rule): new api to run rules using only virtual nodes feat(run-virtual-rule): new api to run rules using only virtual nodes Jun 7, 2019
Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor point

lib/core/base/virtual-node.js Show resolved Hide resolved
lib/core/base/rule.js Outdated Show resolved Hide resolved
lib/core/utils/select.js Show resolved Hide resolved
@straker straker merged commit 4e12217 into develop Jun 10, 2019
@straker straker deleted the runVirtualNode branch June 10, 2019 16:40
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

Successfully merging this pull request may close these issues.

3 participants