-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto adding #
to color from colordialog
#580
Changes from 9 commits
508eecb
bc2ed66
43d5a42
e339434
82cbcda
df8a63b
dbb8016
e463657
818bd17
ba184c6
dbf8d8e
2b6bd45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* bender-tags: editor */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember to always put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we discussed this once again, if unit tag is not needed (not used by bender) it should be skipped. |
||
/* 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 colors 6 digits': function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think test names would be more readable like:
|
||
this.assertColor( '123456', '#123456' ); | ||
}, | ||
|
||
'test colordialog add hash to colors 3 digits': function() { | ||
this.assertColor( 'FDE', '#FDE' ); | ||
}, | ||
|
||
'test colordialog does not add hash 1 digit': function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test fails on IE8. |
||
// IE8 don't allow on totally wrong values of attributes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IE8 doesn't allowing invalid values means the attribute will not be set? I think it might be more clear with something like: |
||
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) { | ||
assert.ignore(); | ||
} | ||
this.assertColor( '1', '1' ); | ||
}, | ||
|
||
'test colordialog does not add hash color name': function() { | ||
this.assertColor( 'red', 'red' ); | ||
}, | ||
|
||
'test colordialog does not add hash rgb': function() { | ||
this.assertColor( 'rgb(10, 20, 30)', 'rgb(10, 20, 30)' ); | ||
}, | ||
|
||
'test colordialog does not add hash empty value': function() { | ||
this.assertColor( '', '' ); | ||
} | ||
} ); | ||
} )(); |
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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@bender-tags: tc, feature, colordialog, 565, 4.8.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we do not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As it was discussed some time ago there should either There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I'm not up to date - if it was discussed with @mlewand or @Comandeer in the last 2-3 weeks it means it should be that way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was discussed around 12 - 13 June on |
||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: table,tabletools,colordialog,toolbar,wysiwygarea,sourcearea,contextmenu | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be helpful when you wish to check what was included to attribute of tag. E.g. if there will be some invalid string or colour hard to distinguish from others, then checking source might be helpful. |
||
|
||
1. Right click into table cell. | ||
1. Select `Cell -> Cell Properties`. | ||
1. Choose background color. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it mean to click |
||
1. Type color in hexadecimal 6-digit format **without** leading `#`. E.g. (`ABC123`). | ||
1. Confirm it. | ||
1. 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 with colors in different formats (rgb, text) or invalid hex strings. For such colors `#` should not be added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of the changes in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change allows on writing unit test for this bug-fix.
Generally writing test for it was very tricky. Problem appeared when
ok
button is pressed then methodclearHighlight()
is called. What throw an error because unit test doesn't highlight colour in dialog as user does.So I just add if-statement which check if focus is defined and also rearrange variable declaration to pass JShint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Color dialog hasn't got any unit test earlier.
This change:
Allows on making nice unit test which set up values but doesn't touch focused colour. So test don't throw up errors when only value exists without focusing it.