Class: MatchField

e2e/fields/MatchField~MatchField(conf)

MatchField

Constructor

new MatchField(conf)

Defines a form match field.

Use Field.get method to get an instance of MatchField.

Parameters:
Name Type Description
conf Object

A field configuration object

Source:
Example
var Field = require('@openveo/test').e2e.fields.Field;

var MatchField = Field.get({
  type: 'match',
  name: 'My field',
  baseElement: element(by.css('form'))
});

Extends

Members

(readonly) availableOptions :Array

The list of available options for tags.

Type:
  • Array
Source:

(readonly) baseElement :Object

Element from where to look for the field (typically the form element).

Type:
  • Object
Inherited From:
Source:

(readonly) name :String

Field label.

Type:
  • String
Inherited From:
Source:

Methods

(private, static) addMatchValue(value) → {Promise}

Adds a new match using add button, text field and tags field.

This:
Parameters:
Name Type Description
value Object

The match value

Properties
Name Type Description
text String

The match text field value

tags String

The match tags field value

Source:
Returns:

Promise resolving when match has been added

Type
Promise

(private, static) addMatchValueUsingAutoCompletion(value) → {Promise}

Adds a new match using add button, text field and tags field with auto completion.

This:
Parameters:
Name Type Description
value Object

The match value

Properties
Name Type Description
text String

The match text field value

tags String

The match tags field value

Source:
Returns:

Promise resolving when match has been added

Type
Promise

(private, static) getMatchValue(matchFinder) → {Promise}

Gets value of a match.

This:
Parameters:
Name Type Description
matchFinder Object

Finder for the match

Source:
Returns:

Promise resolving with the value of the match

Type
Promise

(private, static) removeMatch(matchFinder) → {Promise}

Removes a match by clicking on the remove button.

This:
Parameters:
Name Type Description
matchFinder Object

Finder for the match

Source:
Returns:

Promise resolving with the value of the match

Type
Promise

clear() → {Promise}

Clears field value by removing all tags.

Overrides:
Source:
Returns:

Promise resolving when the field is cleared

Type
Promise
Example
myField.clear().then(function() {
  console.log('Field cleared');
});

getAddLabel() → {Promise}

Gets the add button label.

Source:
Returns:

Promise resolving with the button label

Type
Promise
Example
myField.getAddLabel().then(function(label) {
  console.log('Add button label: ' + label);
});

getDescription() → {Promise}

Gets field description.

Inherited From:
Source:
Returns:

Promise resolving with the description

Type
Promise
Example
myField.getDescription().then(function(description) {
  console.log('Field description is : ' + description);
});

getElement() → {Promise}

Gets field element wrapper.

Look for a form element label and return its parent.

Inherited From:
Source:
Returns:

Promise resolving with the element

Type
Promise

getErrorMessage() → {Promise}

Gets field error message.

Inherited From:
Source:
Returns:

Promise resolving with the error message

Type
Promise
Example
myField.getErrorMessage().then(function(errorMessage) {
  console.log('Error message : ' + errorMessage);
});

getInputPlaceholder() → {Promise}

Gets the input placeholder.

Source:
Returns:

Promise resolving with the input placeholder

Type
Promise
Example
myField.getInputPlaceholder().then(function(placeholder) {
  console.log('Input placeholder: ' + placeholder);
});

getLabel() → {Promise}

Gets field label.

Inherited From:
Source:
Returns:

Promise resolving with the label

Type
Promise
Example
myField.getLabel().then(function(label) {
  console.log('Field label is : ' + label);
});

getTagsPlaceholder() → {Promise}

Gets the tags placeholder.

Source:
Returns:

Promise resolving with the tags placeholder

Type
Promise
Example
myField.getTagsPlaceholder().then(function(placeholder) {
  console.log('Tags placeholder: ' + placeholder);
});

getText() → {Promise}

Gets field text representation in case of an inline editable field.

Inherited From:
Source:
Returns:

Promise resolving with field text representation

Type
Promise
Example
myField.getText().then(function(text) {
  console.log(text);
});

getValue() → {Promise}

Gets field value, the list of associations (matches).

Overrides:
Source:
Returns:

Promise resolving with the list of matches

Type
Promise
Example
myField.getValue().then(function(matches) {
  console.log(matches);
});

isOnError() → {Promise}

Tests if field is considered as on error.

Overrides:
Source:
Returns:

Promise resolving with a boolean indicating if the field is on error

Type
Promise
Example
myField.isOnError().then(function(isOnError) {
  console.log('Is field on error ? ' + isOnError);
});

setValue(valuesopt) → {Promise}

Sets field value.

Parameters:
Name Type Attributes Description
values Array <optional>

List of matches

Overrides:
Source:
Returns:

Promise resolving when the field is filled

Type
Promise
Example
myField.setValue([
  {
    text: 'text',
    tags: ['tags1', 'tags2', 'tags3']
  },
  {
    text: 'text2',
    tags: ['tags4', 'tags5', 'tags6']
  }
]).then(function() {
  console.log('Value set');
});

setValueUsingAutoCompletion(valuesopt) → {Promise}

Sets field value using auto completion.

Parameters:
Name Type Attributes Description
values Array <optional>

List of matches

Source:
Returns:

Promise resolving when the field is filled

Type
Promise
Example
myField.setValueUsingAutoCompletion([
  {
    text: 'text',
    tags: ['tags1', 'tags2', 'tags3']
  },
  {
    text: 'text2',
    tags: ['tags4', 'tags5', 'tags6']
  }
]).then(function() {
  console.log('Value set');
});