You are here

public function MathjaxWebTestCase::testAdmin in MathJax: LaTeX for Drupal 7.2

Test the administration functions.

File

./mathjax.test, line 54
Web test file for MathJax module.

Class

MathjaxWebTestCase
Web test case for the module.

Code

public function testAdmin() {
  $this
    ->drupalLogin($this->administrator);
  $this
    ->drupalGet('admin/config/content/mathjax');
  $this
    ->assertTitle('MathJax | Drupal', 'Page title set.');
  $this
    ->assertText('MathJax CDN URL');
  $this
    ->assertFieldByName('mathjax_cdn_url', mathjax_default('cdn url'), 'Default CDN config string found.');
  $this
    ->assertText('Enter the Mathjax CDN url here or leave it unchanged to use the one provided by www.mathjax.org.');
  $this
    ->assertText('Configuration Type');
  $this
    ->assertFieldByName('mathjax_config_type', 0);
  $custom = "MathJax.Hub.Config({\n      extensions: ['tex2jax.js'],\n      jax: ['input/TeX','output/HTML-CSS'],\n      tex2jax: {\n        inlineMath: [ ['\$','\$'], ['\\\\(','\\\\)'] ],\n        processEscapes: true\n      }\n    });";
  $path = 'admin/config/content/mathjax';
  $edit = array(
    'mathjax_config_type' => 1,
    'mathjax_config_string' => $custom,
  );
  $this
    ->drupalPost($path, $edit, t('Save configuration'));
  $this
    ->assertText('Enter a JavaScript configuration string as documented');
  $this
    ->assertRaw('<script type="text/x-mathjax-config">' . $custom . '</script>', 'Custom configuration string found.');
}