public function SmartDefaultSettingsTest::providerSurplusScore in Drupal 10
Data provider for testing computeSurplusScore().
Return value
\Generator
File
- core/
modules/ ckeditor5/ tests/ src/ Unit/ SmartDefaultSettingsTest.php, line 37
Class
- SmartDefaultSettingsTest
- @coversDefaultClass \Drupal\ckeditor5\SmartDefaultSettings @group ckeditor5
Namespace
Drupal\Tests\ckeditor5\UnitCode
public 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,
]);
}