summaryrefslogtreecommitdiffstats
path: root/tests/src/FunctionalJavascript/LinkitFormatAdminTest.php
diff options
context:
space:
mode:
authoranon2016-07-08 21:46:23 (GMT)
committerEmil Stjerneman2016-07-08 21:46:23 (GMT)
commitee79aedb38f974f55bcc2f5feaa859925926aa87 (patch)
tree472d11f7be2f25ebc4cec5a1e789344777903f20 /tests/src/FunctionalJavascript/LinkitFormatAdminTest.php
parentd0fcf4871e0ae31a0b28bb7cc36729c070ec923c (diff)
Issue #2751301 by anon: Handle the new data- attributes for text formats with filter_html
Diffstat (limited to 'tests/src/FunctionalJavascript/LinkitFormatAdminTest.php')
-rw-r--r--tests/src/FunctionalJavascript/LinkitFormatAdminTest.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/src/FunctionalJavascript/LinkitFormatAdminTest.php b/tests/src/FunctionalJavascript/LinkitFormatAdminTest.php
new file mode 100644
index 0000000..56e7e77
--- /dev/null
+++ b/tests/src/FunctionalJavascript/LinkitFormatAdminTest.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace Drupal\Tests\linkit\FunctionalJavascript;
+
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+
+/**
+ * Tests the linkit alterations on the text format forms.
+ *
+ * @group linkit
+ */
+class LinkitFormatAdminTest extends JavascriptTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
+ */
+ public static $modules = ['editor', 'filter', 'linkit'];
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ parent::setUp();
+
+ $account = $this->drupalCreateUser([
+ 'administer filters',
+ ]);
+ $this->drupalLogin($account);
+ }
+
+ /**
+ * Tests that linkit filter is toggling the filter_html allowed tags.
+ */
+ public function testToggleLinkitFilter() {
+ $session = $this->getSession();
+ $page = $session->getPage();
+
+ // Go to add filter page.
+ $this->drupalGet('admin/config/content/formats/add');
+ $this->assertSession()->statusCodeEquals(200);
+
+ // Enable the 'Limit allowed HTML tags and correct faulty HTML' filter.
+ $page->findField('filters[filter_html][status]')->check();
+
+ $javascript = "(function (){ return jQuery('p.editor-update-message > strong').text(); })()";
+ $this->assertNotContains('<a href hreflang data-entity-type data-entity-uuid title>', $session->evaluateScript($javascript));
+
+ // Enable the 'Linkit filter' filter.
+ $page->findField('filters[linkit][status]')->check();
+ $this->assertContains('<a href hreflang data-entity-type data-entity-uuid title>', $session->evaluateScript($javascript));
+
+ // Disable the 'Linkit filter' filter.
+ $page->findField('filters[linkit][status]')->uncheck();
+ $this->assertNotContains('<a href hreflang data-entity-type data-entity-uuid title>', $session->evaluateScript($javascript));
+ }
+
+}