From 2fdb658bf3ed3df8bc1cdde1fa26f9df215f1d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarze=CC=A8bski?= Date: Fri, 13 Mar 2020 12:41:54 +0100 Subject: [PATCH] Refresh unit tests. --- tests/plugins/colorbutton/contentcolors.js | 32 +++++++------- tests/plugins/colorbutton/customcolors.js | 44 ++----------------- .../plugins/colorbutton/customcolorsasync.js | 2 +- 3 files changed, 19 insertions(+), 59 deletions(-) diff --git a/tests/plugins/colorbutton/contentcolors.js b/tests/plugins/colorbutton/contentcolors.js index e06fab1da71..4b23b35f0b2 100644 --- a/tests/plugins/colorbutton/contentcolors.js +++ b/tests/plugins/colorbutton/contentcolors.js @@ -1,4 +1,4 @@ -/* bender-tags: editor,colorbutton, 1795 */ +/* bender-tags: editor,colorbutton,1795 */ /* bender-ckeditor-plugins: colorbutton,undo,toolbar,wysiwygarea */ /* bender-include: _helpers/tools.js */ /* global colorHistoryTools */ @@ -6,10 +6,8 @@ ( function() { 'use strict'; - // bender.editor = true; - bender.test( { - 'test color history row exists': function() { + 'test color history exists': function() { bender.editorBot.create( { name: 'editor1' }, function( bot ) { @@ -20,16 +18,16 @@ bot.setHtmlWithSelection( '[

Moo

]' ); txtColorBtn.click( editor ); - assert.isNotNull( colorHistoryTools.findInPanel( '.cke_colorhistory_row', txtColorBtn ), - 'Color history row for txtColor should exist.' ); + assert.isNotNull( colorHistoryTools.findInPanel( '.cke_colorhistory', txtColorBtn ), + 'Color history for txtColor should exist.' ); bgColorBtn.click( editor ); - assert.isNotNull( colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ), - 'Color history row for bgColor should exist.' ); + assert.isNotNull( colorHistoryTools.findInPanel( '.cke_colorhistory', bgColorBtn ), + 'Color history for bgColor should exist.' ); } ); }, - 'test horizontal rule is hidden and row is empty when there are no colors in content': function() { + 'test horizontal rule is visible and row doesn\'t exist when there are no colors in content': function() { bender.editorBot.create( { name: 'editor2' }, function( bot ) { @@ -40,16 +38,16 @@ bot.setHtmlWithSelection( '[

Moo

]' ); txtColorBtn.click( editor ); - assert.isFalse( colorHistoryTools.findInPanel( '.cke_colorhistory_separator', txtColorBtn ).isVisible(), - 'Horizontal rule for txtColor shouldn\'t be visible.' ); - assert.areEqual( 0, colorHistoryTools.findInPanel( '.cke_colorhistory_row', txtColorBtn ).getChildCount(), - 'Row for txtColor should be empty.' ); + assert.isNotNull( colorHistoryTools.findInPanel( 'hr', txtColorBtn ), + 'Horizontal rule for txtColor should be visible.' ); + assert.isNull( colorHistoryTools.findInPanel( '.cke_colorhistory_row', txtColorBtn ), + 'Row for txtColor shouldn\'t exist.' ); bgColorBtn.click( editor ); - assert.isFalse( colorHistoryTools.findInPanel( '.cke_colorhistory_separator', bgColorBtn ).isVisible(), - 'Horizontal rule shouldn\'t be visible.' ); - assert.areEqual( 0, colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ).getChildCount(), - 'Row for bgColor should be empty.' ); + assert.isNotNull( colorHistoryTools.findInPanel( 'hr', bgColorBtn ), + 'Horizontal rule should be visible.' ); + assert.isNull( colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ), + 'Row for bgColor shouldn\'t exist.' ); } ); }, diff --git a/tests/plugins/colorbutton/customcolors.js b/tests/plugins/colorbutton/customcolors.js index 35b17a09ecf..c44cb18d504 100644 --- a/tests/plugins/colorbutton/customcolors.js +++ b/tests/plugins/colorbutton/customcolors.js @@ -9,41 +9,7 @@ bender.editor = true; bender.test( { - 'test color history row exists': function() { - var editor = this.editor, - txtColorBtn = editor.ui.get( 'TextColor' ), - bgColorBtn = editor.ui.get( 'BGColor' ); - - this.editorBot.setHtmlWithSelection( '[

Moo

]' ); - - txtColorBtn.click( editor ); - assert.isNotNull( colorHistoryTools.findInPanel( '.cke_colorhistory_row', txtColorBtn ), - 'Color history row for txtColor should exist.' ); - - bgColorBtn.click( editor ); - assert.isNotNull( colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ), - 'Color history row for bgColor should exist.' ); - }, - - 'test horizontal rule is hidden and row is empty before any color was chosen': function() { - var editor = this.editor, - txtColorBtn = editor.ui.get( 'TextColor' ), - bgColorBtn = editor.ui.get( 'BGColor' ); - - this.editorBot.setHtmlWithSelection( '[

Moo

]' ); - - txtColorBtn.click( editor ); - assert.isFalse( colorHistoryTools.findInPanel( 'hr', txtColorBtn ).isVisible(), 'Horizontal rule shouldn\'t be visible.' ); - assert.areEqual( 0, colorHistoryTools.findInPanel( '.cke_colorhistory_row', txtColorBtn ).getChildCount(), - 'Row should be empty.' ); - - bgColorBtn.click( editor ); - assert.isFalse( colorHistoryTools.findInPanel( 'hr', bgColorBtn ).isVisible(), 'Horizontal rule shouldn\'t be visible.' ); - assert.areEqual( 0, colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ).getChildCount(), - 'Row should be empty.' ); - }, - - 'test horizontal rule is visible and row is not empty after choosing custom text color': function() { + 'test row is not empty after choosing custom text color': function() { var editor = this.editor, txtColorBtn = editor.ui.get( 'TextColor' ); @@ -52,7 +18,6 @@ editor.once( 'dialogHide', function() { txtColorBtn.click( editor ); - assert.isTrue( colorHistoryTools.findInPanel( 'hr', txtColorBtn ).isVisible(), 'Horizontal rule should be visible.' ); assert.areNotEqual( 0, colorHistoryTools.findInPanel( '.cke_colorhistory_row', txtColorBtn ).getChildCount(), 'Row shouldn\'t be empty.' ); } ); @@ -60,7 +25,7 @@ colorHistoryTools.chooseColorFromDialog( editor, txtColorBtn, '#33ff33' ); }, - 'test horizontal rule is visible and row is not empty after choosing custom background color': function() { + 'test row is not empty after choosing custom background color': function() { var editor = this.editor, bgColorBtn = editor.ui.get( 'BGColor' ); @@ -69,8 +34,6 @@ editor.once( 'dialogHide', function() { bgColorBtn.click( editor ); - assert.isTrue( colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ).isVisible(), - 'Horizontal rule should be visible.' ); assert.areNotEqual( 0, colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ).getChildCount(), 'Row shouldn\'t be empty.' ); } ); @@ -87,7 +50,6 @@ bender.tools.setHtmlWithSelection( editor, '

[Moo]

' ); txtColorBtn.click(); - assert.isTrue( colorHistoryTools.findInPanel( 'hr', txtColorBtn ).isVisible(), 'Horizontal rule should be visible.' ); assert.areNotEqual( 0, colorHistoryTools.findInPanel( '.cke_colorhistory_row', txtColorBtn ).getChildCount(), 'Row shouldn\'t be empty.' ); } ); @@ -141,6 +103,6 @@ assert.areEqual( 2, colorHistoryTools.findInPanel( '.cke_colorhistory_row', bgColorBtn ).getChildCount(), 'New background color tile should appear.' ); } ); - }, + } } ); } )(); diff --git a/tests/plugins/colorbutton/customcolorsasync.js b/tests/plugins/colorbutton/customcolorsasync.js index fcc548b32ec..76a4abfc8dc 100644 --- a/tests/plugins/colorbutton/customcolorsasync.js +++ b/tests/plugins/colorbutton/customcolorsasync.js @@ -1,5 +1,5 @@ /* bender-tags: editor,colorbutton,colordialog,1795 */ -/* bender-ckeditor-plugins: colorbutton,colordialog,toolbar */ +/* bender-ckeditor-plugins: colorbutton,colordialog,undo,toolbar,wysiwygarea */ /* bender-include: _helpers/tools.js */ /* global colorHistoryTools */