diff --git a/includes/DirectParsoidClient.php b/includes/DirectParsoidClient.php index 5a4bdaad99..2ccf97f68d 100644 --- a/includes/DirectParsoidClient.php +++ b/includes/DirectParsoidClient.php @@ -85,7 +85,9 @@ class DirectParsoidClient implements ParsoidClient { $helper->init( $page, [], $user, $revision ); $helper->setStashingEnabled( $stash ); - $helper->setFlavor( $flavor ); + if ( !$stash ) { + $helper->setFlavor( $flavor ); + } if ( $revision ) { $helper->setRevision( $revision ); diff --git a/tests/phpunit/integration/DirectParsoidClientTest.php b/tests/phpunit/integration/DirectParsoidClientTest.php index 831869c12e..1bfb374d6d 100644 --- a/tests/phpunit/integration/DirectParsoidClientTest.php +++ b/tests/phpunit/integration/DirectParsoidClientTest.php @@ -195,6 +195,11 @@ class DirectParsoidClientTest extends MediaWikiIntegrationTestCase { $oldHtml = $pageHtmlResponse['body']; $updatedHtml = str_replace( '', '

More Text

', $oldHtml ); + // Make sure the etag is for "stash" flavor HTML. + // The ETag should be transparent, but this is the easiest way to check that we are getting + // the correct flavor of HTML. + $this->assertMatchesRegularExpression( '@/stash\b@', $eTag ); + // Now make a new client object, so we can mock the ParsoidOutputAccess. $parsoidOutputAccess = $this->createNoOpMock( ParsoidOutputAccess::class ); $services = $this->getServiceContainer();