public function ParagraphsIdTestCase::testParagraphsIdItemClass in Paragraphs ID 7
Test paragraphs item id class.
File
- tests/
paragraphs_id.test, line 31 - Paragraphs pack primary module's tests.
Class
- ParagraphsIdTestCase
- Class ParagraphsIdTestCase
Code
public function testParagraphsIdItemClass() {
$this
->createNewTestNode();
$this
->openCreatedNodePage();
// Check existence of corresponding paragraphs item id class.
$id_class = 'paragraphs-item-1';
$paragraph_class = 'paragraphs-item-pp-test-paragraph-bundle';
// Look for a divs with the both classes: id class and paragraph class.
// We search for "SPACE + class + SPACE" to avoid matching a substring
// of the class.
$elements = $this
->xpath('//div[contains(concat(" ", normalize-space(@class), " "), :id_class) and contains(concat(" ", normalize-space(@class), " "), :paragraph_class)]', array(
':id_class' => ' ' . $id_class . ' ',
':paragraph_class' => ' ' . $paragraph_class . ' ',
));
$this
->assertTrue(!empty($elements), t('Corresponding paragraphs item id class exists.'));
}