-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: convert commons to ES Modules (#2155)
* chore: convert commons to ES Moduels * fix tests * fix tests
- Loading branch information
Showing
21 changed files
with
184 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,29 @@ | ||
/* global aria */ | ||
|
||
// TODO: es-module-commons. convert to: | ||
// export { default as allowedAttr } from 'path' | ||
import allowedAttr from './allowed-attr'; | ||
import arialabelText from './arialabel-text'; | ||
import arialabelledbyText from './arialabelledby-text'; | ||
import getElementUnallowedRoles from './get-element-unallowed-roles'; | ||
import getOwnedVirtual from './get-owned-virtual'; | ||
import getRoleType from './get-role-type'; | ||
import getRole from './get-role'; | ||
import getRolesByType from './get-roles-by-type'; | ||
import getRolesWithNameFromContents from './get-roles-with-name-from-contents'; | ||
import implicitNodes from './implicit-nodes'; | ||
import getImplicitRole from './implicit-role'; | ||
import isAccessibleRef from './is-accessible-ref'; | ||
import isAriaRoleAllowedOnElement from './is-aria-role-allowed-on-element'; | ||
import isUnsupportedRole from './is-unsupported-role'; | ||
import isValidRole from './is-valid-role'; | ||
import labelVirtual from './label-virtual'; | ||
import label from './label'; | ||
import lookupTable from './lookup-table'; | ||
import namedFromContents from './named-from-contents'; | ||
import requiredAttr from './required-attr'; | ||
import requiredContext from './required-context'; | ||
import requiredOwned from './required-owned'; | ||
import validateAttrValue from './validate-attr-value'; | ||
import validateAttr from './validate-attr'; | ||
|
||
/** | ||
* Namespace for aria-related utilities. | ||
* @namespace commons.aria | ||
* @memberof axe | ||
*/ | ||
// TODO: es-module-commons. don't rely on global | ||
aria = { | ||
allowedAttr, | ||
arialabelText, | ||
arialabelledbyText, | ||
getElementUnallowedRoles, | ||
getOwnedVirtual, | ||
getRoleType, | ||
getRole, | ||
getRolesByType, | ||
getRolesWithNameFromContents, | ||
implicitNodes, | ||
implicitRole: getImplicitRole, | ||
isAccessibleRef, | ||
isAriaRoleAllowedOnElement, | ||
isUnsupportedRole, | ||
isValidRole, | ||
labelVirtual, | ||
label, | ||
lookupTable, | ||
namedFromContents, | ||
requiredAttr, | ||
requiredContext, | ||
requiredOwned, | ||
validateAttrValue, | ||
validateAttr | ||
}; | ||
commons.aria = aria; | ||
export { default as allowedAttr } from './allowed-attr'; | ||
export { default as arialabelText } from './arialabel-text'; | ||
export { default as arialabelledbyText } from './arialabelledby-text'; | ||
export { default as getElementUnallowedRoles } from './get-element-unallowed-roles'; | ||
export { default as getOwnedVirtual } from './get-owned-virtual'; | ||
export { default as getRoleType } from './get-role-type'; | ||
export { default as getRole } from './get-role'; | ||
export { default as getRolesByType } from './get-roles-by-type'; | ||
export { default as getRolesWithNameFromContents } from './get-roles-with-name-from-contents'; | ||
export { default as implicitNodes } from './implicit-nodes'; | ||
export { default as implicitRole } from './implicit-role'; | ||
export { default as isAccessibleRef } from './is-accessible-ref'; | ||
export { default as isAriaRoleAllowedOnElement } from './is-aria-role-allowed-on-element'; | ||
export { default as isUnsupportedRole } from './is-unsupported-role'; | ||
export { default as isValidRole } from './is-valid-role'; | ||
export { default as labelVirtual } from './label-virtual'; | ||
export { default as label } from './label'; | ||
export { default as lookupTable } from './lookup-table'; | ||
export { default as namedFromContents } from './named-from-contents'; | ||
export { default as requiredAttr } from './required-attr'; | ||
export { default as requiredContext } from './required-context'; | ||
export { default as requiredOwned } from './required-owned'; | ||
export { default as validateAttrValue } from './validate-attr-value'; | ||
export { default as validateAttr } from './validate-attr'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,19 @@ | ||
// TODO: es-module-commons. convert to: | ||
// export { default as isAriaCombobox } from 'path' | ||
import centerPointOfRect from './center-point-of-rect'; | ||
import Color from './color'; | ||
import elementHasImage from './element-has-image'; | ||
import elementIsDistinct from './element-is-distinct'; | ||
import filteredRectStack from './filtered-rect-stack'; | ||
import flattenColors from './flatten-colors'; | ||
import getBackgroundColor from './get-background-color'; | ||
import getBackgroundStack from './get-background-stack'; | ||
import getContrast from './get-contrast'; | ||
import getForegroundColor from './get-foreground-color'; | ||
import getOwnBackgroundColor from './get-own-background-color'; | ||
import getRectStack from './get-rect-stack'; | ||
import hasValidContrastRatio from './has-valid-contrast-ratio'; | ||
import incompleteData from './incomplete-data'; | ||
|
||
/** | ||
* Namespace for color-related utilities. | ||
* @namespace commons.color | ||
* @memberof axe | ||
*/ | ||
const color = { | ||
centerPointOfRect, | ||
Color, | ||
elementHasImage, | ||
elementIsDistinct, | ||
filteredRectStack, | ||
flattenColors, | ||
getBackgroundColor, | ||
getBackgroundStack, | ||
getContrast, | ||
getForegroundColor, | ||
getOwnBackgroundColor, | ||
getRectStack, | ||
hasValidContrastRatio, | ||
incompleteData | ||
}; | ||
commons.color = color; | ||
export { default as centerPointOfRect } from './center-point-of-rect'; | ||
export { default as Color } from './color'; | ||
export { default as elementHasImage } from './element-has-image'; | ||
export { default as elementIsDistinct } from './element-is-distinct'; | ||
export { default as filteredRectStack } from './filtered-rect-stack'; | ||
export { default as flattenColors } from './flatten-colors'; | ||
export { default as getBackgroundColor } from './get-background-color'; | ||
export { default as getBackgroundStack } from './get-background-stack'; | ||
export { default as getContrast } from './get-contrast'; | ||
export { default as getForegroundColor } from './get-foreground-color'; | ||
export { default as getOwnBackgroundColor } from './get-own-background-color'; | ||
export { default as getRectStack } from './get-rect-stack'; | ||
export { default as hasValidContrastRatio } from './has-valid-contrast-ratio'; | ||
export { default as incompleteData } from './incomplete-data'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,38 @@ | ||
// TODO: es-module-commons. convert to: | ||
// export { default as isAriaCombobox } from 'path' | ||
import findElmsInContext from './find-elms-in-context'; | ||
import findUpVirtual from './find-up-virtual'; | ||
import findUp from './find-up'; | ||
import getComposedParent from './get-composed-parent'; | ||
import getElementByReference from './get-element-by-reference'; | ||
import getElementCoordinates from './get-element-coordinates'; | ||
import getElementStack from './get-element-stack'; | ||
import getRootNode from './get-root-node'; | ||
import getScrollOffset from './get-scroll-offset'; | ||
import getTabbableElements from './get-tabbable-elements'; | ||
import getTextElementStack from './get-text-element-stack'; | ||
import getViewportSize from './get-viewport-size'; | ||
import hasContentVirtual from './has-content-virtual'; | ||
import hasContent from './has-content'; | ||
import idrefs from './idrefs'; | ||
import insertedIntoFocusOrder from './inserted-into-focus-order'; | ||
import isFocusable from './is-focusable'; | ||
import isHiddenWithCSS from './is-hidden-with-css'; | ||
import isHTML5 from './is-html5'; | ||
import isInTextBlock from './is-in-text-block'; | ||
import isModalOpen from './is-modal-open'; | ||
import isNativelyFocusable from './is-natively-focusable'; | ||
import isNode from './is-node'; | ||
import isOffscreen from './is-offscreen'; | ||
import isOpaque from './is-opaque'; | ||
import isSkipLink from './is-skip-link'; | ||
import isVisible from './is-visible'; | ||
import isVisualContent from './is-visual-content'; | ||
import reduceToElementsBelowFloating from './reduce-to-elements-below-floating'; | ||
import shadowElementsFromPoint from './shadow-elements-from-point'; | ||
import urlPropsFromAttribute from './url-props-from-attribute'; | ||
import visuallyContains from './visually-contains'; | ||
import visuallyOverlaps from './visually-overlaps'; | ||
|
||
/** | ||
* Namespace for dom-related utilities. | ||
* @namespace dom | ||
* @memberof axe.commons | ||
*/ | ||
const dom = { | ||
findElmsInContext, | ||
findUpVirtual, | ||
findUp, | ||
getComposedParent, | ||
getElementByReference, | ||
getElementCoordinates, | ||
getElementStack, | ||
getRootNode, | ||
getScrollOffset, | ||
getTabbableElements, | ||
getTextElementStack, | ||
getViewportSize, | ||
hasContentVirtual, | ||
hasContent, | ||
idrefs, | ||
insertedIntoFocusOrder, | ||
isFocusable, | ||
isHiddenWithCSS, | ||
isHTML5, | ||
isInTextBlock, | ||
isModalOpen, | ||
isNativelyFocusable, | ||
isNode, | ||
isOffscreen, | ||
isOpaque, | ||
isSkipLink, | ||
isVisible, | ||
isVisualContent, | ||
reduceToElementsBelowFloating, | ||
shadowElementsFromPoint, | ||
urlPropsFromAttribute, | ||
visuallyContains, | ||
visuallyOverlaps | ||
}; | ||
commons.dom = dom; | ||
export { default as findElmsInContext } from './find-elms-in-context'; | ||
export { default as findUpVirtual } from './find-up-virtual'; | ||
export { default as findUp } from './find-up'; | ||
export { default as getComposedParent } from './get-composed-parent'; | ||
export { default as getElementByReference } from './get-element-by-reference'; | ||
export { default as getElementCoordinates } from './get-element-coordinates'; | ||
export { default as getElementStack } from './get-element-stack'; | ||
export { default as getRootNode } from './get-root-node'; | ||
export { default as getScrollOffset } from './get-scroll-offset'; | ||
export { default as getTabbableElements } from './get-tabbable-elements'; | ||
export { default as getTextElementStack } from './get-text-element-stack'; | ||
export { default as getViewportSize } from './get-viewport-size'; | ||
export { default as hasContentVirtual } from './has-content-virtual'; | ||
export { default as hasContent } from './has-content'; | ||
export { default as idrefs } from './idrefs'; | ||
export { default as insertedIntoFocusOrder } from './inserted-into-focus-order'; | ||
export { default as isFocusable } from './is-focusable'; | ||
export { default as isHiddenWithCSS } from './is-hidden-with-css'; | ||
export { default as isHTML5 } from './is-html5'; | ||
export { default as isInTextBlock } from './is-in-text-block'; | ||
export { default as isModalOpen } from './is-modal-open'; | ||
export { default as isNativelyFocusable } from './is-natively-focusable'; | ||
export { default as isNode } from './is-node'; | ||
export { default as isOffscreen } from './is-offscreen'; | ||
export { default as isOpaque } from './is-opaque'; | ||
export { default as isSkipLink } from './is-skip-link'; | ||
export { default as isVisible } from './is-visible'; | ||
export { default as isVisualContent } from './is-visual-content'; | ||
export { default as reduceToElementsBelowFloating } from './reduce-to-elements-below-floating'; | ||
export { default as shadowElementsFromPoint } from './shadow-elements-from-point'; | ||
export { default as urlPropsFromAttribute } from './url-props-from-attribute'; | ||
export { default as visuallyContains } from './visually-contains'; | ||
export { default as visuallyOverlaps } from './visually-overlaps'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
// TODO: es-module-commons. convert to: | ||
// export { default as isAriaCombobox } from 'path' | ||
import isAriaCombobox from './is-aria-combobox'; | ||
import isAriaListbox from './is-aria-listbox'; | ||
import isAriaRange from './is-aria-range'; | ||
import isAriaTextbox from './is-aria-textbox'; | ||
import isNativeSelect from './is-native-select'; | ||
import isNativeTextbox from './is-native-textbox'; | ||
|
||
/** | ||
* Namespace for forms-related utilities. | ||
* @namespace commons.forms | ||
* @memberof axe | ||
*/ | ||
const forms = { | ||
isAriaCombobox, | ||
isAriaListbox, | ||
isAriaRange, | ||
isAriaTextbox, | ||
isNativeSelect, | ||
isNativeTextbox | ||
}; | ||
commons.forms = forms; | ||
export { default as isAriaCombobox } from './is-aria-combobox'; | ||
export { default as isAriaListbox } from './is-aria-listbox'; | ||
export { default as isAriaRange } from './is-aria-range'; | ||
export { default as isAriaTextbox } from './is-aria-textbox'; | ||
export { default as isNativeSelect } from './is-native-select'; | ||
export { default as isNativeTextbox } from './is-native-textbox'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
/*exported commons */ | ||
/* global commons */ | ||
/*eslint no-unused-vars: 0*/ | ||
/** @namespace axe */ | ||
|
||
/** | ||
* Namespace for axe common methods. | ||
* @namespace commons | ||
* @memberof axe | ||
*/ | ||
import * as aria from './aria'; | ||
import * as color from './color'; | ||
import * as dom from './dom'; | ||
import * as forms from './forms'; | ||
import matches from './matches'; | ||
import * as table from './table'; | ||
import * as text from './text'; | ||
import utils from './utils'; | ||
|
||
var commons = {}; | ||
var aria = {}; | ||
var text = {}; | ||
var matches; | ||
commons = { | ||
aria, | ||
color, | ||
dom, | ||
forms, | ||
matches, | ||
table, | ||
text, | ||
utils | ||
}; |
Oops, something went wrong.