Merge "Fix: id-attribute"
This commit is contained in:
commit
28b4e4d692
|
@ -76,6 +76,9 @@ abstract class MathRenderer {
|
||||||
$this->userInputTex = $tex;
|
$this->userInputTex = $tex;
|
||||||
$this->tex = $tex;
|
$this->tex = $tex;
|
||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
|
if ( isset( $params['id'] ) ) {
|
||||||
|
$this->id = $params['id'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,10 +142,7 @@ abstract class MathRenderer {
|
||||||
$tex = '{\textstyle ' . $tex . '}';
|
$tex = '{\textstyle ' . $tex . '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$id = null;
|
|
||||||
if ( isset( $params['id'] ) ) {
|
|
||||||
$id = $params['id'];
|
|
||||||
}
|
|
||||||
if ( isset( $params['forcemathmode'] ) ) {
|
if ( isset( $params['forcemathmode'] ) ) {
|
||||||
$mode = $params['forcemathmode'];
|
$mode = $params['forcemathmode'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Test the Id feature
|
||||||
|
* @group Math
|
||||||
|
*/
|
||||||
|
class MathIdTest extends MediaWikiTestCase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the id specified as attribute is set in the renderer object
|
||||||
|
*/
|
||||||
|
public function testBasics() {
|
||||||
|
define( 'RANDOM_ID', 'a_random_id' );
|
||||||
|
$renderer = MathRenderer::getRenderer( "a+b", array( 'id' => RANDOM_ID ) );
|
||||||
|
$this->assertEquals( RANDOM_ID, $renderer->getId() );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue