mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-11 23:46:07 +00:00
8c6eeae82e
In native MathML we only display MathML, also get rid of enclosing <div / <span container. Bug: T182041 Change-Id: I26bc4ea88d360d53cc7a34a89bef78812b84b2ea
55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Extension\Math\MathNativeMML;
|
|
|
|
/**
|
|
* Test the native MathML output format.
|
|
*
|
|
* @covers \MediaWiki\Extension\Math\MathNativeMML
|
|
*
|
|
* @group Math
|
|
*
|
|
* @license GPL-2.0-or-later
|
|
*/
|
|
class MathNativeMMLTest extends MediaWikiIntegrationTestCase {
|
|
|
|
protected function setUp(): void {
|
|
parent::setUp();
|
|
$this->setMwGlobals( 'wgMathValidModes', [ 'native' ] );
|
|
}
|
|
|
|
public function testSin() {
|
|
$mml = new MathNativeMML( '\sin' );
|
|
$this->assertSame( 'tex', $mml->getInputType() );
|
|
$this->assertTrue( $mml->checkTeX() );
|
|
$this->assertTrue( $mml->render() );
|
|
$this->assertStringContainsString( 'sin', $mml->getMathml() );
|
|
}
|
|
|
|
public function testNoLink() {
|
|
$this->setMwGlobals( 'wgMathEnableFormulaLinks', false );
|
|
$mml = new MathNativeMML( '\sin', [ 'qid' => 'Q1' ] );
|
|
$this->assertTrue( $mml->render() );
|
|
$this->assertStringNotContainsString( 'href', $mml->getMathml() );
|
|
}
|
|
|
|
public function testLink() {
|
|
$this->setMwGlobals( 'wgMathEnableFormulaLinks', true );
|
|
$mml = new MathNativeMML( '\sin', [ 'qid' => 'Q1' ] );
|
|
$this->assertTrue( $mml->render() );
|
|
$this->assertStringContainsString( 'href', $mml->getMathml() );
|
|
}
|
|
|
|
public function testId() {
|
|
$mml = new MathNativeMML( '\sin', [ 'id' => 'unique-id' ] );
|
|
$this->assertTrue( $mml->render() );
|
|
$this->assertStringContainsString( 'unique-id', $mml->getMathml() );
|
|
}
|
|
|
|
public function testBlock() {
|
|
$mml = new MathNativeMML( '\sin', [ 'display' => 'block' ] );
|
|
$this->assertTrue( $mml->render() );
|
|
$this->assertStringContainsString( 'block', $mml->getMathml() );
|
|
}
|
|
}
|