From 28e5575cf3758eb626472a79c13c983ec0cd71d4 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 6 Jul 2017 15:20:10 +0200 Subject: [PATCH] Add unit and manual tests to format menu. --- .../manual/preserveformatafterclick.html | 7 +++++ .../format/manual/preserveformatafterclick.md | 10 +++++++ tests/plugins/format/plugin.js | 26 ++++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/plugins/format/manual/preserveformatafterclick.html create mode 100644 tests/plugins/format/manual/preserveformatafterclick.md diff --git a/tests/plugins/format/manual/preserveformatafterclick.html b/tests/plugins/format/manual/preserveformatafterclick.html new file mode 100644 index 00000000000..bcb8886361e --- /dev/null +++ b/tests/plugins/format/manual/preserveformatafterclick.html @@ -0,0 +1,7 @@ + + + diff --git a/tests/plugins/format/manual/preserveformatafterclick.md b/tests/plugins/format/manual/preserveformatafterclick.md new file mode 100644 index 00000000000..d9036b8f167 --- /dev/null +++ b/tests/plugins/format/manual/preserveformatafterclick.md @@ -0,0 +1,10 @@ +@bender-tags: 4.8.0, feature, 584 +@bender-ui: collapsed +@bender-ckeditor-plugins: wysiwygarea, toolbar, format, elementspath, sourcearea + +1. Select text +1. Try to apply multiple times this same format to one selection (different than normal). + +**Expected:** Choosen format should remain this same all the time. + +**Unexpected:** Text format toggle between styled and unstyled (Normal) one. diff --git a/tests/plugins/format/plugin.js b/tests/plugins/format/plugin.js index 1c02918ff8e..0755054b717 100644 --- a/tests/plugins/format/plugin.js +++ b/tests/plugins/format/plugin.js @@ -25,5 +25,29 @@ bender.test( { bot.setHtmlWithSelection( '
^foo
bar
' ); var name = 'Format', combo = ed.ui.get( name ); assert.areSame( CKEDITOR.TRISTATE_DISABLED, combo._.state, 'check state disabled when not in context' ); + }, + + // Drop down format menu should not have possibility to toggle option (#584). + 'test apply format style twice': function() { + var bot = this.editorBot, + editor = this.editor, + name = 'Format', + combo = editor.ui.get( name ); + + bot.setHtmlWithSelection( '

^foo

' ); + // apply format 1st time + assert.areSame( CKEDITOR.TRISTATE_OFF, combo._.state, 'check state OFF' ); + bot.combo( name, function( combo ) { + assert.areSame( CKEDITOR.TRISTATE_ON, combo._.state, 'check state ON when opened' ); + combo.onClick( 'h1' ); + assert.areSame( '

^foo

', bot.htmlWithSelection(), 'applied h1 block style' ); + // apply format 2nd time + bot.combo( name, function( combo ) { + assert.areSame( CKEDITOR.TRISTATE_ON, combo._.state, 'check state ON when opened' ); + combo.onClick( 'h1' ); + assert.areSame( '

^foo

', bot.htmlWithSelection(), 'applied h1 block style' ); + } ); + } ); } -} ); \ No newline at end of file + +} );