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

T/515 Prevent of throwing an error on mouse move #527

Merged
merged 8 commits into from
Jun 20, 2017
Merged

T/515 Prevent of throwing an error on mouse move #527

merged 8 commits into from
Jun 20, 2017

Conversation

beatadelura
Copy link
Contributor

@beatadelura beatadelura commented Jun 19, 2017

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

Yes

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

Prevent of throwing an error in the console if target is undefined.


Closes #515
Closes #528

@beatadelura beatadelura added browser:chrome The issue can only be reproduced in the Chrome browser. type:bug A bug. labels Jun 19, 2017
@@ -0,0 +1,20 @@
@bender-ui: collapsed
Copy link
Contributor

Choose a reason for hiding this comment

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

File name rather than mouseover.md should also mention scroll, so scrollmouseover.md?


1. Open developer console.
2. Focus on editor.
3. Scroll down/up.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can 3 and 4 be combined? Write that the editor should be scrolled using a mouse, so this will automatically force mousing over.

var cell = target && target.getAscendant( { td: 1, th: 1 }, true ),
table = target && target.getAscendant( 'table', true );
}

Copy link
Contributor

@mlewand mlewand Jun 20, 2017

Choose a reason for hiding this comment

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

You can check if object is wrapped on HTMLElement either by checking if getName method exists or by checking type property.

Here it would be simpler to leave the original logic untouched, but just to do an "early return", by adding

if ( !evt.data.getTarget().getName ) {
	return;
}

At the beginning of the function.

That will be safer way of fixing it. So please revert the changes in this file, and just do an early return.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, it's a better solution :) Thanks!

} ) );
} );

assert.pass();
Copy link
Contributor

Choose a reason for hiding this comment

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

In that construction the test would always pass despite having exception thrown.

You should put assert.pass(); after the editor.document.fire call.

var tests = {
// #515
'test mouseover on scrollbar': function( editor ) {
var bot = bender.editors.scrollable,
Copy link
Contributor

Choose a reason for hiding this comment

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

Bot is a second argument passed to test case, so you should just use argument.


var tests = {
// #515
'test mouseover on scrollbar': function( editor ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Bot is passed as an argument here, see comment 2 lines below.

'use strict';

bender.editors = {
scrollable: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename this property to classic and add a divarea editor too, see https://github.com/ckeditor/ckeditor-dev/blob/b8d9a84/tests/core/editable/readonly.js#L36-L41

@@ -51,5 +51,4 @@
</table>
</div>


Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not needed and should be reverted.

@beatadelura
Copy link
Contributor Author

@mlewand PTAL

@mlewand mlewand removed browser:chrome The issue can only be reproduced in the Chrome browser. type:bug A bug. labels Jun 20, 2017
var bot = bender.editors.scrollable,
editable = bot.editable();
'test mouseover on scrollbar': function( editor, bot ) {
// var bot = bender.editors.classic,
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't comment the code, just remove it 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooops..

@@ -6,20 +6,21 @@
'use strict';

bender.editors = {
scrollable: {
classic: {
Copy link
Contributor

Choose a reason for hiding this comment

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

What i meant here is to define two separate editors. One classic (basically same definition as it was before, but different name). And the other one, called divarea with divarea added to extraPlugins.

@@ -6,8 +6,7 @@

1. Open developer console.
2. Focus on editor.
3. Scroll down/up.
4. Mouse over scrollbar.
3. Use mouse to scroll editor and point the cursor over the scrollbar.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence is not clear enough. Enough would be some thing "Use mouse to scroll down the editor." - and simple as that. It implies that there will be cursor over the scroll bar.

@mlewand
Copy link
Contributor

mlewand commented Jun 20, 2017

LGTM

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