dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make "/*@noflip*/ /*@embed*/" annotation work without CSSJanus hacks
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
resourceloader
/
ResourceLoaderTest.php
diff --git
a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
index
d2e118c
..
7664d5b
100644
(file)
--- a/
tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
+++ b/
tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
@@
-90,6
+90,15
@@
class ResourceLoaderTest extends ResourceLoaderTestCase {
$this->assertStringEqualsFile( $basePath . '/styles.css', $styles['all'] );
}
$this->assertStringEqualsFile( $basePath . '/styles.css', $styles['all'] );
}
+ /**
+ * Strip @noflip annotations from CSS code.
+ * @param string $css
+ * @return string
+ */
+ private function stripNoflip( $css ) {
+ return str_replace( '/*@noflip*/ ', '', $css );
+ }
+
/**
* What happens when you mix @embed and @noflip?
* This really is an integration test, but oh well.
/**
* What happens when you mix @embed and @noflip?
* This really is an integration test, but oh well.
@@
-108,14
+117,16
@@
class ResourceLoaderTest extends ResourceLoaderTestCase {
$contextLtr = self::getResourceLoaderContext( 'en' );
$contextRtl = self::getResourceLoaderContext( 'he' );
$contextLtr = self::getResourceLoaderContext( 'en' );
$contextRtl = self::getResourceLoaderContext( 'he' );
+ // Since we want to compare the effect of @noflip+@embed against the effect of just @embed, and
+ // the @noflip annotations are always preserved, we need to strip them first.
$this->assertEquals(
$expectedModule->getStyles( $contextLtr ),
$this->assertEquals(
$expectedModule->getStyles( $contextLtr ),
- $t
estModule->getStyles( $contextLtr
),
+ $t
his->stripNoflip( $testModule->getStyles( $contextLtr )
),
"/*@noflip*/ with /*@embed*/ gives correct results in LTR mode"
);
$this->assertEquals(
$expectedModule->getStyles( $contextLtr ),
"/*@noflip*/ with /*@embed*/ gives correct results in LTR mode"
);
$this->assertEquals(
$expectedModule->getStyles( $contextLtr ),
- $t
estModule->getStyles( $contextRtl
),
+ $t
his->stripNoflip( $testModule->getStyles( $contextRtl )
),
"/*@noflip*/ with /*@embed*/ gives correct results in RTL mode"
);
}
"/*@noflip*/ with /*@embed*/ gives correct results in RTL mode"
);
}