/**
* Tests that nothing is output when the attachment displays are disabled.
*/
public function testDisabledAttachments() { $this->
drupalCreateContentType(['type' => 'page'
]);
$this->
drupalCreateNode();
// Ensure that the feed_1 display is attached to the page_1 display.
$view = Views::
getView('test_attached_disabled'
);
$view->
setDisplay('page_1'
);
$attached_displays =
$view->display_handler->
getAttachedDisplays();
$this->
assertContains('attachment_1',
$attached_displays, 'The attachment_1 display is attached to the page display.'
);
$this->
assertContains('attachment_2',
$attached_displays, 'The attachment_2 display is attached to the page display.'
);
// Check that the attachments are output on the page display.
$this->
drupalGet('test-attached-disabled'
);
// Verify that the page view and the attachments are rendered.
$this->
assertSession()->
elementsCount('xpath', '//div[contains(@class, "view-content")]', 3
);
// Verify that the attachment is rendered before the page view.
$this->
assertSession()->
elementsCount('xpath', '//div[contains(@class, "attachment-before")]', 1
);
// Verify that the attachment is rendered after the page view.
$this->
assertSession()->
elementsCount('xpath', '//div[contains(@class, "attachment-after")]', 1
);