LayoutFluidTest.php in Display Suite 8.4
File
tests/src/Functional/LayoutFluidTest.php
View source
<?php
namespace Drupal\Tests\ds\Functional;
class LayoutFluidTest extends TestBase {
public function testFluidLayout() {
$this
->drupalGet('admin/structure/types/manage/article/display');
$this
->assertSession()
->responseContains('Test Fluid two column');
$layout = [
'ds_layout' => 'dstest_2col_fluid',
];
$assert = [
'regions' => [
'left' => '<td colspan="8">' . t('Left') . '</td>',
'right' => '<td colspan="8">' . t('Right') . '</td>',
],
];
$fields = [
'fields[node_author][region]' => 'left',
'fields[node_links][region]' => 'left',
'fields[body][region]' => 'left',
];
$this
->dsSelectLayout($layout, $assert);
$this
->dsConfigureUi($fields);
$settings = [
'type' => 'article',
];
$node = $this
->drupalCreateNode($settings);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->responseContains('group-left');
$this
->assertSession()
->responseNotContains('group-right');
$this
->assertSession()
->responseContains('group-one-column');
$this
->assertSession()
->responseContains('dstest-2col-fluid.css');
$fields = [
'fields[node_author][region]' => 'left',
'fields[node_links][region]' => 'left',
'fields[body][region]' => 'right',
];
$this
->dsSelectLayout($layout, $assert);
$this
->dsConfigureUi($fields);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->responseContains('group-left');
$this
->assertSession()
->responseContains('group-right');
$this
->assertSession()
->responseNotContains('group-one-column');
$fields = [
'fields[node_author][region]' => 'right',
'fields[node_links][region]' => 'right',
'fields[heavy_field][region]' => 'right',
'fields[body][region]' => 'right',
];
$this
->dsSelectLayout($layout, $assert);
$this
->dsConfigureUi($fields);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->responseNotContains('group-left');
$this
->assertSession()
->responseContains('group-right');
$this
->assertSession()
->responseContains('group-one-column');
$fields = [
'disable_css' => TRUE,
];
$this
->dsSelectLayout($layout, $assert);
$this
->dsConfigureUi($fields);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->responseNotContains('dstest-2col-fluid.css');
}
}