You are here

public function StyleguidePageTest::testStyleGuidePageFunctional in Simple Style Guide 8

Tests that the style guide page loads with some config.

File

src/Tests/StyleguidePageTest.php, line 65

Class

StyleguidePageTest
Simple test to ensure that main page loads with module enabled.

Namespace

Drupal\simple_styleguide\Tests

Code

public function testStyleGuidePageFunctional() {
  $simple_style_guide_config = [
    'default_patterns[headings]' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/config/styleguide/settings', $simple_style_guide_config, t('Save'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->checkboxChecked('default_patterns[headings]');
  $this
    ->drupalGet(Url::fromRoute('simple_styleguide.controller'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $styleguide_section_headings = $this
    ->xpath($this
    ->cssSelectToXpath('.simple-styleguide--site-styles .sections > h3'));
  $this
    ->assertEquals('headings', $styleguide_section_headings[0]
    ->getText());
}