ParserOutputAccess: fix the wrapper div fetched from the fallback cache
Followup-To: I7f933fd61bf358c6ea0e0c1202231cac618f9e8d Change-Id: I502adc85cd2a75160f090b8979213b5d7563aefd
This commit is contained in:
parent
77766d44c3
commit
c1b82097e4
2 changed files with 18 additions and 1 deletions
|
|
@ -244,6 +244,12 @@ class ParserOutputAccess {
|
|||
ParsoidOutputAccess::PARSOID_PARSER_CACHE_NAME
|
||||
);
|
||||
$output = $fallbackParsoidCache->get( $page, $parserOptions );
|
||||
// Unforunately, fallback content doesn't have the wrapper div
|
||||
// class set properly.
|
||||
$class = $parserOptions->getWrapOutputClass();
|
||||
if ( $output && $class !== false && !$parserOptions->getInterfaceMessage() ) {
|
||||
$output->addWrapperDivClass( $class );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -896,7 +896,14 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertEquals( array_fill( 0, count( $calls ), $parsoid ), $calls );
|
||||
}
|
||||
|
||||
public function testT332931Hacks() {
|
||||
public function provideTestT332931Hacks() {
|
||||
return [ [ false ], [ true ] ];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideTestT332931Hacks
|
||||
*/
|
||||
public function testT332931Hacks( bool $useDefaultWrapClass ) {
|
||||
// Cache used by ParsoidOutputAccess
|
||||
$parsoidParserCache = $this->getParserCache( new HashBagOStuff(), 'parsoid' );
|
||||
|
||||
|
|
@ -922,6 +929,9 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
// No hit when first accessed
|
||||
$parserOptions = $this->getParserOptions();
|
||||
if ( !$useDefaultWrapClass ) {
|
||||
$parserOptions->setWrapOutputClass( 'custom-wrap-class' );
|
||||
}
|
||||
$page = $this->getNonexistingTestPage( __METHOD__ );
|
||||
$this->editPage( $page, 'Hello World' );
|
||||
$output = $access->getCachedParserOutput( $page, $parserOptions );
|
||||
|
|
@ -940,6 +950,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
$parserOptions->setUseParsoid();
|
||||
$output = $access->getCachedParserOutput( $page, $parserOptions );
|
||||
$this->assertNotNull( $output );
|
||||
$this->assertEquals( $parserOptions->getWrapOutputClass(), $output->getWrapperDivClass() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue