.../FunctionalJavascript/CKEditorIntegrationTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php b/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php index 8bde4b4..c0e19e9 100644 --- a/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php +++ b/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php @@ -177,7 +177,9 @@ class CKEditorIntegrationTest extends EntityEmbedTestBase { // operational entity embedding experience in the text editor. $this->drupalGet('/node/add/page'); $this->waitForEditor(); + $this->assertSame(1, $this->getCkeditorUndoSnapshotCount()); $this->getSession()->executeScript("CKEDITOR.instances['edit-body-0-value'].setData('

Goodbye world!

');"); + $this->assertSame(2, $this->getCkeditorUndoSnapshotCount()); $this->assignNameToCkeditorIframe(); $this->getSession()->switchToIFrame('ckeditor'); $this->assertSession()->pageTextNotContains('Billy Bones'); @@ -197,6 +199,7 @@ class CKEditorIntegrationTest extends EntityEmbedTestBase { $this->getSession()->switchToIFrame('ckeditor'); $this->assertSession()->pageTextContains('Billy Bones'); $this->getSession()->switchToIFrame(); + $this->assertSame(3, $this->getCkeditorUndoSnapshotCount()); $this->getSession() ->getPage() ->find('css', 'input[name="title[0][value]"]') @@ -280,4 +283,18 @@ class CKEditorIntegrationTest extends EntityEmbedTestBase { $this->getSession()->switchToIFrame(); } + /** + * Get a CKEditor instance's undo snapshot count. + * + * @param string $instance_id + * The CKEditor instance ID. + * + * @return int + * The undo snapshot count. + */ + protected function getCkeditorUndoSnapshotCount($instance_id = 'edit-body-0-value') { + $this->waitForEditor($instance_id); + return $this->getSession()->evaluateScript("CKEDITOR.instances['$instance_id'].undoManager.snapshots.length"); + } + }