You are here

public function AjaxLoaderTestCase::testFilledOutSettings in Ajax loader 7

Test all the things when settings are set.

File

./ajax_loader.test, line 87
Test class to ensure proper working of module.

Class

AjaxLoaderTestCase
@file Test class to ensure proper working of module.

Code

public function testFilledOutSettings() {
  $this
    ->drupalLogin($this->user);
  variable_set('ajax_loader_settings', array(
    'throbber' => 'ThrobberChasingDots',
    'custom_css' => NULL,
    'hide_ajax_message' => 0,
  ));
  $this
    ->drupalGet('ajax-loader/test');

  // JS file should be added.
  $this
    ->assertRaw('ajax-loader.js');

  // CSS should be added.
  $throbber = new ThrobberChasingDots();
  $this
    ->assertRaw($throbber
    ->getCssFile());
  $this
    ->assertRaw('throbber-general.css');

  // Change throbber and test again.
  variable_set('ajax_loader_settings', array(
    'throbber' => 'ThrobberDoubleBounce',
    'custom_css' => NULL,
    'hide_ajax_message' => 0,
  ));
  $this
    ->drupalGet('ajax-loader/test');

  // JS file should be added.
  $this
    ->assertRaw('ajax-loader.js');
  $this
    ->assertNoText($throbber
    ->getCssFile());
  $this
    ->assertRaw('throbber-general.css');
}