(function(){function n(b,a){return function(){var d=arguments;b.resume(function(){a.apply(this,d)}.bind(this))}.bind(this)}function f(b,a,d){var c=this,e=c.testCase;c.editor.once("selectionChange",function(){c.dialog("testDialog",function(d){b(d);c.editor.once("dialogShow",n(e,function(b){a(b,d)}));e.wait()})});c.setHtmlWithSelection(d)}function q(b,a){var d=this.testCase;this.editor.once("dialogHide",n(d,a));b.data.getButton("ok").click();d.wait()}function h(b,a){assert.areSame(a,b.getValue());b.previewField()&&
assert.areSame(a,b.previewField().getStyle("background-color"))}function k(b,a,d){return function(){var c=this.editorBot;f.bind(c)(a,function(a,p){assert.areSame(d,a.data.getContentElement("picker","selectedColor").getValue());a.data.getContentElement("picker","selectedColor").setValue("red");q.bind(c)(a,function(a){h(p.getContentElement("info",b),"red");p.getButton("ok").click()})},'[\x3cdiv data-expandedcolor\x3d"#333" data-compactcolor\x3d"#444" data-minimalcolor\x3d"#555"\x3e\x26nbsp;\x3c/div\x3e]')}}
function l(b,a,d,c){return function(){var c=this.editorBot;f.bind(c)(a,function(a,g){assert.areSame(d,a.data.getContentElement("picker","selectedColor").getValue());a.data.getContentElement("picker","clear").click();q.bind(c)(a,function(a){h(g.getContentElement("info",b),"");g.getButton("ok").click()})},'[\x3cdiv data-expandedcolor\x3d"#333" data-compactcolor\x3d"#444" data-minimalcolor\x3d"#555"\x3e\x26nbsp;\x3c/div\x3e]')}}function m(b,a,d,c){return function(){var e=this.editorBot;f.bind(e)(a,function(a,
c){assert.areSame(d,a.data.getContentElement("picker","selectedColor").getValue());h(c.getContentElement("info",b),d);c.getButton("ok").click()},"[\x3cdiv\x3e\x26nbsp;\x3c/div\x3e]");f.bind(e)(a,function(a,g){assert.areSame(d,a.data.getContentElement("picker","selectedColor").getValue());h(g.getContentElement("info",b),c);g.getButton("ok").click()},'[\x3cdiv data-expandedcolor\x3d"#333" data-compactcolor\x3d"#444" data-minimalcolor\x3d"#555"\x3e\x26nbsp;\x3c/div\x3e]');f.bind(e)(a,function(a,c){assert.areSame(d,
a.data.getContentElement("picker","selectedColor").getValue());h(c.getContentElement("info",b),d);c.getButton("ok").click()},"[\x3cdiv\x3e\x26nbsp;\x3c/div\x3e]")}}bender.editor=!0;bender.test({setUp:function(){this.editor.addCommand("testDialog",new CKEDITOR.dialogCommand("testDialog"));CKEDITOR.dialog.add("testDialog",function(b){return{title:"Color Input View",contents:[{id:"info",label:"Info",elements:[{id:"expandedpreview",type:"color",label:"Expanded Color Input",layout:"expanded","default":"chartreuse",
setup:function(a){a.data("expandedcolor")&&this.setValue(a.data("expandedcolor"))},commit:function(a){a.data("expandedcolor",this.getValue())}},{id:"compactpreview",type:"color",label:"Compact Color Input",layout:"compact","default":"rgb(255, 153, 51)",setup:function(a){a.data("compactcolor")&&this.setValue(a.data("compactcolor"))},commit:function(a){a.data("compactcolor",this.getValue())}},{id:"minimalpreview",type:"color",label:"Minimal Color Input (popup on click)",layout:"minimal","default":"#909",
setup:function(a){a.data("minimalcolor")&&this.setValue(a.data("minimalcolor"))},commit:function(a){a.data("minimalcolor",this.getValue())}}]}],onShow:function(){this.setupContent(b.getSelection().getStartElement())},onOk:function(){this.commitContent(b.getSelection().getStartElement())}}})},"test getValue setValue":function(){var b=this.editorBot;b.editor.once("selectionChange",function(){b.dialog("testDialog",function(a){assert.areSame("#333",a.getContentElement("info","expandedpreview").getValue());
assert.areSame("#444",a.getContentElement("info","compactpreview").getValue());assert.areSame("#555",a.getContentElement("info","minimalpreview").getValue());a.getButton("ok").click();assert.areSame("#333",b.editor.getSelection().getStartElement().data("expandedcolor"));assert.areSame("#444",b.editor.getSelection().getStartElement().data("compactcolor"));assert.areSame("#555",b.editor.getSelection().getStartElement().data("minimalcolor"))})});b.setHtmlWithSelection('[\x3cdiv data-expandedcolor\x3d"#333" data-compactcolor\x3d"#444" data-minimalcolor\x3d"#555"\x3e\x26nbsp;\x3c/div\x3e]')},
"test colordialog expanded":k("expandedpreview",function(b){b.getContentElement("info","expandedpreview").chooseField().fire("click")},"#333"),"test colordialog compact":k("compactpreview",function(b){b.getContentElement("info","compactpreview").chooseField().fire("click")},"#444"),"test colordialog minimal":k("minimalpreview",function(b){b.getContentElement("info","minimalpreview").textField().fire("click")},"#555"),"test colordialog clear expanded":l("expandedpreview",function(b){b.getContentElement("info",
"expandedpreview").chooseField().fire("click")},"#333"),"test colordialog clear compact":l("compactpreview",function(b){b.getContentElement("info","compactpreview").chooseField().fire("click")},"#444"),"test colordialog clear minimal":l("minimalpreview",function(b){b.getContentElement("info","minimalpreview").textField().fire("click")},"#555"),"test colordialog default expanded":m("expandedpreview",function(b){b.getContentElement("info","expandedpreview").chooseField().fire("click")},"chartreuse",
"#333"),"test colordialog default compact":m("compactpreview",function(b){b.getContentElement("info","compactpreview").chooseField().fire("click")},"rgb(255, 153, 51)","#444"),"test colordialog default minimal":m("minimalpreview",function(b){b.getContentElement("info","minimalpreview").textField().fire("click")},"#909","#555")})})();