You are here

protected function WebformCivicrmTestBase::assertOptionSelected in Webform CiviCRM Integration 8.5

Asserts that a select option in the current page is checked.

Parameters

string $id: ID of select field to assert.

string $option: Option to assert.

string $message: (optional) A message to display with the assertion. Do not translate messages with t(). If left blank, a default message will be displayed.

Overrides AssertLegacyTrait::assertOptionSelected

1 call to WebformCivicrmTestBase::assertOptionSelected()
SaveSettingsTest::testDeleteField in tests/src/FunctionalJavascript/SaveSettingsTest.php
Delete fields on the webform.

File

tests/src/FunctionalJavascript/WebformCivicrmTestBase.php, line 407

Class

WebformCivicrmTestBase

Namespace

Drupal\Tests\webform_civicrm\FunctionalJavascript

Code

protected function assertOptionSelected($id, $option, $message = NULL) {
  $option_field = $this
    ->assertSession()
    ->optionExists($id, $option);
  $message = $message ?: "Option {$option} for field {$id} is selected.";
  $this
    ->assertTrue($option_field
    ->hasAttribute('selected'), $message);
}