module('plugins.autotypeset'); test('全角半角转换',function(){ window.localStorage.clear(); var editor = te.obj[0]; editor.setContent('
Mayday123,.Mayday123,.
'); var text = editor.getContent(); equal(text,'Mayday123,.Mayday123,.
','半角全角内容输入正确'); editor.execCommand('autotypeset'); var text2 = editor.body.firstChild.innerHTML; equal(text2,'Mayday123,.Mayday123,.','半角全角内容输入正确2'); editor.options.autotypeset.tobdc=true; editor.execCommand('autotypeset'); equal(editor.body.firstChild.innerHTML,'Mayday123,.Mayday123,.','内容转为全角:正确'); editor.options.autotypeset.tobdc=false; editor.setContent('Mayday123,.Mayday123,.
'); editor.options.autotypeset.bdc2sb=true; editor.execCommand('autotypeset'); equal(editor.body.firstChild.innerHTML,'Mayday123,.Mayday123,.','内容转为半角:正确'); editor.options.autotypeset.bdc2sb=false; }); //todo test('文本居中',function(){ var editor = te.obj[0]; editor.setContent('p文本
欢迎使用
ueditor!
'); setTimeout(function(){ editor.options.autotypeset.mergeEmptyline = true; delete editor.options.autotypeset.textAlign; editor.execCommand('autotypeset'); ua.manualDeleteFillData(editor.body); var html =editor.body.innerHTML.toLowerCase().replace(/\r\n/ig,''); equal(html,'欢迎使用
ueditor!
','合并空行'); start(); }, 50 ); stop(); }); test('带有图片表情',function(){ var editor = te.obj[0]; editor.setContent('欢迎使用ueditor!
欢迎使用
ueditor!
'); setTimeout(function(){ editor.options.autotypeset.mergeEmptyline = false;//removeEmptyline editor.options.autotypeset.removeEmptyline = true; delete editor.options.autotypeset.textAlign; editor.execCommand('autotypeset'); ua.manualDeleteFillData(editor.body); equal(editor.body.innerHTML.toLowerCase().replace(/\r\n/ig,''),'欢迎使用
ueditor!
','删除空行'); start(); }, 50 ); stop(); }); test('首行缩进',function(){ var editor = te.obj[0]; editor.setContent('欢迎使用ueditor!
'); setTimeout(function(){ editor.options.autotypeset.indent = true; editor.options.autotypeset.textAlign= "left"; editor.execCommand('autotypeset'); ua.manualDeleteFillData(editor.body); var html = '欢迎使用ueditor!
'; ua.checkHTMLSameStyle(html ,editor.document,editor.body,'首行缩进'); start(); }, 50 ); stop(); }); /*trace 2650*/ test( 'trace 3277:图像对齐', function () { var editor = te.obj[0]; editor.setContent( '欢迎使用ueditor!
'); setTimeout(function(){ editor.options.autotypeset.clearFontSize = editor.options.autotypeset.clearFontFamily = true; delete editor.options.autotypeset.textAlign; editor.execCommand('autotypeset'); equal(ua.getChildHTML(editor.body),'欢迎使用ueditor!
','恢复字体默认样式'); start(); }, 50 ); stop(); }); test('去掉class,去掉多余节点',function(){ var editor = te.obj[0]; editor.setContent('欢迎使用ueditor!
'); editor.options.autotypeset.removeClass = true; delete editor.options.autotypeset.textAlign; editor.execCommand('autotypeset'); equal(ua.getChildHTML(editor.body),'欢迎使用ueditor!
','去掉class'); }); test('粘贴过滤',function(){ var div = document.body.appendChild(document.createElement('div')); var editor = te.obj[0]; editor.setContent(''); editor.options.autotypeset.pasteFilter = true; editor.options.autotypeset.removeEmptyline = true; delete editor.options.autotypeset.textAlign; editor.execCommand('autotypeset'); var html ={html:'hello1
hello2
'}; editor.fireEvent('beforepaste',html); editor.execCommand( 'insertHtml',html.html,true); editor.fireEvent("afterpaste"); txt='hello1hello2
Mayday123,.Mayday123,.
","未执行半角转全角"); }else{ equal(editor2.getContent(),'Mayday123,.Mayday123,.
',"未执行半角转全角"); } setTimeout(function () { UE.delEditor('ue2'); window.localStorage.clear(); start(); }, 100); }); stop(); }); test('trace:3991',function(){ var editor3 = te.obj[0]; setTimeout(function(){ editor3.setContent(''); editor3.execCommand('inserttable', {numCols: 3, numRows: 3}); var text =editor3.body.getElementsByTagName('td')[0]; var range = new baidu.editor.dom.Range(editor3.document); range.setStart(text,0).collapse(1).select(); editor3.execCommand("inserttitlecol"); equal(editor3.queryCommandState("inserttitlecol"),-1,'标题列不能向右合并'); var f = $("#edui538_state")[0]; start(); }, 100); stop(); }); test('trace:3967',function(){ var editor = te.obj[0]; editor.setContent('123