function SmartDefaultSettingsTest::providerSurplusScore
Same name in other branches
- 9 core/modules/ckeditor5/tests/src/Unit/SmartDefaultSettingsTest.php \Drupal\Tests\ckeditor5\Unit\SmartDefaultSettingsTest::providerSurplusScore()
- 10 core/modules/ckeditor5/tests/src/Unit/SmartDefaultSettingsTest.php \Drupal\Tests\ckeditor5\Unit\SmartDefaultSettingsTest::providerSurplusScore()
Data provider for testing computeSurplusScore().
Return value
\Generator
File
-
core/
modules/ ckeditor5/ tests/ src/ Unit/ SmartDefaultSettingsTest.php, line 42
Class
- SmartDefaultSettingsTest
- @coversDefaultClass \Drupal\ckeditor5\SmartDefaultSettings @group ckeditor5
Namespace
Drupal\Tests\ckeditor5\UnitCode
public static function providerSurplusScore() : \Generator {
$needed = new HTMLRestrictions([
'code' => FALSE,
]);
(yield 'surplus: 1 tag, 1 attribute, 1 attribute with wildcard restriction' => [
HTMLRestrictions::fromString('<pre> <code class="language-*">'),
$needed,
1001010,
]);
(yield 'surplus: 1 tag, 1 attribute, 2 allowed attribute values' => [
HTMLRestrictions::fromString('<code class="language-php language-js">'),
$needed,
1002,
]);
(yield 'surplus: 2 attributes, 4 allowed attribute values' => [
// cSpell:disable-next-line
HTMLRestrictions::fromString('<code class="language-php language-js" data-library="highlightjs something">'),
$needed,
2004,
]);
(yield 'surplus: 1 any attribute allowed' => [
HTMLRestrictions::fromString('<code *>'),
$needed,
100000,
]);
(yield 'surplus: 1 attribute, 1 attribute any value allowed' => [
HTMLRestrictions::fromString('<code class>'),
$needed,
1100,
]);
(yield 'surplus: 1 tag, 2 wildcard attributes, 2 attributes, 3 attributes any value allowed, 1 wildcard allowed attribute value ' => [
HTMLRestrictions::fromString('<pre> <code data-config-* data-options-* data-highlight-library class="language-*">'),
$needed,
1022310,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.