diff options
author | Timo Tijhof <krinklemail@gmail.com> | 2018-05-22 18:58:04 +0100 |
---|---|---|
committer | Krinkle <krinklemail@gmail.com> | 2018-05-22 22:14:22 +0000 |
commit | 2db395abfc5e6fc4035acc359a1fb6e62fad61fb (patch) | |
tree | be1148ba83a81e1960f291c8e0711d10a2642523 /tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php | |
parent | 39ca88374ed3bb9c40ea7fe0ff4c5e79e1ebef6e (diff) | |
download | mediawikicore-2db395abfc5e6fc4035acc359a1fb6e62fad61fb.tar.gz mediawikicore-2db395abfc5e6fc4035acc359a1fb6e62fad61fb.zip |
resourceloader: Move style deprecation warnings to <body>
Follows-up If35a106c7. These log messages are not criticial and
should not be in the <head> competing with stylesheets and article
content. Move them to the end of <body> instead, nearby other
low-priority script tags.
The getBodyHtml() method from ClientHtml was empty, but has been
non-empty in the past. It's fine to repopulate.
Also, while ClientHtml::getBodyHtml was empty, there are additional
RLQ scripts created by OutputPage that do exist even without this.
Namely, there is a <script> for wgPageParseReport, and one for
wgBackendResponseTime etc.
Change-Id: Ibda7091bdcd5ed207395b20196cdc33df926a24c
Diffstat (limited to 'tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php')
-rw-r--r-- | tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php index 9b03c5ccdd67..7cd698354d1b 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php @@ -176,7 +176,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit\Framework\TestCase { 'test.user', ], ], - 'styledeprecations' => [ + 'styleDeprecations' => [ Xml::encodeJsCall( 'mw.log.warn', [ 'This page is using the deprecated ResourceLoader module "test.styles.deprecated". @@ -228,7 +228,6 @@ Deprecation message.' ] . 'mw.loader.implement("test.private@{blankVer}",function($,jQuery,require,module){},{"css":[]});' . 'mw.loader.load(["test"]);' . 'mw.loader.load("/w/load.php?debug=false\u0026lang=nl\u0026modules=test.scripts\u0026only=scripts\u0026skin=fallback");' - . 'mw.log.warn("This page is using the deprecated ResourceLoader module \"test.styles.deprecated\".\nDeprecation message.");' . '});</script>' . "\n" . '<link rel="stylesheet" href="/w/load.php?debug=false&lang=nl&modules=test.styles.deprecated%2Cpure&only=styles&skin=fallback"/>' . "\n" . '<style>.private{}</style>' . "\n" @@ -304,18 +303,23 @@ Deprecation message.' ] $context = self::makeContext(); $context->getResourceLoader()->register( self::makeSampleModules() ); - $client = new ResourceLoaderClientHtml( $context ); + $client = new ResourceLoaderClientHtml( $context, [ 'nonce' => false ] ); $client->setConfig( [ 'key' => 'value' ] ); $client->setModules( [ 'test', 'test.private.bottom', ] ); + $client->setModuleStyles( [ + 'test.styles.deprecated', + ] ); $client->setModuleScripts( [ 'test.scripts', ] ); - - $expected = ''; - $expected = self::expandVariables( $expected ); + // phpcs:disable Generic.Files.LineLength + $expected = '<script>(window.RLQ=window.RLQ||[]).push(function(){' + . 'mw.log.warn("This page is using the deprecated ResourceLoader module \"test.styles.deprecated\".\nDeprecation message.");' + . '});</script>'; + // phpcs:enable $this->assertEquals( $expected, $client->getBodyHtml() ); } |