Commit ca97b9ea authored by NickWilde's avatar NickWilde

Issue #2999964 by NickWilde: Create Tests

parent 6884286f
build:
assessment:
validate_codebase:
phplint: { }
container_composer: { }
container_command:
commands:
- cd ${SOURCE_DIR}
- sudo -u www-data composer config repositories.asset {"composer","https://asset-packagist.org"}
- sudo -u www-data composer config extra.installer-types.0 "npm-asset"
- sudo -u www-data composer config extra.installer-types.1 "bower-asset"
- sudo -u www-data composer config extra.installer-paths.libraries\/\{\$name\} "[type:bower-asset]"
- sudo -u www-data sed -i 's/"\[type:bower-asset\]"/\["type:bower-asset"\]/' composer.json
- sudo -u www-data composer require "oomphinc/composer-installers-extender:^1.1"
- sudo -u www-data composer require "bower-asset/colorbox"
- dir libraries
csslint:
halt-on-fail: false
eslint:
halt-on-fail: false
phpcs:
sniff-all-files: false
halt-on-fail: false
coder-version: ^8.2@stable
testing:
run_tests.standard:
types: 'Simpletest,PHPUnit-Unit,PHPUnit-Kernel,PHPUnit-Functional'
testgroups: '--all'
color: true
die-on-fail: false
keep-results: true
keep-results-table: false
verbose: false
concurrency: 0
halt-on-fail: false
repeat: 1
suppress-deprecations: true
run_tests.js:
concurrency: 1
types: PHPUnit-FunctionalJavascript
testgroups: '--all'
color: true
die-on-fail: false
keep-results: true
keep-results-table: false
verbose: false
halt-on-fail: false
repeat: 1
suppress-deprecations: true
nightwatchjs: { }
<?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;
/**
* Test that Colorbox Inline functions.
*
* @group colorbox_inline
*/
class ColorboxInlineJavascriptTest extends WebDriverTestBase {
use NodeCreationTrait;
use ContentTypeCreationTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
'colorbox_inline',
'node',
'text',
];
/**
* How long to wait for colorbox to launch.
*/
const COLORBOX_WAIT_TIMEOUT = 500;
/**
* Test Node.
*
* @var \Drupal\node\NodeInterface
*/
protected $node;
/**
* {@inheritdoc}
*/
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',
],
],
]);
}
/**
* Test the inline colorbox launches when a link is clicked.
*/
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');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment