public function UiPatternsLibraryOverviewTest::testOverviewPage in UI Patterns 8
Tests overview page.
File
- modules/
ui_patterns_library/ tests/ src/ FunctionalJavascript/ UiPatternsLibraryOverviewTest.php, line 44
Class
- UiPatternsLibraryOverviewTest
- Test patterns overview page.
Namespace
Drupal\Tests\ui_patterns_library\FunctionalJavascriptCode
public function testOverviewPage() {
$session = $this
->assertSession();
$this
->drupalGet('/patterns');
$session
->elementContains('css', 'h1', 'Pattern library');
$session
->elementContains('css', 'h2', 'Available patterns');
foreach ($this
->getExpectedPatterns() as $index => $pattern) {
// Assert pattern anchor link.
$this
->assertListLink($index + 1, $pattern['label'], $pattern['name']);
// Assert pattern preview.
$this
->assertPatternPreview($pattern);
// Test view single page link.
$session
->linkExists("View {$pattern['label']} as stand-alone");
$link = $this
->getSession()
->getPage()
->findLink("View {$pattern['label']} as stand-alone");
$this
->assertStringContainsString('/patterns/' . $pattern['name'], $link
->getAttribute('href'));
}
}