Problem/Motivation
In #2994699-52: Create a CKEditor plugin to select and embed a media item from the Media Library, I raised some questions about CKEditorTestTrait (which is added by that issue). In his reply, @Wim Leers felt that we should defer those changes to a follow-up. I agree with that, so this is said follow-up.
Proposed resolution
Make the changes to CKEditorTestTrait outlined in #2994699-52: Create a CKEditor plugin to select and embed a media item from the Media Library's first few points.
Remaining tasks
Do it.
User interface changes
None.
API changes
A trait used by tests will have some internal refactoring, but no breaking API changes are expected.
Data model changes
None.
Release notes snippet
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3073261-4.patch | 4.64 KB | oknate |
| #4 | 3073261--interdiff-3-4.txt | 3.25 KB | oknate |
Comments
Comment #2
oknateCopying over feedback from #2994699-52: Create a CKEditor plugin to select and embed a media item from the Media Library
1.
This parameter description needs to start with (optional) and state that it defaults to 'edit-body-0-value'.
2.
It might be preferable for us to use $this->assertSession()->assertJsCondition() here, since that will cause the test to fail (and rightfully so), if CKEditor is not ready in time.
3.
What if there is more than one CKEditor instance on the page? Maybe this method should accept an $index parameter, defaulting to 0, to choose which CKEditor to work with. And then it can use that index to generate a unique name, like "ckeditor_0". Alternately, we could have this method loop through every CKEditor frame (getElementsByClassName() returns a set of elements anyway) and assign a unique one to each: "ckeditor_0", "ckeditor_1", etc.
4.
Again, what if there are multiple CKEditor instances?
Comment #3
oknateThis doesn't need to be postponed anymore, now that #2994699: Create a CKEditor plugin to select and embed a media item from the Media Library has landed.
Comment #4
oknateComment #5
oknateCleanup.
Comment #6
oknateNote: This was backported to 8.7 yesterday: #3076609: \Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest fails on Sqlite, so if this issue is resolved the changes should go into that branch too.
Comment #7
oknateComment #9
jhedstromThis looks good to me. Most of the changes were initially from #2994699-52: Create a CKEditor plugin to select and embed a media item from the Media Library, so this has been reviewed there too :)
Comment #11
oknateSetting back to RTBC, it looks like the failure was unrelated. I reran testing 8.9 against patch #4 and it was all green.
Comment #13
alexpottCrediting @Wim Leers and @phenaproxima for review on the other issue.
Comment #14
alexpottCommitted and pushed b28a392ece to 9.0.x and 5a4dd40a42 to 8.9.x and 1bce7388c9 to 8.8.x. Thanks!
Backported to 8.8.x as a test-only improvement.