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
......@@ -2,6 +2,7 @@
namespace Drupal\Tests\uw_base_profile\Functional;
use Drupal\Component\Serialization\Json;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
......@@ -93,6 +94,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->mediaTypesTest();
$this->redirectsTest();
$this->uwLdapTest();
$this->ckeditorButtonsTest();
}
/**
......@@ -1895,4 +1897,27 @@ class UwWcmsBasicTest extends BrowserTestBase {
$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">'));
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment