const TOOLBAR_EDIT_LINK_SELECTOR = '#toolbar-bar div.contextual-toolbar-tab button';
+ const LABEL_INPUT_SELECTOR = 'input[data-drupal-selector="edit-settings-label"]';
+
/**
* {@inheritdoc}
*/
$this->waitForNoElement("#toolbar-administration a.is-active");
}
$page->find('css', $toolbar_item)->click();
- $web_assert->waitForElementVisible('css', "{$toolbar_item}.is-active");
+ $this->assertElementVisibleAfterWait('css', "{$toolbar_item}.is-active");
}
$this->enableEditMode();
if (isset($toolbar_item)) {
$this->openBlockForm($block_selector);
switch ($block_plugin) {
case 'system_powered_by_block':
+ // Confirm "Display Title" is not checked.
+ $web_assert->checkboxNotChecked('settings[label_display]');
+ // Confirm Title is not visible.
+ $this->assertEquals($this->isLabelInputVisible(), FALSE, 'Label is not visible');
+ $page->checkField('settings[label_display]');
+ $this->assertEquals($this->isLabelInputVisible(), TRUE, 'Label is visible');
// Fill out form, save the form.
$page->fillField('settings[label]', $new_page_text);
- $page->checkField('settings[label_display]');
+
break;
case 'system_branding_block':
*/
protected function assertOffCanvasBlockFormIsValid() {
$web_assert = $this->assertSession();
+ // Confirm that Block title display label has been changed.
+ $web_assert->elementTextContains('css', '.form-item-settings-label-display label', 'Display block title');
+ // Confirm Block title label is shown if checkbox is checked.
+ if ($this->getSession()->getPage()->find('css', 'input[name="settings[label_display]"]')->isChecked()) {
+ $this->assertEquals($this->isLabelInputVisible(), TRUE, 'Label is visible');
+ $web_assert->elementTextContains('css', '.form-item-settings-label label', 'Block title');
+ }
+ else {
+ $this->assertEquals($this->isLabelInputVisible(), FALSE, 'Label is not visible');
+ }
+
// Check that common block form elements exist.
- $web_assert->elementExists('css', 'input[data-drupal-selector="edit-settings-label"]');
+ $web_assert->elementExists('css', static::LABEL_INPUT_SELECTOR);
$web_assert->elementExists('css', 'input[data-drupal-selector="edit-settings-label-display"]');
// Check that advanced block form elements do not exist.
$web_assert->elementNotExists('css', 'input[data-drupal-selector="edit-visibility-request-path-pages"]');
$this->drupalGet('node/' . $node->id());
// Waiting for Toolbar module.
// @todo Remove the hack after https://www.drupal.org/node/2542050.
- $web_assert->waitForElementVisible('css', '.toolbar-fixed');
+ $this->assertElementVisibleAfterWait('css', '.toolbar-fixed');
// Waiting for Toolbar animation.
$web_assert->assertWaitOnAjaxRequest();
// The 2nd page load we should already be in edit mode.
}
// In Edit mode clicking field should open QuickEdit toolbar.
$page->find('css', $body_selector)->click();
- $web_assert->waitForElementVisible('css', $quick_edit_selector);
+ $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
$this->disableEditMode();
// Exiting Edit mode should close QuickEdit toolbar.
$this->enableEditMode();
$this->openBlockForm($block_selector);
$page->find('css', $body_selector)->click();
- $web_assert->waitForElementVisible('css', $quick_edit_selector);
+ $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
// Off-canvas dialog should be closed when opening QuickEdit toolbar.
$this->waitForOffCanvasToClose();
$this->disableEditMode();
// Open QuickEdit toolbar before going into Edit mode.
$this->clickContextualLink($node_selector, "Quick edit");
- $web_assert->waitForElementVisible('css', $quick_edit_selector);
+ $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
// Open off-canvas and enter Edit mode via contextual link.
$this->clickContextualLink($block_selector, "Quick edit");
$this->waitForOffCanvasToOpen();
// Open QuickEdit toolbar via contextual link while in Edit mode.
$this->clickContextualLink($node_selector, "Quick edit", FALSE);
$this->waitForOffCanvasToClose();
- $web_assert->waitForElementVisible('css', $quick_edit_selector);
+ $this->assertElementVisibleAfterWait('css', $quick_edit_selector);
$this->disableEditMode();
}
}
return '#block-' . $block->id();
}
+ /**
+ * Determines if the label input is visible.
+ *
+ * @return bool
+ * TRUE if the label is visible, FALSE if it is not.
+ */
+ protected function isLabelInputVisible() {
+ return $this->getSession()->getPage()->find('css', static::LABEL_INPUT_SELECTOR)->isVisible();
+ }
+
}