class sap.ui.test.matchers.LabelFor

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/test/matchers/LabelFor
Application Component: CA-UI5-TA

The LabelFor matcher checks if a given control has a label associated with it. For every Label on the page, the matcher checks if:

Labels can be matched by: Some control types cannot be in a labelFor association:

As of version 1.72, it is available as a declarative matcher with the following syntax:

{
    labelFor: {
        text: "string",
        modelName: "string",
        key: "string",
        parameters: "any",
        propertyName: "string"
    }
}


Constructor

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.test.matchers.LabelFor(mSettings?)
Param Type Default Value Description
mSettings? object

optional map/JSON-object with initial settings for the new LabelFor


Properties

Name Type Default Value Description
key string

The key of the I18N text in the containing module:sap/base/i18n/ResourceBundle.

Visibility: public
modelName string i18n

The name of the sap.ui.model.resource.ResourceModel assigned to the control.

Visibility: public
parameters any

The parameters for replacing the placeholders of the I18N text. See module:sap/base/i18n/ResourceBundle#getText.

Visibility: public
propertyName string text

The name of the control property to match the I18N text with.

Visibility: public
text string

The text of the sap.m.Label which have the labelFor property.

Visibility: public

Methods Overview

Method Description
sap.ui.test.matchers.LabelFor.extend

Creates a new subclass of class sap.ui.test.matchers.LabelFor with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.test.matchers.Matcher.extend.

getKey

Gets current value of property key.

The key of the I18N text in the containing module:sap/base/i18n/ResourceBundle.

sap.ui.test.matchers.LabelFor.getMetadata

Returns a metadata object for class sap.ui.test.matchers.LabelFor.

getModelName

Gets current value of property modelName.

The name of the sap.ui.model.resource.ResourceModel assigned to the control.

Default value is "i18n".

getParameters

Gets current value of property parameters.

The parameters for replacing the placeholders of the I18N text. See module:sap/base/i18n/ResourceBundle#getText.

getPropertyName

Gets current value of property propertyName.

The name of the control property to match the I18N text with.

Default value is "text".

getText

Gets current value of property text.

The text of the sap.m.Label which have the labelFor property.

isMatching

Checks for control with labelFor property annotating other control

setKey

Sets a new value for property key.

The key of the I18N text in the containing module:sap/base/i18n/ResourceBundle.

When called with a value of null or undefined, the default value of the property will be restored.

setModelName

Sets a new value for property modelName.

The name of the sap.ui.model.resource.ResourceModel assigned to the control.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "i18n".

setParameters

Sets a new value for property parameters.

The parameters for replacing the placeholders of the I18N text. See module:sap/base/i18n/ResourceBundle#getText.

When called with a value of null or undefined, the default value of the property will be restored.

setPropertyName

Sets a new value for property propertyName.

The name of the control property to match the I18N text with.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "text".

setText

Sets a new value for property text.

The text of the sap.m.Label which have the labelFor property.

When called with a value of null or undefined, the default value of the property will be restored.

sap.ui.test.matchers.LabelFor.extend

Creates a new subclass of class sap.ui.test.matchers.LabelFor with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.test.matchers.Matcher.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getKey

Gets current value of property key.

The key of the I18N text in the containing module:sap/base/i18n/ResourceBundle.

sap.ui.test.matchers.LabelFor.getMetadata

Returns a metadata object for class sap.ui.test.matchers.LabelFor.

getModelName

Gets current value of property modelName.

The name of the sap.ui.model.resource.ResourceModel assigned to the control.

Default value is "i18n".

getParameters

Gets current value of property parameters.

The parameters for replacing the placeholders of the I18N text. See module:sap/base/i18n/ResourceBundle#getText.

getPropertyName

Gets current value of property propertyName.

The name of the control property to match the I18N text with.

Default value is "text".

getText

Gets current value of property text.

The text of the sap.m.Label which have the labelFor property.

isMatching

Checks for control with labelFor property annotating other control

Param Type DefaultValue Description
oControl sap.ui.core.Control

the control that is checked by the matcher

setKey

Sets a new value for property key.

The key of the I18N text in the containing module:sap/base/i18n/ResourceBundle.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sKey string

New value for property key

setModelName

Sets a new value for property modelName.

The name of the sap.ui.model.resource.ResourceModel assigned to the control.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "i18n".

Param Type DefaultValue Description
sModelName string "i18n"

New value for property modelName

setParameters

Sets a new value for property parameters.

The parameters for replacing the placeholders of the I18N text. See module:sap/base/i18n/ResourceBundle#getText.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
oParameters any

New value for property parameters

setPropertyName

Sets a new value for property propertyName.

The name of the control property to match the I18N text with.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "text".

Param Type DefaultValue Description
sPropertyName string "text"

New value for property propertyName

setText

Sets a new value for property text.

The text of the sap.m.Label which have the labelFor property.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sText string

New value for property text