diff --git a/test/specs/behaviors/testDefinitions.ts b/test/specs/behaviors/testDefinitions.ts index 690a83385f..2d6bb50827 100644 --- a/test/specs/behaviors/testDefinitions.ts +++ b/test/specs/behaviors/testDefinitions.ts @@ -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, 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 }