From b37821a42f6478f9b6624409ed20574995656940 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 5 Dec 2018 16:31:14 +0100 Subject: [PATCH 1/4] Tests: added unit test. --- tests/plugins/table/validate.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/plugins/table/validate.js diff --git a/tests/plugins/table/validate.js b/tests/plugins/table/validate.js new file mode 100644 index 00000000000..8b47784d29e --- /dev/null +++ b/tests/plugins/table/validate.js @@ -0,0 +1,20 @@ +/* bender-tags: editor */ +/* bender-ckeditor-plugins: dialogadvtab,table,toolbar,wysiwygarea */ + +( function() { + 'use strict'; + + bender.editor = {}; + + bender.test( { + // #2650 + 'test validator when global scope is polluted': function() { + this.editorBot.dialog( 'table', function( dialog ) { + var spy = window.getValue = sinon.spy(); + + dialog.getButton( 'ok' ).click(); + assert.isFalse( spy.called ); + } ); + } + } ); +} )(); From aa6876a07944ab85c4ecb004413f30c5cd960cb1 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 5 Dec 2018 16:37:34 +0100 Subject: [PATCH 2/4] Tests: added manual test. --- tests/plugins/table/manual/dialogvalidate.html | 6 ++++++ tests/plugins/table/manual/dialogvalidate.md | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/plugins/table/manual/dialogvalidate.html create mode 100644 tests/plugins/table/manual/dialogvalidate.md diff --git a/tests/plugins/table/manual/dialogvalidate.html b/tests/plugins/table/manual/dialogvalidate.html new file mode 100644 index 00000000000..04b14ef326b --- /dev/null +++ b/tests/plugins/table/manual/dialogvalidate.html @@ -0,0 +1,6 @@ + + + diff --git a/tests/plugins/table/manual/dialogvalidate.md b/tests/plugins/table/manual/dialogvalidate.md new file mode 100644 index 00000000000..c94742569a3 --- /dev/null +++ b/tests/plugins/table/manual/dialogvalidate.md @@ -0,0 +1,15 @@ +@bender-tags: 4.11.2, bug, 2650 +@bender-ui: collapsed +@bender-ckeditor-plugins: wysiwygarea,toolbar,table,sourcearea,dialogadvtab + +1. Open table dialog. +2. Press `ok`. + +## Expected + +Table is inserted into editor. + +## Unexpected + +Alert popups with information: +`Number of rows must be a number greater than 0.` From 632deebed8dae2b3c81ebd22bd2cd00e810ba29f Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 5 Dec 2018 16:38:37 +0100 Subject: [PATCH 3/4] Added proper context to dialog.validate.integer call. --- plugins/table/dialogs/table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/table/dialogs/table.js b/plugins/table/dialogs/table.js index ae1237da69d..3cadaee45a0 100755 --- a/plugins/table/dialogs/table.js +++ b/plugins/table/dialogs/table.js @@ -34,7 +34,7 @@ function validatorNum( msg ) { return function() { var value = this.getValue(), - pass = !!( CKEDITOR.dialog.validate.integer()( value ) && value > 0 ); + pass = !!( CKEDITOR.dialog.validate.integer().call( this, value ) && value > 0 ); if ( !pass ) { alert( msg ); // jshint ignore:line From 41db6c6e503df1d7be34d613ffdb772a9d58a1d4 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 5 Dec 2018 17:07:29 +0100 Subject: [PATCH 4/4] Changelog: added entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 371271fb9b0..baeaddb0c85 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,7 @@ Fixed Issues: * [#2451](https://github.com/ckeditor/ckeditor-dev/issues/2451): Fixed: The [Remove Format](https://ckeditor.com/cke4/addon/removeformat) changes selection. * [#2546](https://github.com/ckeditor/ckeditor-dev/issues/2546): Fixed: Separator in toolbar moves when buttons are focused. * [#2506](https://github.com/ckeditor/ckeditor-dev/issues/2506): Fixed: [Enhanced Image](https://ckeditor.com/cke4/addon/image2) throws type error when empty figure tag with 'image' class is upcasted. +* [#2650](https://github.com/ckeditor/ckeditor-dev/issues/2650): Fixed: [Table](https://ckeditor.com/cke4/addon/table) dialog validator fails when function `getValue` is defined in global scope. Other Changes: