X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fresourceloader%2FResourceLoaderClientHtmlTest.php;h=3530d3c1d3e29ff5192445c54986e09e5abe4354;hb=a0947c9507065a83afe52b078f0f6d1c6163875e;hp=3e0d883c60a7be134abd5307c03fe8725fb4cf86;hpb=942446575486057b38e186a8f5599a645758b702;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php index 3e0d883c60..3530d3c1d3 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php @@ -43,6 +43,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'test.top' => [ 'position' => 'top' ], 'test.private.top' => [ 'group' => 'private', 'position' => 'top' ], 'test.private.bottom' => [ 'group' => 'private', 'position' => 'bottom' ], + 'test.shouldembed' => [ 'shouldEmbed' => true ], 'test.styles.pure' => [ 'type' => ResourceLoaderModule::LOAD_STYLES ], 'test.styles.mixed' => [], @@ -64,12 +65,24 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'group' => 'private', 'styles' => '.private{}', ], + 'test.styles.shouldembed' => [ + 'type' => ResourceLoaderModule::LOAD_STYLES, + 'shouldEmbed' => true, + 'styles' => '.shouldembed{}', + ], 'test.scripts' => [], 'test.scripts.top' => [ 'position' => 'top' ], 'test.scripts.user' => [ 'group' => 'user' ], 'test.scripts.user.empty' => [ 'group' => 'user', 'isKnownEmpty' => true ], 'test.scripts.raw' => [ 'isRaw' => true ], + 'test.scripts.shouldembed' => [ 'shouldEmbed' => true ], + + 'test.ordering.a' => [ 'shouldEmbed' => false ], + 'test.ordering.b' => [ 'shouldEmbed' => false ], + 'test.ordering.c' => [ 'shouldEmbed' => true, 'styles' => '.orderingC{}' ], + 'test.ordering.d' => [ 'shouldEmbed' => true, 'styles' => '.orderingD{}' ], + 'test.ordering.e' => [ 'shouldEmbed' => false ], ]; return array_map( function ( $options ) { return self::makeModule( $options ); @@ -102,6 +115,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'test.private.bottom', 'test.private.top', 'test.top', + 'test.shouldembed', 'test.unregistered', ] ); $client->setModuleStyles( [ @@ -109,12 +123,14 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'test.styles.user.empty', 'test.styles.private', 'test.styles.pure', + 'test.styles.shouldembed', 'test.unregistered.styles', ] ); $client->setModuleScripts( [ 'test.scripts', 'test.scripts.user.empty', 'test.scripts.top', + 'test.scripts.shouldembed', 'test.unregistered.scripts', ] ); @@ -122,12 +138,15 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'states' => [ 'test.private.top' => 'loading', 'test.private.bottom' => 'loading', + 'test.shouldembed' => 'loading', 'test.styles.pure' => 'ready', 'test.styles.user.empty' => 'ready', 'test.styles.private' => 'ready', + 'test.styles.shouldembed' => 'ready', 'test.scripts' => 'loading', 'test.scripts.top' => 'loading', 'test.scripts.user.empty' => 'ready', + 'test.scripts.shouldembed' => 'loading', ], 'general' => [ 'test', @@ -139,12 +158,14 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'scripts' => [ 'test.scripts', 'test.scripts.top', + 'test.scripts.shouldembed', ], 'embed' => [ - 'styles' => [ 'test.styles.private' ], + 'styles' => [ 'test.styles.private', 'test.styles.shouldembed' ], 'general' => [ 'test.private.bottom', 'test.private.top', + 'test.shouldembed', ], ], ]; @@ -276,6 +297,47 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { 'only' => ResourceLoaderModule::TYPE_STYLES, 'output' => '', ], + [ + 'context' => [], + 'modules' => [ 'test.shouldembed' ], + 'only' => ResourceLoaderModule::TYPE_COMBINED, + 'output' => '', + ], + [ + 'context' => [], + 'modules' => [ 'test.styles.shouldembed' ], + 'only' => ResourceLoaderModule::TYPE_STYLES, + 'output' => '', + ], + [ + 'context' => [], + 'modules' => [ 'test.scripts.shouldembed' ], + 'only' => ResourceLoaderModule::TYPE_SCRIPTS, + 'output' => '', + ], + [ + 'context' => [], + 'modules' => [ 'test', 'test.shouldembed' ], + 'only' => ResourceLoaderModule::TYPE_COMBINED, + 'output' => '', + ], + [ + 'context' => [], + 'modules' => [ 'test.styles.pure', 'test.styles.shouldembed' ], + 'only' => ResourceLoaderModule::TYPE_STYLES, + 'output' => + '' . "\n" + . '' + ], + [ + 'context' => [], + 'modules' => [ 'test.ordering.a', 'test.ordering.e', 'test.ordering.b', 'test.ordering.d', 'test.ordering.c' ], + 'only' => ResourceLoaderModule::TYPE_STYLES, + 'output' => + '' . "\n" + . '' . "\n" + . '' + ], // @codingStandardsIgnoreEnd ]; }