mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-23 23:13:27 +00:00
Implement support for 'hidden' feature in MediaWikiGadgetsDefinitionRepo
Follows-up 152484566
, which added support for it in Gadgets 2.0, but
it's easy enough to make it work in existing definitions as well.
That way, people can stop using 'rights=hidden' hacks.
Bug: T33150
Change-Id: Idd6944a9ad38279e117c1a02a4b5fd0343455ba0
This commit is contained in:
parent
2bbbfe1b25
commit
27a0ca6568
|
@ -202,6 +202,9 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo {
|
|||
case 'rights':
|
||||
$info['requiredRights'] = $params;
|
||||
break;
|
||||
case 'hidden':
|
||||
$info['hidden'] = true;
|
||||
break;
|
||||
case 'skins':
|
||||
$info['requiredSkins'] = $params;
|
||||
break;
|
||||
|
|
|
@ -130,6 +130,17 @@ class GadgetsTest extends MediaWikiTestCase {
|
|||
$this->assertEquals( $mType, $this->getModule( $g )->getType(), "Module: $message" );
|
||||
}
|
||||
|
||||
public function testIsHidden() {
|
||||
$g = $this->create( '* foo[hidden]|bar.js' );
|
||||
$this->assertTrue( $g->isHidden() );
|
||||
|
||||
$g = $this->create( '* foo[ResourceLoader|hidden]|bar.js' );
|
||||
$this->assertTrue( $g->isHidden() );
|
||||
|
||||
$g = $this->create( '* foo[ResourceLoader]|bar.js' );
|
||||
$this->assertFalse( $g->isHidden() );
|
||||
}
|
||||
|
||||
public function testPreferences() {
|
||||
$prefs = array();
|
||||
$repo = TestingAccessWrapper::newFromObject( new MediaWikiGadgetsDefinitionRepo() );
|
||||
|
|
Loading…
Reference in a new issue