Loading mathjax.info.yml +1 −1 Original line number Diff line number Diff line name: MathJax type: module description: Javascript-based LaTeX rendering solution for your Drupal website. core_version_requirement: ^8 || ^9 core_version_requirement: ^9.1 || ^10 configure: mathjax.settings libraries: - mathjax/setup Loading tests/src/Functional/MathjaxWebTest.php +17 −16 Original line number Diff line number Diff line Loading @@ -67,16 +67,16 @@ class MathjaxWebTest extends BrowserTestBase { $config = Drupal::config('mathjax.settings'); $this->drupalLogin($this->administrator); $this->drupalGet('admin/config'); $this->assertText('Configure global settings for MathJax.'); $this->assertSession()->pageTextContains('Configure global settings for MathJax.'); $this->drupalGet('admin/config/content/formats/add'); $this->assertText('Mathematics inside the configured delimiters is rendered by MathJax'); $this->assertSession()->pageTextContains('Mathematics inside the configured delimiters is rendered by MathJax'); $this->drupalGet('admin/config/content/mathjax'); $this->assertTitle('MathJax | Drupal'); $this->assertText('MathJax CDN URL'); $this->assertFieldByName('cdn_url', $config->get('cdn_url')); $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('config_type', 0); $this->assertSession()->titleEquals('MathJax | Drupal'); $this->assertSession()->pageTextContains('MathJax CDN URL'); $this->assertSession()->fieldValueEquals('cdn_url', $config->get('cdn_url')); $this->assertSession()->pageTextContains('Enter the MathJax CDN url here or leave it unchanged to use the one provided by www.mathjax.org.'); $this->assertSession()->pageTextContains('Configuration Type'); $this->assertSession()->fieldValueEquals('config_type', 0); $custom = '{"tex2jax":{"inlineMath":[["#","#"],["\\(","\\)"]],"processEscapes":"true"},"showProcessingMessages":"false","messageStyle":"none"}'; $path = 'admin/config/content/mathjax'; Loading @@ -84,10 +84,11 @@ class MathjaxWebTest extends BrowserTestBase { 'config_type' => 1, 'config_string' => $custom, ]; $this->drupalGet($path); $this->drupalPostForm($path, $edit, t('Save configuration')); $this->assertText('Enter a JSON configuration string as documented'); $this->assertRaw(htmlentities($custom)); $this->submitForm($edit, t('Save configuration')); $this->assertSession()->pageTextContains('Enter a JSON configuration string as documented'); $this->assertSession()->responseContains(htmlentities($custom)); } /** Loading @@ -96,14 +97,14 @@ class MathjaxWebTest extends BrowserTestBase { public function testLibraryDetection() { $this->drupalLogin($this->administrator); $this->drupalGet('admin/reports/status'); $this->assertNoText('MathJax is configured to use local library files but they could not be found. See the README.'); $this->assertSession()->pageTextNotContains('MathJax is configured to use local library files but they could not be found. See the README.'); $this->drupalGet('admin/config/content/mathjax'); $edit = [ 'use_cdn' => FALSE, ]; $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->submitForm($edit, t('Save configuration')); $this->drupalGet('admin/reports/status'); $this->assertText('MathJax is configured to use local library files but they could not be found. See the README.'); $this->assertSession()->pageTextContains('MathJax is configured to use local library files but they could not be found. See the README.'); } /** Loading @@ -114,12 +115,12 @@ class MathjaxWebTest extends BrowserTestBase { // Activate the MathJax filter on the plain_text format. $this->drupalGet('admin/config/content/formats/manage/plain_text'); $edit = ['filters[filter_mathjax][status]' => TRUE]; $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->submitForm($edit, t('Save configuration')); $this->drupalGet('admin/config/content/formats/manage/plain_text'); // Ensure that MathJax appears at the bottom of the active filter list. $count = count($this->xpath("//div[@id='edit-filters-status']/div/input[@class='form-checkbox' and @checked='checked']")); $result = $this->xpath("//table[@id='filter-order']/tbody/tr[$count]/td[1]"); $this->assertEqual($result[0]->getText(), 'MathJax'); $this->assertEquals($result[0]->getText(), 'MathJax'); } } Loading
mathjax.info.yml +1 −1 Original line number Diff line number Diff line name: MathJax type: module description: Javascript-based LaTeX rendering solution for your Drupal website. core_version_requirement: ^8 || ^9 core_version_requirement: ^9.1 || ^10 configure: mathjax.settings libraries: - mathjax/setup Loading
tests/src/Functional/MathjaxWebTest.php +17 −16 Original line number Diff line number Diff line Loading @@ -67,16 +67,16 @@ class MathjaxWebTest extends BrowserTestBase { $config = Drupal::config('mathjax.settings'); $this->drupalLogin($this->administrator); $this->drupalGet('admin/config'); $this->assertText('Configure global settings for MathJax.'); $this->assertSession()->pageTextContains('Configure global settings for MathJax.'); $this->drupalGet('admin/config/content/formats/add'); $this->assertText('Mathematics inside the configured delimiters is rendered by MathJax'); $this->assertSession()->pageTextContains('Mathematics inside the configured delimiters is rendered by MathJax'); $this->drupalGet('admin/config/content/mathjax'); $this->assertTitle('MathJax | Drupal'); $this->assertText('MathJax CDN URL'); $this->assertFieldByName('cdn_url', $config->get('cdn_url')); $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('config_type', 0); $this->assertSession()->titleEquals('MathJax | Drupal'); $this->assertSession()->pageTextContains('MathJax CDN URL'); $this->assertSession()->fieldValueEquals('cdn_url', $config->get('cdn_url')); $this->assertSession()->pageTextContains('Enter the MathJax CDN url here or leave it unchanged to use the one provided by www.mathjax.org.'); $this->assertSession()->pageTextContains('Configuration Type'); $this->assertSession()->fieldValueEquals('config_type', 0); $custom = '{"tex2jax":{"inlineMath":[["#","#"],["\\(","\\)"]],"processEscapes":"true"},"showProcessingMessages":"false","messageStyle":"none"}'; $path = 'admin/config/content/mathjax'; Loading @@ -84,10 +84,11 @@ class MathjaxWebTest extends BrowserTestBase { 'config_type' => 1, 'config_string' => $custom, ]; $this->drupalGet($path); $this->drupalPostForm($path, $edit, t('Save configuration')); $this->assertText('Enter a JSON configuration string as documented'); $this->assertRaw(htmlentities($custom)); $this->submitForm($edit, t('Save configuration')); $this->assertSession()->pageTextContains('Enter a JSON configuration string as documented'); $this->assertSession()->responseContains(htmlentities($custom)); } /** Loading @@ -96,14 +97,14 @@ class MathjaxWebTest extends BrowserTestBase { public function testLibraryDetection() { $this->drupalLogin($this->administrator); $this->drupalGet('admin/reports/status'); $this->assertNoText('MathJax is configured to use local library files but they could not be found. See the README.'); $this->assertSession()->pageTextNotContains('MathJax is configured to use local library files but they could not be found. See the README.'); $this->drupalGet('admin/config/content/mathjax'); $edit = [ 'use_cdn' => FALSE, ]; $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->submitForm($edit, t('Save configuration')); $this->drupalGet('admin/reports/status'); $this->assertText('MathJax is configured to use local library files but they could not be found. See the README.'); $this->assertSession()->pageTextContains('MathJax is configured to use local library files but they could not be found. See the README.'); } /** Loading @@ -114,12 +115,12 @@ class MathjaxWebTest extends BrowserTestBase { // Activate the MathJax filter on the plain_text format. $this->drupalGet('admin/config/content/formats/manage/plain_text'); $edit = ['filters[filter_mathjax][status]' => TRUE]; $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->submitForm($edit, t('Save configuration')); $this->drupalGet('admin/config/content/formats/manage/plain_text'); // Ensure that MathJax appears at the bottom of the active filter list. $count = count($this->xpath("//div[@id='edit-filters-status']/div/input[@class='form-checkbox' and @checked='checked']")); $result = $this->xpath("//table[@id='filter-order']/tbody/tr[$count]/td[1]"); $this->assertEqual($result[0]->getText(), 'MathJax'); $this->assertEquals($result[0]->getText(), 'MathJax'); } }