WebformElementCheckboxesJavaScriptTest.php in Webform 8.5
File
tests/src/FunctionalJavascript/Element/WebformElementCheckboxesJavaScriptTest.php
View source
<?php
namespace Drupal\Tests\webform\FunctionalJavascript\Element;
use Drupal\Tests\webform\FunctionalJavascript\WebformWebDriverTestBase;
class WebformElementCheckboxesJavaScriptTest extends WebformWebDriverTestBase {
protected static $testWebforms = [
'test_element_checkboxes_all_none',
];
public function testCheckboxesAllNone() {
$session = $this
->getSession();
$assert_session = $this
->assertSession();
$this
->drupalGet('/webform/test_element_checkboxes_all_none');
$assert_session
->checkboxNotChecked('edit-checkboxes-all-all');
$this
->click('#edit-checkboxes-all-one');
$this
->click('#edit-checkboxes-all-two');
$this
->click('#edit-checkboxes-all-three');
$assert_session
->checkboxChecked('edit-checkboxes-all-all');
$this
->click('#edit-checkboxes-all-three');
$assert_session
->checkboxNotChecked('edit-checkboxes-all-all');
$assert_session
->checkboxNotChecked('edit-checkboxes-all-three');
$this
->click('#edit-checkboxes-all-all');
$assert_session
->checkboxChecked('edit-checkboxes-all-three');
$this
->click('#edit-checkboxes-none-none');
$assert_session
->checkboxNotChecked('edit-checkboxes-none-one');
$assert_session
->checkboxNotChecked('edit-checkboxes-none-two');
$assert_session
->checkboxNotChecked('edit-checkboxes-none-three');
$this
->click('#edit-checkboxes-both-none');
$assert_session
->checkboxNotChecked('edit-checkboxes-both-one');
$assert_session
->checkboxNotChecked('edit-checkboxes-both-two');
$assert_session
->checkboxNotChecked('edit-checkboxes-both-three');
$assert_session
->checkboxNotChecked('edit-checkboxes-both-all');
$this
->click('#edit-checkboxes-both-none');
$this
->click('#edit-checkboxes-both-all');
$assert_session
->checkboxChecked('edit-checkboxes-both-one');
$assert_session
->checkboxChecked('edit-checkboxes-both-two');
$assert_session
->checkboxChecked('edit-checkboxes-both-three');
$assert_session
->checkboxChecked('edit-checkboxes-both-all');
$options = [
'query' => [
'checkboxes_all' => [
'one',
'two',
'three',
],
],
];
$this
->drupalGet('/webform/test_element_checkboxes_all_none', $options);
$assert_session
->checkboxChecked('edit-checkboxes-all-all');
}
}