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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balloon Toolbar API is now available in plugin.init() #1402

Merged
merged 4 commits into from
Jan 11, 2018
Merged

Balloon Toolbar API is now available in plugin.init() #1402

merged 4 commits into from
Jan 11, 2018

Conversation

jacekbogdanski
Copy link
Member

@jacekbogdanski jacekbogdanski commented Jan 4, 2018

What is the purpose of this pull request?

Feature

Does your PR contain necessary tests?

All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

Added balloon toolbar api context initialization to plugin.beforeInit().

Closes #1346

#1346: Fixed: Balloon Toolbar API should be exposed in plugin.init() of a required plugin.

@jacekbogdanski jacekbogdanski changed the title T/1346 Balloon Toolbar API is now available in plugin.init() Jan 4, 2018
@jacekbogdanski jacekbogdanski force-pushed the t/1346 branch 2 times, most recently from bd22e0a to da89f78 Compare January 4, 2018 14:06
@dkonopka dkonopka requested review from wojtekw92 and removed request for wojtekw92 January 4, 2018 14:55
@mlewand mlewand requested a review from f1ames January 8, 2018 10:16
Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

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

The fix looks good and works fine in all browsers 👍
Just few small changes needed in tests.

if ( !cssLoaded ) {
// Load fallback styles.
CKEDITOR.document.appendStyleSheet( this.path + 'skins/default.css' );
CKEDITOR.document.appendStyleSheet( this.path + 'skins/' + CKEDITOR.skin.name + '/balloontoolbar.css' );
cssLoaded = true;
}

// enable context api in plugin.init()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is plugin.beforeInit not plugin.init. I suggest chanigng the comment to something like (also remember about referencing issues in the comment):

Initialize 'contextManager' so it is available in 'plugin.init' method for other plugins (#1346).

@@ -0,0 +1,21 @@
<textarea id="editor1" cols="10" rows="10"></textarea>
Copy link
Contributor

Choose a reason for hiding this comment

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

The convention is to just skip spaces or any - and _ in test names, so this file should be named contextapi.html (same for md file).

CKEDITOR.replace( 'editor1', {
extraPlugins: 'testplugin'
} );

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary space, I mean empty line 😄

@@ -0,0 +1,11 @@
@bender-ui: collapsed
@bender-tags: 4.8.0, feature, 1346, balloontoolbar
Copy link
Contributor

Choose a reason for hiding this comment

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

As 4.8.0 was already release, the target version of this fix is 4.8.1.

@@ -0,0 +1,11 @@
@bender-ui: collapsed
@bender-tags: 4.8.0, feature, 1346, balloontoolbar
@bender-ckeditor-plugins: wysiwygarea,toolbar,undo,basicstyles,notification,floatingspace,sourcearea,list,link
Copy link
Contributor

Choose a reason for hiding this comment

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

When creating tests, remember to include plugins which are only necessary for the tests to pass/fail. In this case, you could just skip all plugins as there is not user interaction with the editor.
However, it is better to make editor properly load (so it doesn't looks like test is broken) so you could use wysiwygarea,toolbar,basicstyles.


Open console and check if `editor.balloonToolbars should be initialized` error has been thrown.

If not, test passed.
Copy link
Contributor

Choose a reason for hiding this comment

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

When creating tests description you may try to follow our common pattern for tests scenarios like:

image

@@ -0,0 +1,26 @@
/* bender-tags: balloontoolbar, 1346, context */
Copy link
Contributor

Choose a reason for hiding this comment

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

I think context it to detailed, I would go with editor, balloontoolbar, 1346.

( function() {
'use strict';

bender.editor = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

bender.editor = {}; creates default (based on bender tags) CKEditor instance, before any tests are executed. As you are already creating an editor instance in test (bender.editorBot.create) you may simply remove this line.

} );

bender.editorBot.create(
{ name: 'editor2', config: { extraPlugins: 'testplugin' } }, function noop( ) {} );
Copy link
Contributor

Choose a reason for hiding this comment

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

This line should be indented (or you may simply put everything in the one line). Also I don't see any benefit in naming this noop function. You may simply use bender.editorBot.create( { ... }, function() {} );.

@@ -0,0 +1,26 @@
/* bender-tags: balloontoolbar, 1346, context */
Copy link
Contributor

Choose a reason for hiding this comment

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

plugin.js is not very descriptive name for test suite, maybe something like contextinit.js (well, it will be nice if the naming will be consistent with manual test name, so you could go with contextapi)?

@f1ames
Copy link
Contributor

f1ames commented Jan 8, 2018

Could you also add suggested changelog entry?

@jacekbogdanski jacekbogdanski requested a review from f1ames January 9, 2018 10:16
Copy link
Contributor

@f1ames f1ames 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. Just one more thing, when it comes to changelog entry it should be added directly to CHANGES.md (check out our dev-docs) not to PR description (I recall I told you it should be added to description, sorry for misguiadance 😅 ).

Please add changelog entry to CHANGES.md and we are ready to go.

@jacekbogdanski jacekbogdanski requested a review from f1ames January 10, 2018 14:41
Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@f1ames
Copy link
Contributor

f1ames commented Jan 11, 2018

Rebased on latest master, adjusted and moved changelog entry to API Changes section (according to changelog:api label).

@f1ames f1ames merged commit 393ab9c into master Jan 11, 2018
@f1ames f1ames deleted the t/1346 branch January 11, 2018 09:51
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.

2 participants