mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-01 02:36:47 +00:00
6699724d65
Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Change-Id: I1d2604e3f246ede58ff8245ba2b940f258d2d80c
40 lines
847 B
PHP
40 lines
847 B
PHP
<?php
|
|
|
|
/**
|
|
* Test the TeX source output format.
|
|
*
|
|
* @covers MathRenderer
|
|
*
|
|
* @group Math
|
|
*
|
|
* @licence GNU GPL v2+
|
|
*/
|
|
class MathSourceTest extends MediaWikiTestCase {
|
|
|
|
/**
|
|
* Checks the basic functionallity
|
|
* i.e. if the span element is generated right.
|
|
*/
|
|
public function testBasics() {
|
|
$real = MathRenderer::renderMath( "a+b", [], 'source' );
|
|
$this->assertEquals(
|
|
'<span class="mwe-math-fallback-source-inline tex" dir="ltr">$ a+b $</span>',
|
|
$real,
|
|
"Rendering of a+b in plain Text mode"
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Checks if newlines are converted to spaces correctly.
|
|
*/
|
|
public function testNewLines() {
|
|
$real = MathRenderer::renderMath( "a\n b", [], 'source' );
|
|
$this->assertSame(
|
|
'<span class="mwe-math-fallback-source-inline tex" dir="ltr">$ a b $</span>',
|
|
$real,
|
|
"converting newlines to spaces"
|
|
);
|
|
}
|
|
|
|
}
|