You are here

public function DataLayerFunctionalTest::testDataLayerVariableOutputByName in dataLayer 8

Test DataLayer variable output by name.

This will be helpful when/if the variable name can be customized.

See also

https://www.drupal.org/node/2300577

File

tests/src/Functional/DataLayerFunctionalTest.php, line 52

Class

DataLayerFunctionalTest
Functional test cases for datalayer module.

Namespace

Drupal\Tests\datalayer\Functional

Code

public function testDataLayerVariableOutputByName() {
  $output = $this
    ->drupalGet('node');
  $assert = $this
    ->assertSession();
  $assert
    ->pageTextContains('window.dataLayer = window.dataLayer || []; window.dataLayer.push({');
}