提交 16f28e0a 编写于 作者: Y yancend

[case]

上级 41b8dc7e
......@@ -6,6 +6,20 @@
* To change this template use File | Settings | File Templates.
*/
module( 'plugins.defaultfilter' );
test( '对代码的行号不处理', function () {
var editor = te.obj[0];
editor.setContent( '<td class="gutter"><div class="line number1 index0 alt2">1</div><div class="line number2 index1 alt1">2</div></td>');
// var br = ua.browser.ie?'':'<br>';
var html = '<table><tbody><tr><td class=\"gutter\"><div class=\"line number1 index0 alt2\">1</div><div class=\"line number2 index1 alt1\">2</div></td></tr></tbody></table>';
ua.checkSameHtml(editor.body.innerHTML,html,'table补全,对代码的行号不处理')
} );
test( '空td,th,caption', function () {
var editor = te.obj[0];
editor.setContent( '<table><caption></caption><tbody><tr><th></th><th></th></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table>' );
var br = ua.browser.ie?'':'<br>';
var html = '<table><caption>'+br+'</caption><tbody><tr><th>'+br+'</th><th>'+br+'</th></tr><tr><td>'+br+'</td><td>'+br+'</td></tr><tr><td>'+br+'</td><td>'+br+'</td></tr></tbody></table>';
ua.checkSameHtml(editor.body.innerHTML,html,'空td,th,caption,添加text')
} );
test( '转换a标签', function () {
var editor = te.obj[0];
editor.setContent( '<a href="http://elearning.baidu.com/url/RepositoryEntry/68616197" target="_blank">' );
......@@ -34,12 +48,13 @@ test( '删span中的white-space标签', function () {
// var html = '<p style="list-style: none;">hello</p>';
// ua.checkSameHtml(html,editor.body.innerHTML,'删p中的margin|padding标签');
//} );
test( '给空p加br', function () {
test( '给空p加br&&转对齐样式', function () {
var editor = te.obj[0];
editor.setContent( '<p style="list-style: none;" ></p>' );
editor.setContent( '<p align ="center" ></p>' );
var br = ua.browser.ie?'&nbsp;':'<br>';
// var html = '<p style="list-style: none;">'+br+'</p>';
equal(editor.body.firstChild.innerHTML,br)
// "<p style=\"text-align:center;list-style: none;\"><br></p>"
var html = '<p style=\"text-align:center;\">'+br+'</p>';
ua.checkSameHtml(editor.body.innerHTML,html, '给空p加br&&转对齐样式');
} );
test( '删div', function () {
var editor = te.obj[0];
......@@ -55,7 +70,9 @@ test( 'allowDivTransToP--false 不转div', function () {
editor.ready(function(){
var html = '<div class="socore" ><div class="sooption" style="padding: 1px;" >视频</div></div>';
editor.setContent( html );
ua.checkSameHtml(html,editor.body.innerHTML,'删div');
var padding = (ua.browser.ie&&ua.browser.ie<9)?'PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 1px':'padding: 1px;';
var html_a = '<div class="socore" ><div class="sooption" style="'+padding+'" >视频</div></div>';
ua.checkSameHtml(html_a,editor.body.innerHTML,'不转div');
UE.delEditor('ue');
start();
});
......
......@@ -11,22 +11,76 @@ test( '基本的shortcutmenu', function() {
//设置菜单内容\
var div = document.body.appendChild(document.createElement('div'));
div.id = 'ue';
var editor = UE.getEditor("ue" ,{ shortcutMenu: ["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"]});
var editor = UE.getEditor("ue", { shortcutMenu: ["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"]});
stop();
editor.ready(function () {
ua.contextmenu(editor.body);
setTimeout(function(){
var menu=document.getElementsByClassName("edui-shortcutmenu")[0];
equal(!!menu,true,'右键检查菜单是否存在');
setTimeout(function () {
var menu = document.getElementsByClassName("edui-shortcutmenu")[0];
equal(!!menu, true, '右键检查菜单是否存在');
ok(menu.style.display==""||menu.style.display=="block",'右键检查菜单是否显示');
ok(menu.style.display == "" || menu.style.display == "block", '右键检查菜单是否显示');
ua.mousedown(editor.body.firstChild);
equal(menu.style.display,"none",'鼠标按下检查菜单是否隐藏');
equal(menu.style.display, "none", '鼠标按下检查菜单是否隐藏');
UE.delEditor('ue');
te.dom.push(document.getElementById('ue'));
te.dom.push(document.getElementById('edui_fixedlayer'));
start()
}, 100);
});
});
test( '键盘操作,隐藏shortcutmenu', function() {
//设置菜单内容\
var div = document.body.appendChild(document.createElement('div'));
div.id = 'ue';
var editor = UE.getEditor("ue" ,{ shortcutMenu: ["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"]});
stop();
editor.ready(function () {
ua.contextmenu(editor.body);
setTimeout(function(){
var menu=document.getElementsByClassName("edui-shortcutmenu")[0];
equal(!!menu,true,'右键检查菜单是否存在');
ok(menu.style.display==""||menu.style.display=="block",'右键检查菜单是否显示');
ua.keydown(editor.body.firstChild);
equal(menu.style.display,"none",'键盘按下检查菜单是否隐藏');
UE.delEditor('ue');
te.dom.push(document.getElementById('ue'));
te.dom.push(document.getElementById('edui_fixedlayer'));
start()
},100);
});
} );
test( '框选内容', function() {
//设置菜单内容\
var div = document.body.appendChild(document.createElement('div'));
div.id = 'ue';
var editor = UE.getEditor("ue" ,{ shortcutMenu: ["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"]});
stop();
editor.ready(function () {
editor.setContent('<p>hello</p>');
var range = new baidu.editor.dom.Range(editor.document);
range.setStart(editor.body.firstChild.firstChild,0).setEnd(editor.body.firstChild.firstChild,2).select();
var sc =editor.selection.getRange().startContainer;
var ec =editor.selection.getRange().endContainer;
var so =editor.selection.getRange().startOffset;
var eo =editor.selection.getRange().endOffset;
var collapsed =editor.selection.getRange().collapsed;
ua.contextmenu(editor.body);
setTimeout(function(){
var menu=document.getElementsByClassName("edui-shortcutmenu")[0];
equal(!!menu,true,'右键检查菜单是否存在');
ok(menu.style.display==""||menu.style.display=="block",'右键检查菜单是否显示');
ua.checkResult(editor.selection.getRange(), sc, ec, so, eo, collapsed,'检查range不变');
ua.keydown(editor.body.firstChild);
UE.delEditor('ue');
te.dom.push(document.getElementById('ue'));
te.dom.push(document.getElementById('edui_fixedlayer'));
start()
},100);
});
} );
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册