Fix: id-attribute
Id attribute was read wrong place Change-Id: I6f2671a322f637a1d8e0c88833ce4456d188829b
This commit is contained in:
parent
bc519c22f4
commit
f2dff6574b
@ -76,6 +76,9 @@ abstract class MathRenderer {
|
||||
$this->userInputTex = $tex;
|
||||
$this->tex = $tex;
|
||||
$this->params = $params;
|
||||
if ( isset( $params['id'] ) ) {
|
||||
$this->id = $params['id'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,10 +142,7 @@ abstract class MathRenderer {
|
||||
$tex = '{\textstyle ' . $tex . '}';
|
||||
}
|
||||
}
|
||||
$id = null;
|
||||
if ( isset( $params['id'] ) ) {
|
||||
$id = $params['id'];
|
||||
}
|
||||
|
||||
if ( isset( $params['forcemathmode'] ) ) {
|
||||
$mode = $params['forcemathmode'];
|
||||
}
|
||||
|
17
tests/MathIdTest.php
Normal file
17
tests/MathIdTest.php
Normal file
@ -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
Block a user