function TourLegacyTest::testTourTipMarkup

Confirms backwards compatible markup.

@dataProvider providerTestTourTipMarkup

Parameters

string $path: The path to check.

string $theme: The theme used by the tests.

File

core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php, line 52

Class

TourLegacyTest
Tests Tour's backwards compatible markup and legacy config.

Namespace

Drupal\Tests\tour\FunctionalJavascript

Code

public function testTourTipMarkup(string $path, string $theme = NULL) {
    // Install the specified theme and make it default if that is not already
    // the case.
    if ($theme) {
        $theme_manager = $this->container
            ->get('theme.manager');
        $this->container
            ->get('theme_installer')
            ->install([
            $theme,
        ], TRUE);
        $system_theme_config = $this->container
            ->get('config.factory')
            ->getEditable('system.theme');
        $system_theme_config->set('default', $theme)
            ->save();
        $this->rebuildAll();
        $this->assertSame($theme, $theme_manager->getActiveTheme()
            ->getName());
    }
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    $this->drupalGet($path);
    $assert_session->waitForElementVisible('css', '#toolbar-tab-tour button');
    $page->find('css', '#toolbar-tab-tour button')
        ->press();
    $this->assertToolTipMarkup(0, 'top');
    $page->find('css', '.joyride-tip-guide[data-index="0"]')
        ->clickLink('Next');
    $this->assertToolTipMarkup(1, '', 'image');
    $page->find('css', '.joyride-tip-guide[data-index="1"]')
        ->clickLink('Next');
    $this->assertToolTipMarkup(2, 'top', 'body');
    $tip_content = $assert_session->waitForElementVisible('css', '.joyride-tip-guide[data-index="2"] .joyride-content-wrapper');
    $additional_paragraph = $tip_content->find('css', '.tour-tip-body + p');
    $this->assertNotNull($additional_paragraph, 'Tip 3 has an additional paragraph that is a sibling to the main paragraph.');
    $additional_list = $tip_content->find('css', '.tour-tip-body + p + ul');
    $this->assertNotNull($additional_list, 'Tip 3 has an additional unordered list that is a sibling to the main paragraph.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.