Skip to content

Commit

Permalink
Add unit and manual tests to format menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Samsel committed Jul 6, 2017
1 parent 53933d2 commit 28e5575
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/plugins/format/manual/preserveformatafterclick.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<textarea name="ed" id="editor" cols="30" rows="10">
Hello world
</textarea>

<script>
CKEDITOR.replace( 'editor' );
</script>
10 changes: 10 additions & 0 deletions tests/plugins/format/manual/preserveformatafterclick.md
Original file line number Diff line number Diff line change
@@ -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.
26 changes: 25 additions & 1 deletion tests/plugins/format/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,29 @@ bender.test( {
bot.setHtmlWithSelection( '<fieldset><legend>^foo</legend><form>bar</form></fieldset>' );
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( '<p>^foo</p>' );
// 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( '<h1>^foo</h1>', 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( '<h1>^foo</h1>', bot.htmlWithSelection(), 'applied h1 block style' );
} );
} );
}
} );

} );

0 comments on commit 28e5575

Please sign in to comment.