ColorboxInlineJavascriptTest.php in Colorbox Inline 8
File
tests/src/FunctionalJavascript/ColorboxInlineJavascriptTest.php
View source
<?php
namespace Drupal\Tests\colorbox_inline\FunctionalJavascript;
use Drupal\filter\Entity\FilterFormat;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
class ColorboxInlineJavascriptTest extends WebDriverTestBase {
use NodeCreationTrait;
use ContentTypeCreationTrait;
public static $modules = [
'colorbox_inline',
'node',
'text',
];
const COLORBOX_WAIT_TIMEOUT = 500;
protected $node;
protected function setUp() {
parent::setUp();
$this
->createContentType([
'type' => 'page',
]);
FilterFormat::create([
'format' => 'full_html',
'name' => 'Full HTML',
])
->save();
$this->node = $this
->createNode([
'body' => [
[
'value' => '<p><a data-colorbox-inline=".test-src">USS Voyager</a></p>
<div class="test-src">NCC-74656</div>',
'format' => 'full_html',
],
],
]);
}
public function testInlineColorbox() {
$this
->drupalGet('node/' . $this->node
->id());
$this
->getSession()
->getPage()
->clickLink('USS Voyager');
$this
->getSession()
->wait(static::COLORBOX_WAIT_TIMEOUT);
$this
->assertSession()
->elementContains('css', '#colorbox', 'NCC-74656');
}
}