Skip to content
Snippets Groups Projects
Commit 5dc8886e authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-4656 Add test function to make sure anchor button in active toolbar

parent 5443083c
No related branches found
No related tags found
3 merge requests!433ISTWCMS-6296 Create test for all event dates test cases,!136Istwcms 4725 ebremner config sync,!120ISTWCMS-4656 Add test function to make sure anchor button in active toolbar
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\Tests\uw_base_profile\Functional; namespace Drupal\Tests\uw_base_profile\Functional;
use Drupal\Component\Serialization\Json;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase; use Drupal\Tests\BrowserTestBase;
...@@ -93,6 +94,7 @@ class UwWcmsBasicTest extends BrowserTestBase { ...@@ -93,6 +94,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->mediaTypesTest(); $this->mediaTypesTest();
$this->redirectsTest(); $this->redirectsTest();
$this->uwLdapTest(); $this->uwLdapTest();
$this->ckeditorButtonsTest();
} }
/** /**
...@@ -1895,4 +1897,27 @@ class UwWcmsBasicTest extends BrowserTestBase { ...@@ -1895,4 +1897,27 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->assertEquals($test_in, $test_out, 'formatResults() gives correct results.'); $this->assertEquals($test_in, $test_out, 'formatResults() gives correct results.');
} }
/**
* Tests for CKEditor buttons.
*/
public function ckeditorButtonsTest() {
$this->drupalLogin($this->drupalUsers['administrator']);
// Create function to encode HTML as we expect it in drupalSettings.
$json_encode = function ($html) {
return trim(Json::encode($html), '"');
};
$textformats = [
'uw_tf_standard',
'uw_tf_full_html',
'uw_tf_basic',
];
foreach ($textformats as $textformat) {
$this->drupalGet('admin/config/content/formats/manage/' . $textformat);
$this->assertSession()->statusCodeEquals(200);
$this->assertRaw($json_encode('<li data-drupal-ckeditor-button-name="Anchor" class="ckeditor-button"><a href="#" role="button" title="Anchor" aria-label="Anchor">'));
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment