Gadgets should default to mobile and desktop targets

The targets system is being deprecated.

Bug: T127268
Bug: T340046
Change-Id: I69d11d52238ac852534cb9a4555208a0b0bb5fd7
This commit is contained in:
Jon Robson 2023-06-21 08:24:03 -07:00 committed by Jdlrobson
parent 8fe6e40cd4
commit 58463ce97c
3 changed files with 3 additions and 3 deletions

View file

@ -67,7 +67,7 @@ class GadgetDefinitionContentHandler extends JsonContentHandler {
'requiresES6' => false,
'hidden' => false,
'skins' => [],
'targets' => [ 'desktop' ],
'targets' => [ 'desktop', 'mobile' ],
'actions' => [],
'category' => '',
'supportsUrlLoad' => false,

View file

@ -59,7 +59,7 @@ class Gadget {
/** @var string[] */
private $requiredSkins = [];
/** @var string[] */
private $targets = [ 'desktop' ];
private $targets = [ 'desktop', 'mobile' ];
/** @var bool */
private $onByDefault = false;
/** @var bool */

View file

@ -143,7 +143,7 @@ class GadgetTest extends MediaWikiUnitTestCase {
public function testTargets() {
$g = GadgetTestUtils::makeGadget( '*foo[ResourceLoader]|foo.js' );
$g2 = GadgetTestUtils::makeGadget( '*bar[ResourceLoader|targets=desktop,mobile]|bar.js' );
$this->assertEquals( [ 'desktop' ], $g->getTargets() );
$this->assertEquals( [ 'desktop', 'mobile' ], $g->getTargets() );
$this->assertEquals( [ 'desktop', 'mobile' ], $g2->getTargets() );
}