-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from ckeditor/t/565
Auto adding `#` to hex color on colordialog close.
- Loading branch information
Showing
6 changed files
with
112 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* bender-tags: editor */ | ||
/* bender-ckeditor-plugins: colordialog,wysiwygarea */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
bender.editor = true; | ||
|
||
bender.test( { | ||
assertColor: function( inputColor, outputColor ) { | ||
var editor = this.editor; | ||
|
||
editor.once( 'dialogShow', function( evt ) { | ||
var dialog = evt.data; | ||
dialog.setValueOf( 'picker', 'selectedColor', inputColor ); | ||
dialog.getButton( 'ok' ).click(); | ||
|
||
} ); | ||
|
||
editor.getColorFromDialog( function( color ) { | ||
resume( function() { | ||
assert.areSame( outputColor, color ); | ||
} ); | ||
} ); | ||
wait(); | ||
}, | ||
|
||
'test colordialog add hash to color\'s values with 6 hexadecimal digits': function() { | ||
this.assertColor( '123456', '#123456' ); | ||
}, | ||
|
||
'test colordialog add hash to color\'s values with 3 hexadecimal digits': function() { | ||
this.assertColor( 'FDE', '#FDE' ); | ||
}, | ||
|
||
'test colordialog does not add hash to color value with 1 digit (incorrect css color value)': function() { | ||
// IE8 doesn't set incorrect values. | ||
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) { | ||
assert.ignore(); | ||
} | ||
this.assertColor( '1', '1' ); | ||
}, | ||
|
||
'test colordialog does not add hash to color name': function() { | ||
this.assertColor( 'red', 'red' ); | ||
}, | ||
|
||
'test colordialog does not add hash to rgb color value': function() { | ||
this.assertColor( 'rgb(10, 20, 30)', 'rgb(10, 20, 30)' ); | ||
}, | ||
|
||
'test colordialog does not add hash to empty value ': function() { | ||
this.assertColor( '', '' ); | ||
} | ||
} ); | ||
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<textarea id="editor1"> | ||
<table border="1" cellspacing="1" cellpadding="1"> | ||
<tr> | ||
<td>Cell 1</td><td>Cell 2</td> | ||
</tr> | ||
</table> | ||
</textarea> | ||
|
||
<script> | ||
if ( bender.tools.env.mobile ) { | ||
bender.ignore(); | ||
} else { | ||
CKEDITOR.replace( 'editor1' ); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@bender-tags: tc, feature, colordialog, 565, 4.8.0 | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: table,tabletools,colordialog,toolbar,wysiwygarea,sourcearea,contextmenu | ||
|
||
1. Right click into table cell. | ||
1. Select `Cell -> Cell Properties`. | ||
1. Press `Choose` button next to _Background Color_. | ||
* Color dialog should appear. | ||
1. Type color value in input field (just above `Clear` button) in hexadecimal 6-digit format **without** leading `#`. E.g. (`ABC123`). | ||
1. Confirm it. | ||
* **Expected**: Inserted color should contain additional `#` at the beginning. | ||
1. Repeat above steps for color with hexadecimal 3-digits format. E.g. (`FFF`). | ||
|
||
**Note:** You can also check the behaviour of color dialog by setting values in different formats (rgb, text) or invalid hex strings. For such colors `#` should not be added. |