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

Check if document.createTextRange exists for IE in 'select all' plugin. #562

Merged
merged 7 commits into from
Jul 6, 2017

Conversation

wojtekw92
Copy link
Contributor

@wojtekw92 wojtekw92 commented Jun 26, 2017

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

selectall plugin test already exists.

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

selectall plugin is now checking if createTextRange method exists in IE.

Closes #545

@mlewand mlewand requested review from f1ames and mlewand June 26, 2017 10:54
Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

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

There are no unit and manual test. It's crucial to have them.

</div>

<script>
if ( ( CKEDITOR.env.ie && CKEDITOR.env.version < 11 ) || bender.tools.env.mobile ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is CKEDITOR.env.edge flag could be used here.

Copy link
Contributor

Choose a reason for hiding this comment

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

As this is only Edge issue we decided that test should be ignored for other browsers.


**Procedure:**

1. Change view to source code
Copy link
Contributor

Choose a reason for hiding this comment

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

Source mode.

**Procedure:**

1. Change view to source code
2. click `select all` button
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep the list items consistent. It should start with uppercase and end with a dot.


**Expected result:**

* The whole code should be selected
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use content instead of code. Also dot on the end of the sentence missing.

@@ -0,0 +1,12 @@
@bender-ui: collapsed
@bender-tags: tc, 545, 2564, 4.7.1, bug
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to put TP issue number (2564).

@@ -45,6 +45,34 @@
acceptableResults,
bender.tools.html.prepareInnerHtmlForComparison( bender.tools.selection.getWithHtml( editor ), htmlMatchingOpts )
);
},

'test selectall in source view': function() {
Copy link
Contributor

@f1ames f1ames Jul 4, 2017

Choose a reason for hiding this comment

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

The test look s quite complex, I would simplify it:

  • The eventsRecorder is not needed, this test should check (according to its description) if selectAll works in source mode, no need to check for additional events.
  • Editor creation can be moved to bender.editors = { ... }, like:
    editorSource: {
			name: 'test_source_mode',
			startupData: '<p>foo</p><p>bar</p>',
			config: {
				startupMode: 'source'
			}
		}
  • And then test itself could be simplified to something like:
	var editor = this.editors.editorSource;

	editor.execCommand( 'selectAll' );

	assert.areSame( 'source', editor.mode, 'editor.mode' );
	if ( CKEDITOR.env.ie && CKEDITOR.env.version <= 8 ) {
		assert.areSame( document.selection.createRange().text.length, 20 );
	} else {
		assert.areSame( CKEDITOR.document.getActive().$.selectionStart, 0 );
		assert.areSame( CKEDITOR.document.getActive().$.selectionEnd, 20 );
	}

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 Jul 6, 2017

@mlewand Please check if all your review requests got solved.

@mlewand
Copy link
Contributor

mlewand commented Jul 6, 2017

@f1ames I'm good with it.

@mlewand mlewand merged commit 06c2063 into master Jul 6, 2017
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.

3 participants