mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateStyles
synced 2024-11-27 17:50:29 +00:00
Merge "Fix wrapper="…" failing for more complex selectors"
This commit is contained in:
commit
8edccc8d4c
|
@ -82,7 +82,7 @@ class TemplateStylesHooks {
|
|||
$match = self::getMatcherFactory()->cssSimpleSelectorSeq()
|
||||
->match( $components, [ 'mark-significance' => true ] );
|
||||
}
|
||||
self::$wrappers[$wrapper] = $match ? $components->toTokenArray() : false;
|
||||
self::$wrappers[$wrapper] = $match ? $components->toComponentValueArray() : false;
|
||||
}
|
||||
return self::$wrappers[$wrapper];
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Revision\MutableRevisionRecord;
|
||||
use MediaWiki\Revision\SlotRecord;
|
||||
use Wikimedia\CSS\Parser\Parser as CSSParser;
|
||||
|
||||
/**
|
||||
* @group TemplateStyles
|
||||
|
@ -39,6 +40,12 @@ class TemplateStylesHooksTest extends MediaWikiLangTestCase {
|
|||
TemplateStylesHooks::getSanitizer( 'foo', '.foo>.bar' );
|
||||
}
|
||||
|
||||
public function testGetSanitizerNonLinearWrapper() {
|
||||
$sanitizer = TemplateStylesHooks::getSanitizer( 'foo', 'div[data]' );
|
||||
$sanitizer->sanitize( CSSParser::newFromString( '.not-empty { }' )->parseStylesheet() );
|
||||
$this->assertSame( [], $sanitizer->getSanitizationErrors() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideOnRegistration
|
||||
* @param array $textModelsToParse
|
||||
|
|
Loading…
Reference in a new issue