You are here

protected function WebformBrowserTestTrait::getWebformSubmitButtonLabel in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Traits/WebformBrowserTestTrait.php \Drupal\Tests\webform\Traits\WebformBrowserTestTrait::getWebformSubmitButtonLabel()

Get a webform's submit button label.

Parameters

\Drupal\webform\WebformInterface $webform: A webform.

string $submit: Value of the submit button whose click is to be emulated.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup|string The webform's submit button label.

3 calls to WebformBrowserTestTrait::getWebformSubmitButtonLabel()
WebformBrowserTestTrait::postSubmission in tests/src/Traits/WebformBrowserTestTrait.php
Post a new submission to a webform.
WebformBrowserTestTrait::postSubmissionTest in tests/src/Traits/WebformBrowserTestTrait.php
Post a new test submission to a webform.
WebformSubmissionListBuilderJavaScriptTest::testToggleLinks in tests/src/FunctionalJavascript/WebformSubmissionListBuilderJavaScriptTest.php
Test toggle links.

File

tests/src/Traits/WebformBrowserTestTrait.php, line 333

Class

WebformBrowserTestTrait
Provides convenience methods for webform assertions in browser tests.

Namespace

Drupal\Tests\webform\Traits

Code

protected function getWebformSubmitButtonLabel(WebformInterface $webform, $submit = NULL) {
  if ($submit) {
    return $submit;
  }
  $actions_element = $webform
    ->getElement('actions');
  if ($actions_element && isset($actions_element['#submit__label'])) {
    return $actions_element['#submit__label'];
  }
  return t('Submit');
}