public function WebformSubmissionListBuilderJavaScriptTest::testToggleLinks in Webform 8.5
Same name and namespace in other branches
- 6.x tests/src/FunctionalJavascript/WebformSubmissionListBuilderJavaScriptTest.php \Drupal\Tests\webform\FunctionalJavascript\WebformSubmissionListBuilderJavaScriptTest::testToggleLinks()
Test toggle links.
File
- tests/
src/ FunctionalJavascript/ WebformSubmissionListBuilderJavaScriptTest.php, line 20
Class
- WebformSubmissionListBuilderJavaScriptTest
- Tests webform action javascript.
Namespace
Drupal\Tests\webform\FunctionalJavascriptCode
public function testToggleLinks() {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = Webform::create([
'langcode' => 'en',
'status' => WebformInterface::STATUS_OPEN,
'id' => 'test_javascript',
'title' => 'test_javascript',
'elements' => Yaml::encode([
'textfield' => [
'#type' => 'textfield',
'#title' => 'textfield',
],
]),
]);
$webform
->save();
$assert_session = $this
->assertSession();
/**************************************************************************/
$submit = $this
->getWebformSubmitButtonLabel($webform);
$this
->drupalPostForm('/webform/' . $webform
->id(), [], $submit);
$sid = $this
->getLastSubmissionId($webform);
$this
->drupalLogin($this
->createUser([
'view any webform submission',
'edit any webform submission',
'delete any webform submission',
]));
$this
->drupalGet('/admin/structure/webform/manage/' . $webform
->id() . '/results/submissions');
$assert_session
->elementExists('css', "#webform-submission-{$sid}-sticky")
->click();
$assert_session
->assertWaitOnAjaxRequest();
$assert_session
->elementExists('css', "#webform-submission-{$sid}-locked")
->click();
$assert_session
->assertWaitOnAjaxRequest();
// Reload the webform submission.
\Drupal::entityTypeManager()
->getStorage('webform_submission')
->resetCache();
$webform_submission = WebformSubmission::load($sid);
$this
->assertTrue($webform_submission
->isSticky());
$this
->assertTrue($webform_submission
->isLocked());
}