public function InsertFileWidgetTest::testAdditionalCssClassesSetting in Insert 8
File
- tests/
src/ FunctionalJavaScript/ InsertFileWidgetTest.php, line 231
Class
- InsertFileWidgetTest
- @group insert
Namespace
Drupal\Tests\insert\FunctionalJavascriptCode
public function testAdditionalCssClassesSetting() {
$this
->drupalGet('admin/config/content/insert');
$page = $this
->getSession()
->getPage();
$page
->findField('edit-file')
->setValue('test-class-1 test-class-2');
$page
->findButton('edit-submit')
->click();
$this
->assertSession()
->waitForElement('css', 'role[contentinfo]');
$field_name = strtolower($this
->randomMachineName());
$this
->createFileField($field_name, 'article');
$files = $this
->drupalGetTestFiles('text');
$this
->drupalGet('node/add/article');
$page = $this
->getSession()
->getPage();
$page
->attachFileToField('files[' . $field_name . '_0]', \Drupal::service('file_system')
->realpath($files[0]->uri));
$this
->assertSession()
->waitForField($field_name . '[0][fids]');
$page
->findButton('Insert')
->click();
$body_value = $page
->find('css', '#edit-body-0-value')
->getValue();
$this
->assertEquals(1, preg_match('!class="test-class-1 test-class-2"!', $body_value), 'Verified configured classes: "' . $body_value . '"');
}