You are here

public function AddThisJsTest::testJavascriptPresent in AddThis 7.4

Test the presense of certain Javascript elements.

File

tests/AddThisJsTest.test, line 33
Class to test the AddThis Js functionality.

Class

AddThisJsTest
AddThisJsTest tests

Code

public function testJavascriptPresent() {
  $this
    ->drupalGet('<front>');

  // AddThis settings are not present.
  $settings = $this
    ->drupalGetSettings();
  $this
    ->assertTrue(empty($settings['addthis']), 'Drupal.settings.addthis is not present.');

  // AddThis settings are not present.
  $this
    ->drupalGet('addthis/test/1');
  $settings = $this
    ->drupalGetSettings();
  $this
    ->assertTrue(empty($settings['addthis']), 'Drupal.settings.addthis is not present on test page.');

  // AddThis settings is present.
  $this
    ->drupalGet('addthis/test/2');
  $settings = $this
    ->drupalGetSettings();
  $this
    ->assertTrue(!empty($settings['addthis']), 'Drupal.settings.addthis is present on test page and loaded on hook_page_build().');
}