Skip to content
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

[test] #95

Merged
merged 3 commits into from
Jun 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions _test/plugins/enterkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ test( 'chrome删除div', function () {
editor.body.innerHTML = '<h1>一级标题</h1><div><br/></div>';
range.setStart( body.firstChild.firstChild, 4 ).collapse( 1 ).select();
ua.keydown(editor.body,{'keyCode':13});
ua.keyup(editor.body,{'keyCode':13});
range.selectNode(body.lastChild).select();
var index = editor.undoManger.index;
var br = ua.browser.ie ? '' : '<br>';
ua.keyup(editor.body,{'keyCode':13});
equal(editor.undoManger.list.length,2,'保存现场');
equal(editor.undoManger.list.length,1,'保存现场');
setTimeout( function () {
equal( body.childNodes.length, 2, '2个子节点' );
equal(body.lastChild.tagName.toLowerCase(),'p','div转成p');
equal(ua.getChildHTML(body),'<h1>一级标题</h1><p><br></p>','检查内容');
equal(body.lastChild.tagName.toLowerCase(),'div','div转成p');
equal(ua.getChildHTML(body),'<h1>一级标题</h1><div><br></div>','检查内容');
start();
}, 60 );
stop();
Expand Down
16 changes: 8 additions & 8 deletions _test/plugins/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,21 +357,21 @@ test('预先设置字体颜色,再输入文本,查看文本颜色', function
});
}
});
test('font不转span', function () {
test('font转span', function () {
var editor = te.obj[0];
editor.focus();
editor.setContent('<font size="12" color="red" lang="en" face="arial"><b><i>hello</i>hello</b>');
var html = '<span style="font-size:12px;color:red;font-family:arial"><strong><em>hello</em>hello</strong></span>';
var html = '<font size="12" color="red" lang="en" face="arial"><b><i>hello</i>hello</b>';
ua.checkHTMLSameStyle(html, editor.document, editor.body.firstChild, '不转换font标签');
var html = '<span style="font-size:12px;color:red;font-family:arial"><b><i>hello</i>hello</b></span>';
ua.checkHTMLSameStyle(html, editor.document, editor.body.firstChild, 'font转span');
editor.setContent('<b><font size="10" color="#ff0000" lang="en" face="楷体">hello');
//html = '<strong><span style="font-size:10px;color:#ff0000;font-family:楷体">hello</span></strong>';
html = '<b><font size="10" color="#ff0000" lang="en" face="楷体">hello';
ua.checkHTMLSameStyle(html, editor.document, editor.body.firstChild, '不转换font标签');
html = '<b><span style="font-size:10px;color:#ff0000;font-family:楷体">hello</span></b>';
ua.checkHTMLSameStyle(html, editor.document, editor.body.firstChild, 'font转span');

});

test('font标签不发生转换', function () {
test('font标签转换为span', function () {
var editor = te.obj[0];
editor.setContent('<font size="16" color="red"><b><i>x</i></b></font>');
// if(ua.browser.chrome){
Expand All @@ -385,9 +385,9 @@ test('font标签不发生转换', function () {
var html1 = '<p><span style="font-size:16px;color:red" ><strong><em>x</em></strong></span></p>';
ua.checkSameHtml(editor.getContent(editor.body),html1,'确认一下确实是正确的');
editor.setContent('<font style="color:red"><u>x</u></font>');
html = '<font style="color:red"><u>x</u></font>';
html = '<span style="color:red"><u>x</u></span>';
//equal(editor.body.firstChild.innerHTML.toLowerCase(),html,'font不转换标签');//ff和chrome下都是正确的,ie下报错,但是错误的提示中,可以看到期待的和实际得到的也是一样的 不知道为何报错
ua.checkSameHtml(editor.body.firstChild.innerHTML.toLowerCase(),html,'font不转换标签');
ua.checkSameHtml(editor.body.firstChild.innerHTML.toLowerCase(),html,'font标签转换为span');
});


Expand Down
2 changes: 1 addition & 1 deletion _test/plugins/selectall.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test( 'ctrl+a', function() {
ua.keydown(editor.body,{'keyCode':65,'ctrlKey':true});
setTimeout( function() {
var range = editor.selection.getRange();
if ( ua.browser.gecko )
if ( ua.browser.gecko||ua.browser.chrome )
ua.checkResult( range, body, body, 0, 2, false, '查看全选后的range' );
else
ua.checkResult( range, body.firstChild.firstChild, body.lastChild.firstChild, 0, 6, false, '查看全选后的range' );
Expand Down
2 changes: 1 addition & 1 deletion _test/plugins/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test('设定range,切源码再切回来',function(){//trace 3647
editor.execCommand('source');
setTimeout(function () {
editor.execCommand('source');
if (ua.browser.gecko) {//todo range 判断
if (ua.browser.gecko||ua.browser.chrome) {//todo range 判断
ua.checkResult(editor.selection.getRange(), editor.body, editor.body, 0, 1, false, '选区不变');
} else {
ua.checkResult(editor.selection.getRange(), editor.body.firstChild.firstChild, editor.body.firstChild.firstChild, 0, 12, false, '选区不变');
Expand Down