public function UiPatternsViewsRenderTest::testUiPatternsViewsRendering in UI Patterns 8
Test that pattern field group settings are correctly saved.
File
- modules/
ui_patterns_views/ tests/ src/ FunctionalJavascript/ UiPatternsViewsRenderTest.php, line 44
Class
- UiPatternsViewsRenderTest
- Test Views pattern rendering.
Namespace
Drupal\Tests\ui_patterns_views\FunctionalJavascriptCode
public function testUiPatternsViewsRendering() {
$assert_session = $this
->assertSession();
$this
->enableTwigDebugMode();
$user = $this
->drupalCreateUser([], NULL, TRUE);
$this
->drupalLogin($user);
$this
->drupalCreateNode([
'title' => 'Test article',
'type' => 'article',
]);
$this
->drupalGet('/articles');
// Assert correct variant suggestions.
$suggestions = [
'pattern-teaser--variant-default--views-row--articles--page-1.html.twig',
'pattern-teaser--variant-default--views-row--articles.html.twig',
'pattern-teaser--variant-default--views-row.html.twig',
'pattern-teaser--views-row--articles--page-1.html.twig',
'pattern-teaser--views-row--articles.html.twig',
'pattern-teaser--views-row.html.twig',
'pattern-teaser--variant-default.html.twig',
'pattern-teaser.html.twig',
];
foreach ($suggestions as $suggestion) {
$assert_session
->responseContains($suggestion);
}
// Test field content is rendered in field group pattern.
$assert_session
->elementContains('css', 'h3', 'Test article');
}