4 * @group ResourceLoader
6 class ResourceLoaderImageModuleTest
extends ResourceLoaderTestCase
{
8 public static $commonImageData = array(
11 'file' => 'remove.svg',
12 'variants' => array( 'destructive' ),
22 'ltr' => 'help-ltr.svg',
23 'rtl' => 'help-rtl.svg',
25 'he' => 'help-ltr.svg',
31 'default' => 'bold-a.svg',
40 public static $commonImageVariants = array(
48 'constructive' => array(
51 'destructive' => array(
56 public static function providerGetModules() {
60 'class' => 'ResourceLoaderImageModule',
61 'prefix' => 'oo-ui-icon',
62 'variants' => self
::$commonImageVariants,
63 'images' => self
::$commonImageData,
68 .oo-ui-icon-add-invert {
74 .oo-ui-icon-remove-invert {
77 .oo-ui-icon-remove-destructive {
83 .oo-ui-icon-next-invert {
89 .oo-ui-icon-help-invert {
95 .oo-ui-icon-bold-invert {
101 'class' => 'ResourceLoaderImageModule',
102 'selectorWithoutVariant' => '.mw-ui-icon-{name}:after, .mw-ui-icon-{name}:before',
103 'selectorWithVariant' => '.mw-ui-icon-{name}-{variant}:after, .mw-ui-icon-{name}-{variant}:before',
104 'variants' => self
::$commonImageVariants,
105 'images' => self
::$commonImageData,
107 '.mw-ui-icon-add:after, .mw-ui-icon-add:before {
110 .mw-ui-icon-add-invert:after, .mw-ui-icon-add-invert:before {
113 .mw-ui-icon-remove:after, .mw-ui-icon-remove:before {
116 .mw-ui-icon-remove-invert:after, .mw-ui-icon-remove-invert:before {
119 .mw-ui-icon-remove-destructive:after, .mw-ui-icon-remove-destructive:before {
122 .mw-ui-icon-next:after, .mw-ui-icon-next:before {
125 .mw-ui-icon-next-invert:after, .mw-ui-icon-next-invert:before {
128 .mw-ui-icon-help:after, .mw-ui-icon-help:before {
131 .mw-ui-icon-help-invert:after, .mw-ui-icon-help-invert:before {
134 .mw-ui-icon-bold:after, .mw-ui-icon-bold:before {
137 .mw-ui-icon-bold-invert:after, .mw-ui-icon-bold-invert:before {
145 * @dataProvider providerGetModules
146 * @covers ResourceLoaderImageModule::getStyles
148 public function testGetStyles( $module, $expected ) {
149 $module = new ResourceLoaderImageModuleTestable( $module, __DIR__
. '/../../data/resourceloader' );
150 $styles = $module->getStyles( $this->getResourceLoaderContext() );
151 $this->assertEquals( $expected, $styles['all'] );
155 class ResourceLoaderImageModuleTestable
extends ResourceLoaderImageModule
{
157 * Replace with a stub to make test cases easier to write.
159 protected function getCssDeclarations( $primary, $fallback ) {
160 return array( '...' );