public function WebformShortcutsFunctionalTest::testShortcuts in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_shortcuts/tests/src/Functional/WebformShortcutsFunctionalTest.php \Drupal\Tests\webform_shortcuts\Functional\WebformShortcutsFunctionalTest::testShortcuts()
Test shortcuts.
File
- modules/
webform_shortcuts/ tests/ src/ Functional/ WebformShortcutsFunctionalTest.php, line 35
Class
- WebformShortcutsFunctionalTest
- Webform shortcuts test.
Namespace
Drupal\Tests\webform_shortcuts\FunctionalCode
public function testShortcuts() {
$this
->drupalLogin($this->rootUser);
// Check default shortcuts.
$this
->drupalGet('/admin/structure/webform/manage/contact');
$this
->assertRaw('<span class="webform-element-help js-webform-element-help" role="tooltip" tabindex="0" aria-label="Keyboard shortcuts" data-webform-help="<div class="webform-element-help--title">Keyboard shortcuts</div><div class="webform-element-help--content"><hr />CTRL+E = Add element<br />CTRL+P = Add page<br />CTRL+L = Add layout<br /><hr />CTRL+S = Save element or elements<br />CTRL+R = Reset elements<br /><hr />CTRL+W = Show/hide row weights<br /><hr /></div>"><span aria-hidden="true">?</span></span>');
// Customize the shortcuts.
$edit = [
'webform_shortcuts[add_element]' => 'crtl+z',
'webform_shortcuts[toggle_weights]' => '',
];
$this
->drupalPostForm('/admin/structure/webform/config/advanced', $edit, 'Save configuration');
// Check customized shortcuts.
$this
->drupalGet('/admin/structure/webform/manage/contact');
$this
->assertRaw('<span class="webform-element-help js-webform-element-help" role="tooltip" tabindex="0" aria-label="Keyboard shortcuts" data-webform-help="<div class="webform-element-help--title">Keyboard shortcuts</div><div class="webform-element-help--content"><hr />CRTL+Z = Add element<br />CTRL+P = Add page<br />CTRL+L = Add layout<br /><hr />CTRL+S = Save element or elements<br />CTRL+R = Reset elements<br /><hr /></div>"><span aria-hidden="true">?</span></span>');
}