class FieldTest
Same name in this branch
- 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldTest
- 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldTest
- 9 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest
- 9 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest
- 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldTest.php \Drupal\views_test_data\Plugin\views\field\FieldTest
Same name and namespace in other branches
- 11.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldTest
- 11.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldTest
- 11.x core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest
- 11.x core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest
- 11.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldTest.php \Drupal\views_test_data\Plugin\views\field\FieldTest
Tests quickedit.
@group quickedit @group legacy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase implements \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\quickedit\FunctionalJavascript\FieldTest uses \Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait implements \Drupal\FunctionalJavascriptTests\WebDriverTestBase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of FieldTest
File
-
core/
modules/ quickedit/ tests/ src/ FunctionalJavascript/ FieldTest.php, line 18
Namespace
Drupal\Tests\quickedit\FunctionalJavascriptView source
class FieldTest extends WebDriverTestBase {
use ContextualLinkClickTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'ckeditor',
'contextual',
'quickedit',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Create a text format and associate CKEditor.
$filtered_html_format = FilterFormat::create([
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
]);
$filtered_html_format->save();
Editor::create([
'format' => 'filtered_html',
'editor' => 'ckeditor',
])->save();
// Create note type with body field.
$node_type = NodeType::create([
'type' => 'page',
'name' => 'Page',
]);
$node_type->save();
node_add_body_field($node_type);
$account = $this->drupalCreateUser([
'access content',
'administer nodes',
'edit any page content',
'use text format filtered_html',
'access contextual links',
'access in-place editing',
]);
$this->drupalLogin($account);
}
/**
* Tests that quickeditor works correctly for field with CKEditor.
*/
public function testFieldWithCkeditor() {
$body_value = '<p>Dare to be wise</p>';
$node = Node::create([
'type' => 'page',
'title' => 'Page node',
'body' => [
[
'value' => $body_value,
'format' => 'filtered_html',
],
],
]);
$node->save();
$page = $this->getSession()
->getPage();
$assert = $this->assertSession();
$this->drupalGet('node/' . $node->id());
// Wait "Quick edit" button for node.
$this->assertSession()
->waitForElement('css', '[data-quickedit-entity-id="node/' . $node->id() . '"] .contextual .quickedit');
// Click by "Quick edit".
$this->clickContextualLink('[data-quickedit-entity-id="node/' . $node->id() . '"]', 'Quick edit');
// Switch to body field.
$page->find('css', '[data-quickedit-field-id="node/' . $node->id() . '/body/en/full"]')
->click();
// Wait and click by "Blockquote" button from editor for body field.
$this->assertSession()
->waitForElementVisible('css', '.cke_button.cke_button__blockquote')
->click();
// Wait and click by "Save" button after body field was changed.
$this->assertSession()
->waitForElementVisible('css', '.quickedit-toolgroup.ops [type="submit"][aria-hidden="false"]')
->click();
// Wait until the save occurs and the editor UI disappears.
$this->assertSession()
->assertNoElementAfterWait('css', '.cke_button.cke_button__blockquote');
// Ensure that the changes take effect.
$assert->responseMatches("|<blockquote>\\s*{$body_value}\\s*</blockquote>|");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.