You are here

private function LinkitDialogTest::assertEqualsWithJs in Linkit 8.5

Asserts that two variables are equal.

Parameters

string $field_name: The name of the field.

string $expected: The expected value.

1 call to LinkitDialogTest::assertEqualsWithJs()
LinkitDialogTest::testLinkDialog in tests/src/FunctionalJavascript/LinkitDialogTest.php
Test the link dialog.

File

tests/src/FunctionalJavascript/LinkitDialogTest.php, line 295

Class

LinkitDialogTest
Tests the linkit alterations on the drupallink plugin.

Namespace

Drupal\Tests\linkit\FunctionalJavascript

Code

private function assertEqualsWithJs($field_name, $expected) {
  $javascript = "(function (){ return jQuery('input[name=\"" . $field_name . "\"]').val(); })()";
  $field_value = $this
    ->getSession()
    ->evaluateScript($javascript);
  $this
    ->assertEquals($expected, $field_value, 'The "' . $field_name . '" field has a value of "' . $expected . '".');
}