public function AjaxTest::assertInsert in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxTest::assertInsert()
Assert insert.
Parameters
string $render_type: Render type.
string $expected: Expected result.
string $script: Script for additional theming.
1 call to AjaxTest::assertInsert()
- AjaxTest::testInsertAjaxResponse in core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxTest.php - Tests that various AJAX responses with DOM elements are correctly inserted.
File
- core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxTest.php, line 166
Class
- AjaxTest
- Tests AJAX responses.
Namespace
Drupal\FunctionalJavascriptTests\AjaxCode
public function assertInsert($render_type, $expected, $script = '') {
// Check insert to block element.
$this
->drupalGet('ajax-test/insert-block-wrapper');
$this
->getSession()
->executeScript($script);
$this
->clickLink("Link html {$render_type}");
$this
->assertWaitPageContains('<div class="ajax-target-wrapper"><div id="ajax-target">' . $expected . '</div></div>');
$this
->drupalGet('ajax-test/insert-block-wrapper');
$this
->getSession()
->executeScript($script);
$this
->clickLink("Link replaceWith {$render_type}");
$this
->assertWaitPageContains('<div class="ajax-target-wrapper">' . $expected . '</div>');
// Check insert to inline element.
$this
->drupalGet('ajax-test/insert-inline-wrapper');
$this
->getSession()
->executeScript($script);
$this
->clickLink("Link html {$render_type}");
$this
->assertWaitPageContains('<div class="ajax-target-wrapper"><span id="ajax-target-inline">' . $expected . '</span></div>');
$this
->drupalGet('ajax-test/insert-inline-wrapper');
$this
->getSession()
->executeScript($script);
$this
->clickLink("Link replaceWith {$render_type}");
$this
->assertWaitPageContains('<div class="ajax-target-wrapper">' . $expected . '</div>');
}