function SourceEditingTest::providerAllowingExtraAttributes
Same name in other branches
- 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\SourceEditingTest::providerAllowingExtraAttributes()
- 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\SourceEditingTest::providerAllowingExtraAttributes()
Data provider for ::testAllowingExtraAttributes().
Return value
array The test cases.
File
-
core/
modules/ ckeditor5/ tests/ src/ FunctionalJavascript/ SourceEditingTest.php, line 224
Class
- SourceEditingTest
- @coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\SourceEditing @covers \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::getCKEditor5PluginConfig() @group ckeditor5 @internal
Namespace
Drupal\Tests\ckeditor5\FunctionalJavascriptCode
public function providerAllowingExtraAttributes() : array {
$general_test_case_markup = '<div class="llama" data-llama="🦙"><p data-llama="🦙">The <a href="https://example.com/pirate" class="button" data-grammar="subject">pirate</a> is <a href="https://example.com/irate" class="use-ajax" data-grammar="adjective">irate</a>.</p></div>';
return [
'no extra attributes allowed' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate">pirate</a> is <a href="https://example.com/irate">irate</a>.</p></div>',
],
// Common case: any attribute that is not `style` or `class`.
'<a data-grammar="subject">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate" data-grammar="subject">pirate</a> is <a href="https://example.com/irate">irate</a>.</p></div>',
'<a data-grammar="subject">',
],
'<a data-grammar="adjective">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate">pirate</a> is <a href="https://example.com/irate" data-grammar="adjective">irate</a>.</p></div>',
'<a data-grammar="adjective">',
],
'<a data-grammar>' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate" data-grammar="subject">pirate</a> is <a href="https://example.com/irate" data-grammar="adjective">irate</a>.</p></div>',
'<a data-grammar>',
],
// Edge case: `class`.
'<a class="button">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a class="button" href="https://example.com/pirate">pirate</a> is <a href="https://example.com/irate">irate</a>.</p></div>',
'<a class="button">',
],
'<a class="use-ajax">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate">pirate</a> is <a class="use-ajax" href="https://example.com/irate">irate</a>.</p></div>',
'<a class="use-ajax">',
],
'<a class>' => [
$general_test_case_markup,
'<div class="llama"><p>The <a class="button" href="https://example.com/pirate">pirate</a> is <a class="use-ajax" href="https://example.com/irate">irate</a>.</p></div>',
'<a class>',
],
// Edge case: $text-container wildcard with additional
// attribute.
'<$text-container data-llama>' => [
$general_test_case_markup,
'<div class="llama" data-llama="🦙"><p data-llama="🦙">The <a href="https://example.com/pirate">pirate</a> is <a href="https://example.com/irate">irate</a>.</p></div>',
'<$text-container data-llama>',
],
// Edge case: $text-container wildcard with stricter attribute
// constrain.
'<$text-container class="not-llama">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate">pirate</a> is <a href="https://example.com/irate">irate</a>.</p></div>',
'<$text-container class="not-llama">',
],
// Edge case: wildcard attribute names:
// - prefix, f.e. `data-*`
// - infix, f.e. `*gramma*`
// - suffix, f.e. `*-grammar`
'<a data-*>' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate" data-grammar="subject">pirate</a> is <a href="https://example.com/irate" data-grammar="adjective">irate</a>.</p></div>',
'<a data-*>',
],
'<a *gramma*>' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate" data-grammar="subject">pirate</a> is <a href="https://example.com/irate" data-grammar="adjective">irate</a>.</p></div>',
'<a *gramma*>',
],
'<a *-grammar>' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate" data-grammar="subject">pirate</a> is <a href="https://example.com/irate" data-grammar="adjective">irate</a>.</p></div>',
'<a *-grammar>',
],
// Edge case: concrete attribute with wildcard class value.
'<a class="use-*">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate">pirate</a> is <a class="use-ajax" href="https://example.com/irate">irate</a>.</p></div>',
'<a class="use-*">',
],
// Edge case: concrete attribute with wildcard attribute value.
'<a data-grammar="sub*">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate" data-grammar="subject">pirate</a> is <a href="https://example.com/irate">irate</a>.</p></div>',
'<a data-grammar="sub*">',
],
// Edge case: `data-*` with wildcard attribute value.
'<a data-*="sub*">' => [
$general_test_case_markup,
'<div class="llama"><p>The <a href="https://example.com/pirate" data-grammar="subject">pirate</a> is <a href="https://example.com/irate">irate</a>.</p></div>',
'<a data-*="sub*">',
],
// Edge case: `style`.
// @todo https://www.drupal.org/project/drupal/issues/3304832
// Edge case: `type` attribute on lists.
// @todo Remove in https://www.drupal.org/project/drupal/issues/3274635.
'no numberedList-related additions to the Source Editing configuration' => [
'<ol type="A"><li>foo</li><li>bar</li></ol>',
'<ol><li>foo</li><li>bar</li></ol>',
],
'<ol type>' => [
'<ol type="A"><li>foo</li><li>bar</li></ol>',
'<ol type="A"><li>foo</li><li>bar</li></ol>',
'<ol type>',
],
'<ol type="A">' => [
'<ol type="A"><li>foo</li><li>bar</li></ol>',
'<ol type="A"><li>foo</li><li>bar</li></ol>',
'<ol type="A">',
],
'no bulletedList-related additions to the Source Editing configuration' => [
'<ul type="circle"><li>foo</li><li>bar</li></ul>',
'<ul><li>foo</li><li>bar</li></ul>',
],
'<ul type>' => [
'<ul type="circle"><li>foo</li><li>bar</li></ul>',
'<ul type="circle"><li>foo</li><li>bar</li></ul>',
'<ul type>',
],
'<ul type="circle">' => [
'<ul type="circle"><li>foo</li><li>bar</li></ul>',
'<ul type="circle"><li>foo</li><li>bar</li></ul>',
'<ul type="circle">',
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.