This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
chore(tests): fix behavior test regex #734
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ const testHelper = new TestHelper() | |
|
|
||
| // Example: Adds attribute 'aria-pressed=true' based on the property 'active' | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([\w\-\w \s*]+)=([a-z]+)' based on the property '([a-z]+)'\./g, | ||
| regexp: /Adds attribute '([\w-]+)=(\w+)' based on the property '(\w+)'\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, attributeExpectedValue, propertyDependingOn] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -22,7 +22,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds attribute 'aria-hidden=true' to icon | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([\w\-\w \s*]+)=([a-z]+)' to [a-z]+/g, | ||
| regexp: /Adds attribute '([\w-]+)=(\w+)' to \w+/g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, attributeExpectedValue] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -33,7 +33,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds role='listbox'. | ||
| definitions.push({ | ||
| regexp: /Adds role='([a-z]+)'\./g, | ||
| regexp: /Adds role='(\w+)'\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [roleToBeAdded] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -44,7 +44,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds role 'menuitem' to 'anchor' component's part | ||
| definitions.push({ | ||
| regexp: /Adds role '([a-z]+)' to '([a-z]+)' component's part/g, | ||
| regexp: /Adds role '(\w+)' to '([\w-]+)' component's part/g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [roleToBeAdded, elementWhereToBeAdded] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -56,7 +56,7 @@ definitions.push({ | |
| // Example: Adds attribute 'tabIndex=0' to 'anchor' component's part. | ||
| // Adds attribute 'data-is-focusable=true' to 'anchor' component's part. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-z A-Z -]+)=([a-z 0-9]+)' to '([a-z]+)' component's part\./g, | ||
| regexp: /Adds attribute '([\w-]+)=([\w\d]+)' to '([\w-]+)' component's part\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, attributeExpectedValue, elementWhereToBeAdded] = [ | ||
| ...parameters.props, | ||
|
|
@@ -73,7 +73,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds attribute 'aria-expanded=true' based on the property 'menuOpen' if the component has 'menu' property to 'anchor' component's part. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-z A-Z -]+)=([a-z 0-9]+)' based on the property '([a-z A-Z -]+)' if the component has '([a-z -]+)' property to '([a-z -]+)' component's part\./g, | ||
| regexp: /Adds attribute '([\w-]+)=([\w\d]+)' based on the property '([\w-]+)' if the component has '([\w-]+)' property to '([\w-]+)' component's part\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [ | ||
| attributeToBeAdded, | ||
|
|
@@ -110,7 +110,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds attribute 'aria-label' based on the property 'aria-label' to 'anchor' component's part. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-z -]+)' based on the property '([a-z -]+)' to '([a-z -]+)' component's part\./g, | ||
| regexp: /Adds attribute '([\w-]+)' based on the property '([\w-]+)' to '([\w-]+)' component's part\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, propertyDependingOn, elementWhereToBeAdded] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -127,7 +127,7 @@ definitions.push({ | |
|
|
||
| // Adds attribute 'aria-selected=true' to 'anchor' component's part based on the property 'active'. This can be overriden by directly providing 'aria-selected' property to the component. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-zA-Z-]+)=([a-z0-9]+)' to '([a-z-]+)' component's part based on the property '[a-z]+'\. This can be overriden by providing '([a-z-]+)' property directly to the component\./g, | ||
| regexp: /Adds attribute '([\w-]+)=([\w\d]+)' to '([\w-]+)' component's part based on the property '\w+'\. This can be overriden by providing '([\w-]+)' property directly to the component\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, valueOfAttributeToBeAdded, component, overridingProperty] = [ | ||
| ...parameters.props, | ||
|
|
@@ -146,7 +146,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds attribute 'aria-disabled=true' based on the property 'disabled'. This can be overriden by providing 'aria-disabled' property directly to the component. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-z A-Z -]+)=([a-z 0-9]+)' based on the property '[a-z]+'\. This can be overriden by providing '([a-z -]+)' property directly to the component\./g, | ||
| regexp: /Adds attribute '([\w-]+)=([\w\d]+)' based on the property '\w+'\. This can be overriden by providing '([\w-]+)' property directly to the component\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, valueOfAttributeToBeAdded, overridingProperty] = [ | ||
| ...parameters.props, | ||
|
|
@@ -188,7 +188,7 @@ function testMethodConditionallyAddAttribute( | |
|
|
||
| // Example: Adds attribute 'aria-disabled=true' to 'trigger' component's part if 'disabled' property is true. Does not set the attribute otherwise. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-zA-Z-]+)=([a-z0-9]+)' to '([a-z-]+)' component's part if '([a-z -]+)' property is true\. Does not set the attribute otherwise\./g, | ||
| regexp: /Adds attribute '([\w-]+)=([\w\d]+)' to '([\w-]+)' component's part if '([\w-]+)' property is true\. Does not set the attribute otherwise\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, valueOfAttributeToBeAdded, component, propertyDependsOn] = [ | ||
| ...parameters.props, | ||
|
|
@@ -208,7 +208,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds attribute 'aria-disabled=true' to 'trigger' component's part if 'disabled' property is true. Sets the attribute to 'false' otherwise. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-zA-Z-]+)=([a-z0-9]+)' to '([a-z-]+)' component's part if '([a-z -]+)' property is true\. Sets the attribute to '([a-z0-9]+)' otherwise\./g, | ||
| regexp: /Adds attribute '([\w-]+)=([\w\d]+)' to '([\w-]+)' component's part if '([\w-]+)' property is true\. Sets the attribute to '([\w\d]+)' otherwise\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [ | ||
| attributeToBeAdded, | ||
|
|
@@ -232,7 +232,7 @@ definitions.push({ | |
|
|
||
| // Adds attribute 'aria-haspopup=true' to 'root' component's part if 'menu' menu property is set. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([a-zA-Z-]+)=([a-z0-9]+)' to '([a-z-]+)' component's part if '([a-z -]+)' property is set\./g, | ||
| regexp: /Adds attribute '([\w-]+)=([\w\d]+)' to '([\w-]+)' component's part if '([\w-]+)' property is set\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [ | ||
| attributeToBeAdded, | ||
|
|
@@ -256,7 +256,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds attribute 'aria-hidden=true', if there is no 'alt' property provided. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([\w\-\w \s*]+)=([a-z]+)', if there is no 'alt' property provided\.+/g, | ||
| regexp: /Adds attribute '([\w-]+)=(\w+)', if there is no 'alt' property provided\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [attributeToBeAdded, attributeExpectedValue] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -277,7 +277,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds attribute 'aria-expanded=true' based on the property 'open' if the component has 'hasSubtree' property. | ||
| definitions.push({ | ||
| regexp: /Adds attribute '([\w\-\w \s*]+)=([a-z]+)' based on the property '([a-z]+)' if the component has '([a-zA-Z]+)' property./g, | ||
| regexp: /Adds attribute '([\w-]+)=(\w+)' based on the property '(\w+)' if the component has '(\w+)' property\./g, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| testMethod: (parameters: TestMethod) => { | ||
| const [ | ||
| attributeToBeAdded, | ||
|
|
@@ -319,7 +319,7 @@ definitions.push({ | |
|
|
||
| // Example: Adds role='button' if element type is other than 'button'. | ||
| definitions.push({ | ||
| regexp: /Adds role='([a-z]+)' if element type is other than '[a-z]+'\.+/g, | ||
| regexp: /Adds role='(\w+)' if element type is other than '\w+'\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [roleToBeAdded] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -338,7 +338,7 @@ definitions.push({ | |
|
|
||
| // Embeds FocusZone into component allowing arrow key navigation through the children of the component. | ||
| definitions.push({ | ||
| regexp: /Embeds FocusZone into component allowing arrow key navigation through the children of the component\.+/g, | ||
| regexp: /Embeds FocusZone into component allowing arrow key navigation through the children of the component\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const actualFocusZone = parameters.behavior({}).focusZone | ||
|
|
||
|
|
@@ -356,7 +356,7 @@ definitions.push({ | |
|
|
||
| // [Circular navigation] Embeds FocusZone into component allowing circular arrow key navigation through the children of the component. | ||
| definitions.push({ | ||
| regexp: /Embeds FocusZone into component allowing circular arrow key navigation through the children of the component\.+/g, | ||
| regexp: /Embeds FocusZone into component allowing circular arrow key navigation through the children of the component\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const actualFocusZone = parameters.behavior({}).focusZone | ||
|
|
||
|
|
@@ -374,7 +374,7 @@ definitions.push({ | |
|
|
||
| // Wraps component in FocusZone allowing arrow key navigation through the children of the component. | ||
| definitions.push({ | ||
| regexp: /Wraps component in FocusZone allowing arrow key navigation through the children of the component\.+/g, | ||
| regexp: /Wraps component in FocusZone allowing arrow key navigation through the children of the component\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const actualFocusZone = parameters.behavior({}).focusZone | ||
|
|
||
|
|
@@ -392,7 +392,7 @@ definitions.push({ | |
|
|
||
| // [Circular navigation] Wraps component in FocusZone allowing circular arrow key navigation through the children of the component. | ||
| definitions.push({ | ||
| regexp: /Wraps component in FocusZone allowing circular arrow key navigation through the children of the component\.+/g, | ||
| regexp: /Wraps component in FocusZone allowing circular arrow key navigation through the children of the component\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const actualFocusZone = parameters.behavior({}).focusZone | ||
|
|
||
|
|
@@ -440,7 +440,7 @@ definitions.push({ | |
|
|
||
| // Triggers 'click' action with 'Enter' or 'Spacebar' on 'root'. | ||
| definitions.push({ | ||
| regexp: /Triggers '([a-z A-Z]+)' action with '([a-z A-Z]+)' or '([a-z A-Z]+)' on '([a-z A-Z]+)'\.+/g, | ||
| regexp: /Triggers '(\w+)' action with '(\w+)' or '(\w+)' on '(\w+)'\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [action, firstKey, secondKey, elementToPerformAction] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -457,7 +457,7 @@ definitions.push({ | |
|
|
||
| // Triggers 'closeAllMenus' action with 'Escape' on 'root'. | ||
| definitions.push({ | ||
| regexp: /Triggers '([a-z A-Z]+)' action with '([a-z A-Z]+)' on '([a-z A-Z]+)'\.+/g, | ||
| regexp: /Triggers '(\w+)' action with '(\w+)' on '(\w+)'\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [action, key, elementToPerformAction] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -470,7 +470,7 @@ definitions.push({ | |
|
|
||
| // Triggers 'openMenu' action with 'ArrowDown' on 'root', when orientaton is horizontal. | ||
| definitions.push({ | ||
| regexp: /Triggers '([a-z A-Z]+)' action with '([a-z A-Z]+)' on '([a-z A-Z]+)', when orientation is horizontal\.+/g, | ||
| regexp: /Triggers '(\w+)' action with '(\w+)' on '([\w-]+)', when orientation is horizontal\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [action, key, elementToPerformAction] = [...parameters.props] | ||
| const property = {} | ||
|
|
@@ -483,7 +483,7 @@ definitions.push({ | |
|
|
||
| // Triggers 'openMenu' action with 'ArrowRight' on 'root', when orientation is vertical. | ||
| definitions.push({ | ||
| regexp: /Triggers '([a-z A-Z]+)' action with '([a-z A-Z]+)' on '([a-z A-Z]+)', when orientation is vertical\.+/g, | ||
| regexp: /Triggers '(\w+)' action with '(\w+)' on '([\w-]+)', when orientation is vertical\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const [action, key, elementToPerformAction] = [...parameters.props] | ||
| const propertyVertical = { vertical: true } | ||
|
|
@@ -496,7 +496,7 @@ definitions.push({ | |
|
|
||
| // Implements roving tabIndex | ||
| definitions.push({ | ||
| regexp: /Implements roving tabIndex.+/g, | ||
| regexp: /Implements roving tabIndex\./g, | ||
| testMethod: (parameters: TestMethod) => { | ||
| const propertyChecked = { checked: true } | ||
| const propertyNotChecked = { checked: false } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍