function QuickEditJavascriptTestBase::assertEntityInstanceStates
Same name in other branches
- 9 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase::assertEntityInstanceStates()
Asserts all EntityModels (entity instances) on the page.
Parameters
array $expected_entity_states: Must describe the expected state of all in-place editable entity instances on the page.
See also
Drupal.quickedit.EntityModel
4 calls to QuickEditJavascriptTestBase::assertEntityInstanceStates()
- LayoutBuilderQuickEditTest::assertQuickEditInit in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderQuickEditTest.php - Asserts that Quick Edit is initialized on the node view correctly.
- QuickEditImageTest::testImageInPlaceEditor in core/
modules/ image/ tests/ src/ FunctionalJavascript/ QuickEditImageTest.php - Tests that quick editor works correctly with images.
- QuickEditIntegrationTest::testArticleNode in core/
modules/ quickedit/ tests/ src/ FunctionalJavascript/ QuickEditIntegrationTest.php - Tests if an article node can be in-place edited with Quick Edit.
- QuickEditIntegrationTest::testCustomBlock in core/
modules/ quickedit/ tests/ src/ FunctionalJavascript/ QuickEditIntegrationTest.php - Tests if a custom can be in-place edited with Quick Edit.
File
-
core/
modules/ quickedit/ tests/ src/ FunctionalJavascript/ QuickEditJavascriptTestBase.php, line 192
Class
- QuickEditJavascriptTestBase
- Base class for testing the QuickEdit.
Namespace
Drupal\Tests\quickedit\FunctionalJavascriptCode
protected function assertEntityInstanceStates(array $expected_entity_states) {
$js_get_all_field_states_for_entity = <<<JS
function () {
Drupal.quickedit.collections.entities.reduce(function (result, fieldModel) { result[fieldModel.get('id')] = fieldModel.get('state'); return result; }, {})
var entityCollection = Drupal.quickedit.collections.entities;
return entityCollection.reduce(function (result, entityModel) {
result[entityModel.id] = entityModel.get('state');
return result;
}, {});
}()
JS;
$this->assertSame($expected_entity_states, $this->getSession()
->evaluateScript($js_get_all_field_states_for_entity));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.