Same name and namespace in other branches
  1. 8.x-1.x tests/src/FunctionalJavascript/ColorboxInlineJavascriptTest.php \Drupal\Tests\colorbox_inline\FunctionalJavascript\ColorboxInlineJavascriptTest 1 comment

Test that Colorbox Inline functions.

@group colorbox_inline

Hierarchy

  • class \Drupal\Tests\colorbox_inline\FunctionalJavascript\ColorboxInlineJavascriptTest extends \Drupal\FunctionalJavascriptTests\WebDriverTestBase uses \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait

Expanded class hierarchy of ColorboxInlineJavascriptTest

File

tests/src/FunctionalJavascript/ColorboxInlineJavascriptTest.php, line 15

Namespace

Drupal\Tests\colorbox_inline\FunctionalJavascript
View source
class ColorboxInlineJavascriptTest extends WebDriverTestBase {
    use NodeCreationTrait;
    use ContentTypeCreationTrait;
    
    /**
     * {@inheritdoc}
     */
    protected 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 $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        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" href="#">USS Voyager</a></p>
                      <div class="test-src" style="display:none;">NCC-74656</div>',
                    'format' => 'full_html',
                ],
            ],
        ]);
    }
    
    /**
     * Test the inline colorbox launches when a link is clicked.
     */
    public function testInlineColorbox() : void {
        $page = $this->getSession()
            ->getPage();
        $this->drupalGet('node/' . $this->node
            ->id());
        $this->clickLink('USS Voyager');
        $this->getSession()
            ->wait(static::COLORBOX_WAIT_TIMEOUT);
        $this->assertSession()
            ->elementContains('css', '#colorbox', 'NCC-74656');
    }

}

Members

Title Sort descending Modifiers Object type Summary
ColorboxInlineJavascriptTest::$defaultTheme protected property
ColorboxInlineJavascriptTest::$modules protected static property
ColorboxInlineJavascriptTest::$node protected property Test Node.
ColorboxInlineJavascriptTest::COLORBOX_WAIT_TIMEOUT constant How long to wait for colorbox to launch.
ColorboxInlineJavascriptTest::setUp protected function
ColorboxInlineJavascriptTest::testInlineColorbox public function Test the inline colorbox launches when a link is clicked.