Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests #127

Merged
merged 11 commits into from
Jan 4, 2022
Merged

Fix failing tests #127

merged 11 commits into from
Jan 4, 2022

Conversation

sculpt0r
Copy link
Contributor

@sculpt0r sculpt0r commented Dec 1, 2021

First of all, I started with defensive if on the fragile CKEDITOR in the observer (main repository). However, not all tests passed.

The most damaged makes setup editor from CDN via editorUrl props. So I moved it to the last position, so no other tests will fail because of it: 844da89

I have a problem with not incoming events from the main editor code, like ready and I decided that I change an assertion, so it shows if the event was invoked at all, rather than verify only if it was one time. Because no calls of the spy in the test - means that some event wasn't raised at a deep level, whereas multiple calls tell us about problems in integration commons: c3fc2a1

Based debug in karma run, I found that the failing test should use correct CKEDITOR build try to load some assets from the different origin that it was set via editorUrl. And it appears that during the test we are deleting window.CKEDITOR but there are still scripts added via 'namespaceloader'. So I decided to remove all ckeditor.js scripts-like along with deleting global window.CKEDITOR. That fixes the last test assertion problem: fdb6de3 However, I'm still thinking, that if you load CKE4 from the CDN via editorUrl and then, you check editorInstance.config.basePath - it's different. It has good parts, but that may be something worth checking with ckeditor/ckeditor4#4761.

I was able to fix the issue with MutationObserver in vue tests, thanks to also new config option: https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-observableParent It tells the observer, which node should be checked and in case of changes - determine if there is an CKE4 instance inside. If we provide an immutable element, then observer callback will never be run: a745009

Finally, I have to adjust the code for IE 馃槩 : 9b6de22

Closes #124

@sculpt0r sculpt0r changed the title [WIP] Fix failing tests Fix failing tests Dec 1, 2021
@sculpt0r sculpt0r marked this pull request as ready for review December 1, 2021 12:51
@jacekbogdanski jacekbogdanski self-assigned this Dec 7, 2021
tests/component.js Outdated Show resolved Hide resolved
Copy link
Member

@jacekbogdanski jacekbogdanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice it earlier but it looks like we lost 100% test coverage somehow. Could you take a look @sculpt0r ?
image


deleteCkeditorScripts();

return createComponent( { editorUrl: basePath + 'ckeditor.js' } ).then( (comp) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return createComponent( { editorUrl: basePath + 'ckeditor.js' } ).then( (comp) => {
return createComponent( { editorUrl: basePath + 'ckeditor.js' } ).then( ( comp ) => {

const scripts = Array.from( document.querySelectorAll( 'script' ) );
const ckeditorScripts = scripts.filter( scriptElement => {
return scriptElement.src.indexOf( 'ckeditor.js' ) > -1;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
});
} );

@sculpt0r
Copy link
Contributor Author

sculpt0r commented Dec 13, 2021

The gap in coverage appears due to the fact - that now there is no editor created with empty config. Because I added observableParent to each config. I'll figure it out.

@sculpt0r
Copy link
Contributor Author

@jacekbogdanski

  • adjusted tests so after each test namespace clean up is made
  • added test for creating editor with the default config. I put it at the end - so no other tests fail because of it. It doesn't look well... I left a comment above the test. However with Use delayIfDetached config for editor set to true by default聽#102 the tests will be touched again - so maybe it will be a good time to look at the tests with config again.

@github-actions
Copy link

It's been a while since we last heard from you. We are marking this pull request as stale due to inactivity. Please provide the requested feedback or the pull request will be closed after next 7 days.

@github-actions github-actions bot added the stale The issue / PR will be closed within the next 7 days of inactivity. label Dec 22, 2021
@sculpt0r sculpt0r removed the stale The issue / PR will be closed within the next 7 days of inactivity. label Dec 27, 2021
Copy link
Member

@jacekbogdanski jacekbogdanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 馃憤馃徎 We can handle tests related to delayed initialization in the dedicated PR.

@jacekbogdanski jacekbogdanski merged commit 3e6af90 into master Jan 4, 2022
@jacekbogdanski jacekbogdanski deleted the t/124-fix-test branch January 4, 2022 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing tests in CKEditor 4.17.1
2 participants