public function SlideTypeTest::testSlideSlideType in Collapsiblock 3.x
Same name and namespace in other branches
- 4.x tests/src/FunctionalJavascript/SlideTypeTest.php \Drupal\Tests\collapsiblock\FunctionalJavascript\SlideTypeTest::testSlideSlideType()
Test that the "Slide" slide type does set aria-hidden attributes.
File
- tests/
src/ FunctionalJavascript/ SlideTypeTest.php, line 98
Class
- SlideTypeTest
- Test the "Remember collapsed state on active pages" behavior.
Namespace
Drupal\Tests\collapsiblock\FunctionalJavascriptCode
public function testSlideSlideType() {
// Set the Default animation type to "Slide"; then flush all caches so the
// global configuration setting change will take effect.
$this
->setCollapsiblockGlobalSetting(1, 'slide_type');
drupal_flush_all_caches();
// Load a page that the block will be displayed on.
$this
->drupalLogin($this
->getCollapsiblockUnprivilegedUser());
$this
->drupalGet('<front>');
// Check that, initially, the aria-hidden wrapper on the content wrapper
// does not exist.
$beforeContent = $this
->getSession()
->getPage()
->find('xpath', $this->collapsiblockTestBlockContentXpath);
$this
->assertNotNull($beforeContent);
$this
->assertFalse($beforeContent
->hasAttribute('aria-hidden'));
// Click on the block title to collapse the block.
$this
->getSession()
->getPage()
->find('xpath', $this->collapsiblockTestBlockTitleXpath)
->click();
// Check that, after toggling visibility, the aria-hidden wrapper on the
// content wrapper exists, and is true (i.e.: collapsed).
$afterCollapseContent = $this
->getSession()
->getPage()
->find('xpath', $this->collapsiblockTestBlockContentXpath);
$this
->assertNotNull($afterCollapseContent);
$this
->assertTrue($afterCollapseContent
->hasAttribute('aria-hidden'));
$this
->assertEqual($afterCollapseContent
->getAttribute('aria-hidden'), 'true');
// Click on the block title to expand the block.
$this
->getSession()
->getPage()
->find('xpath', $this->collapsiblockTestBlockTitleXpath)
->click();
// Check that, after showing the block content, the aria-hidden wrapper on
// the content wrapper exists, and is false (i.e.: expanded).
$afterReExpandContent = $this
->getSession()
->getPage()
->find('xpath', $this->collapsiblockTestBlockContentXpath);
$this
->assertNotNull($afterReExpandContent);
$this
->assertEqual($afterReExpandContent
->getAttribute('aria-hidden'), 'false');
}