You are here

public function ScriptManagerTest::testScriptManagerPositions in Script Manager 8

Test the different page positions.

File

tests/src/Functional/ScriptManagerTest.php, line 50

Class

ScriptManagerTest
Test the script manager module.

Namespace

Drupal\Tests\script_manager\Functional

Code

public function testScriptManagerPositions() {
  $this->exampleScript
    ->set('position', ScriptInterface::POSITION_TOP)
    ->save();
  $this
    ->drupalGet('<front>');
  $this
    ->assertOrderInPage([
    $this->exampleScript
      ->getSnippet(),
    '</h1>',
  ]);
  $this->exampleScript
    ->set('position', ScriptInterface::POSITION_BOTTOM)
    ->save();
  $this
    ->drupalGet('<front>');
  $this
    ->assertOrderInPage([
    '</h1>',
    $this->exampleScript
      ->getSnippet(),
  ]);
  $this->exampleScript
    ->set('position', ScriptInterface::POSITION_HIDDEN)
    ->save();
  $this
    ->drupalGet('<front>');
  $this
    ->assertScriptNotVisible();
}