Default to type=general for styles-only gadgets having dependencies

Bug: T147726
Change-Id: I4153851b0e2f5cc067b1f31a7cd80f73d0620d7c
This commit is contained in:
Timo Tijhof 2016-11-16 17:53:10 -08:00
parent 01f5977286
commit 906aaeeb82
2 changed files with 7 additions and 1 deletions

View file

@ -298,7 +298,7 @@ class Gadget {
if ( $this->type === 'styles' || $this->type === 'general' ) {
return $this->type;
}
if ( $this->styles && !$this->scripts ) {
if ( $this->styles && !$this->scripts && !$this->dependencies ) {
// Similar to ResourceLoaderWikiModule default
return 'styles';
}

View file

@ -84,6 +84,12 @@ class GadgetsTest extends MediaWikiTestCase {
'general',
ResourceLoaderModule::LOAD_GENERAL,
),
array(
'Default (styles only with dependencies)',
'* foo[ResourceLoader|dependencies=jquery.ui]|bar.css',
'',
ResourceLoaderModule::LOAD_GENERAL,
),
array(
'Styles type (mixed)',
'* foo[ResourceLoader|type=styles]|bar.css|bar.js',