AjaxPageStateTest.php in Zircon Profile 8.0
File
core/modules/system/src/Tests/Render/AjaxPageStateTest.php
View source
<?php
namespace Drupal\system\Tests\Render;
use Drupal\simpletest\WebTestBase;
class AjaxPageStateTest extends WebTestBase {
protected $adminUser;
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser(array_keys(\Drupal::service('user.permissions')
->getPermissions()));
$this
->drupalLogin($this->adminUser);
}
public function testLibrariesAvailable() {
$this
->drupalGet('node', array());
$this
->assertRaw('/core/assets/vendor/html5shiv/html5shiv.min.js', 'The html5shiv library from core should be loaded.');
$this
->assertRaw('/core/misc/drupalSettingsLoader.js', 'The Dupalsettings library from core should be loaded.');
}
public function testHtml5ShivIsNotLoaded() {
$this
->drupalGet('node', array(
"query" => array(
'ajax_page_state' => array(
'libraries' => 'core/html5shiv',
),
),
));
$this
->assertNoRaw('/core/assets/vendor/html5shiv/html5shiv.min.js', 'The html5shiv library from core should be excluded from loading');
$this
->assertRaw('/core/misc/drupalSettingsLoader.js', 'The Dupalsettings library from core should be loaded.');
}
public function testMultipleLibrariesAreNotLoaded() {
$this
->drupalGet('node', array(
"query" => array(
'ajax_page_state' => array(
'libraries' => 'core/html5shiv,core/drupalSettings',
),
),
));
$this
->assertNoRaw('/core/assets/vendor/html5shiv/html5shiv.min.js', 'The html5shiv library from core should be excluded from loading.');
$this
->assertNoRaw('/core/misc/drupalSettingsLoader.js', 'The Dupalsettings library from core should be excluded from loading.');
}
}
Classes
Name |
Description |
AjaxPageStateTest |
Performs tests for the effects of the ajax_page_state query parameter. |