function QuickEditJavascriptTestBase::awaitEntityInstanceFieldState

Same name in other branches
  1. 8.9.x core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase::awaitEntityInstanceFieldState()

Awaits a particular field instance to reach a particular state.

Parameters

string $entity_type_id: The entity type ID.

int $entity_id: The entity ID.

int $entity_instance_id: The entity instance ID. (Instance on the page.)

string $field_name: The field name.

string $langcode: The language code.

string $awaited_state: One of the possible field states.

1 call to QuickEditJavascriptTestBase::awaitEntityInstanceFieldState()
LayoutBuilderIntegrationTest::testArticleNode in core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderIntegrationTest.php
Tests if an article node can be in-place edited with Quick Edit.

File

core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php, line 149

Class

QuickEditJavascriptTestBase
Base class for testing the QuickEdit.

Namespace

Drupal\Tests\quickedit\FunctionalJavascript

Code

protected function awaitEntityInstanceFieldState($entity_type_id, $entity_id, $entity_instance_id, $field_name, $langcode, $awaited_state) {
    $entity_page_id = $entity_type_id . '/' . $entity_id . '[' . $entity_instance_id . ']';
    $logical_field_id = $entity_type_id . '/' . $entity_id . '/' . $field_name . '/' . $langcode;
    $this->assertJsCondition("Drupal.quickedit.collections.entities.get('{$entity_page_id}').get('fields').findWhere({logicalFieldID: '{$logical_field_id}'}).get('state') === '{$awaited_state}'");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.