提交 aed77ce2 编写于 作者: Y yancend

[test]用例调整

上级 6cde5d3b
......@@ -37,7 +37,7 @@ test('trace 3343:插入代码中有空行', function () {
setTimeout(function () {
UE.delEditor('ue');
start()
}, 100);
}, 200);
}, 20);
}, 20);
});
......@@ -52,17 +52,18 @@ test('trace 3355:不闭合选区插入代码', function () {
var code = '<div id="upload" style="display: none" ><img id="uploadBtn"></div>';
editor.setContent(code);
setTimeout(function () {
ua.keydown(editor.body, {'keyCode':65, 'ctrlKey':true});
editor.execCommand('insertcode', 'html');
var br = ua.browser.ie ? '' : '<br>';
if (ua.browser.gecko || ua.browser.opera ||ua.browser.ie>8)
ua.checkSameHtml(editor.body.innerHTML, '<pre class="brush:html;toolbar:false">&lt;div id=\"upload\" style=\"display: none\" &gt;&lt;img id=\"uploadBtn\"&gt;&lt;/div&gt;</pre>', '检查插入了html');
else
ua.checkSameHtml(editor.body.innerHTML, '<pre class="brush:html;toolbar:false">&lt;div id=\"upload\" style=\"display: none\" &gt;&lt;img id=\"uploadBtn\"&gt;&lt;/div&gt;</pre><p>' + br + '</p>', '检查插入了html');
setTimeout(function () {
UE.delEditor('ue');
start()
}, 100);
ua.keydown(editor.body, {'keyCode': 65, 'ctrlKey': true});
editor.execCommand('insertcode', 'html');
var br = ua.browser.ie ? '' : '<br>';
if (ua.browser.gecko || ua.browser.opera || ua.browser.ie > 8)
ua.checkSameHtml(editor.body.innerHTML, '<pre class="brush:html;toolbar:false">&lt;div id=\"upload\" style=\"display: none\" &gt;&lt;img id=\"uploadBtn\"&gt;&lt;/div&gt;</pre>', '检查插入了html');
else
ua.checkSameHtml(editor.body.innerHTML, '<pre class="brush:html;toolbar:false">&lt;div id=\"upload\" style=\"display: none\" &gt;&lt;img id=\"uploadBtn\"&gt;&lt;/div&gt;</pre><p>' + br + '</p>', '检查插入了html');
setTimeout(function () {
UE.delEditor('ue');
document.getElementById('ue')&&te.dom.push(document.getElementById('ue'));
start()
}, 500);
}, 50);
});
stop();
......@@ -91,8 +92,9 @@ test('trace 3395:插入代码为空时,清空编辑器', function () {
ua.checkSameHtml(editor.body.innerHTML, '<p>' + br + '</p>', '检查编辑器清空');
setTimeout(function () {
UE.delEditor('ue');
document.getElementById('ue')&&te.dom.push(document.getElementById('ue'));
start()
}, 100);
}, 500);
});
stop();
});
......@@ -117,7 +119,7 @@ test('trace 3396:多次切换源码,不会产生空行', function () {
setTimeout(function () {
editor.execCommand('source');
var end = (ua.browser.ie&&ua.browser.ie>8)?'':'<br>';
br =( ua.browser.ie&&ua.browser.ie>9)?'\n':'<br>';
br =( ua.browser.ie&&ua.browser.ie>8)?'\n':'<br>';
var Bbr =( ua.browser.ie&&ua.browser.ie<9)?'\n':'';
ua.checkSameHtml(editor.body.firstChild.innerHTML, '&lt;body&gt;'+Bbr+br+'&lt;/body&gt;'+end, '切回源码无影响');
// setTimeout(function() {//TODO bug修复后去掉注释
......@@ -127,8 +129,9 @@ test('trace 3396:多次切换源码,不会产生空行', function () {
// ua.checkSameHtml(editor.body.firstChild.innerHTML,'&lt;body&gt;<br>&lt;/body&gt;<br>','切回源码无影响');
setTimeout(function () {
UE.delEditor('ue');
document.getElementById('ue')&&te.dom.push(document.getElementById('ue'));
start()
}, 100);
}, 500);
// },20);
// },20);
}, 20);
......@@ -235,8 +238,9 @@ test('test-beforeInsertHTML', function(){
setTimeout(function () {
UE.delEditor('ue');
document.getElementById('ue')&&te.dom.push(document.getElementById('ue'));
start()
}, 100);
}, 500);
});
stop();
});
......@@ -206,6 +206,7 @@ test('从外面粘贴表格到表格-在caption中粘贴,只粘贴文本内容',
/*粘贴*/
stop();
setTimeout(function () {
//todo ie9 使用 div[browser.ie ? 'innerText' : 'textContent'] 会多一个换行,用textContent没有
equal(html.html, 'hello1', '在caption中粘贴,只粘贴文本内容');
start();
}, 50);
......@@ -352,7 +353,7 @@ test('backspace事件:deleterow', function () {
equal(te.obj[0].selection.getRange().collapsed, true, '检查光标');
equal(te.obj[0].selection.getRange().startContainer, te.obj[0].body.getElementsByTagName('td')[0], '检查光标');
start();
}, 20);
}, 100);
}, 50);
});
......@@ -363,9 +364,10 @@ test('backspace事件:deletecol', function () {
range.setStart(editor.body.firstChild, 0).collapse(true).select();
editor.execCommand('inserttable', {numCols: 3, numRows: 3});
// expect(5);
editor.addListener('saveScene', function () {
ok(true);
});
// editor.addListener('saveScene', function () {
// ok(true);
//
// });
var trs = editor.body.firstChild.getElementsByTagName('tr');
var ut = editor.getUETable(editor.body.firstChild);
var cellsRange = ut.getCellsRange(trs[0].cells[0], trs[2].cells[0]);
......@@ -379,12 +381,40 @@ test('backspace事件:deletecol', function () {
equal(te.obj[0].selection.getRange().startContainer, te.obj[0].body.getElementsByTagName('td')[0], '检查光标');
start();
}, 20);
});
test('backspace事件:delcells', function () {
//TODO
});
test('表格名称中backspace键', function () {
var editor = te.obj[0];
var range = te.obj[1];
editor.setContent('<p></p>');
range.setStart(editor.body.firstChild, 0).collapse(true).select();
editor.execCommand('inserttable', {numCols: 3, numRows: 3});
var trs = editor.body.firstChild.getElementsByTagName('tr');
range.setStart(trs[0].cells[0], 0).collapse(true).select();
editor.execCommand('insertcaption');
expect(8);
editor.addListener('saveScene', function () {
ok(true);
});
range.setStart(editor.body.getElementsByTagName('caption')[0], 0).collapse(true).select();
ua.keydown(editor.body, {'keyCode': 8});
stop();
setTimeout(function () {
editor = te.obj[0];
equal(editor.body.getElementsByTagName('caption').length, 0, '删除caption');
equal(editor.body.getElementsByTagName('table').length, 1, '不会增加表格数量');
equal(editor.body.getElementsByTagName('tr').length, 3, '不会增加表格行数量');
equal(editor.body.getElementsByTagName('tr')[0].cells.length, 3, '不会增加表格列数量');
equal(editor.selection.getRange().collapsed, true, '检查光标');
equal(editor.selection.getRange().startContainer, editor.body.getElementsByTagName('td')[0], '检查光标');
start();
}, 50);
});
test('trace 3097 标题行中backspace键', function () {
var editor = te.obj[0];
var range = te.obj[1];
......@@ -424,7 +454,6 @@ test('拖拽', function () {
var width1 = tds[1].width;
ua.mousemove(tds[1], {clientX: 199, clientY: 100});
ua.mousedown(tds[1], {clientX: 199, clientY: 100});
debugger
equal(editor.body.style.cursor, 'col-resize', '检查鼠标显示');
ua.mousemove(tds[1], {clientX: 299, clientY: 100});
ua.mouseup(tds[1], {clientX: 299, clientY: 100});
......@@ -909,17 +938,19 @@ test('点击一行的最左边,但是每行只有一列,这时选中单元格中
var tds = editor.body.getElementsByTagName('td');
tds[0].innerHTML = 'hello';
setTimeout(function () {
ua.click(tds[0], {clientX: 10, clientY: 23});
setTimeout(function () {
var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;
equal(selectedTds.length, 0, '不选中行');
if (ua.browser.webkit) {
ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 0, 5, false, '检查选中的range');
} else {
ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 1, false, '检查选中的range');
}
start();
}, 500);
window.scrollTo(0,0);//保证位置准确
ua.click(tds[0], {clientX: 10, clientY: 23});
setTimeout(function () {
var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;
equal(selectedTds.length, 0, '不选中行');
if (ua.browser.webkit) {
ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 0, 5, false, '检查选中的range');
} else {
ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 1, false, '检查选中的range');
}
start();
}, 500);
}, 500);
stop();
});
......
......@@ -49,7 +49,7 @@ test("getMaxCols", function () {
equal(maxCols, 6, "最大列数为6");
});
test("getSameEndPosCells", function () {
test("ie9 active trace 3728 getSameEndPosCells", function () {
var table = getTable("<tr><td rowspan='2'>1</td><td>2</td><td>3</td></tr><tr><td>2</td><td>3</td></tr>"),
ut = new UT(table);
var cell = table.rows[0].cells[0],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册