diff --git a/_test/import.js b/_test/import.js
index 160434dcff13806a4069511016bc4fd7a23cf887..ffd02724441029f09776424068af4bd046e6878d 100644
--- a/_test/import.js
+++ b/_test/import.js
@@ -90,8 +90,10 @@
///import plugins/music;
///import plugins/video;
///import plugins/autosave;
+///import plugins/charts;
///import plugins/autoupload;
///import plugins/section;
+
///import ui/ui;
///import ui/uiutils;
///import ui/uibase;
diff --git a/_test/plugins/autolink.js b/_test/plugins/autolink.js
index aa881c1aa0a5e7966a84734177e0e3098f61fd9a..ff759040e583dfa0ced791048dc1ea01b08b825d 100644
--- a/_test/plugins/autolink.js
+++ b/_test/plugins/autolink.js
@@ -152,7 +152,7 @@ test('trace 2121', function () {
});
test('autofloat:false 禁用IE中的自动加超链接功能', function () {
//在IE中回车/空格自动加连接,这里模拟加连接以后,测试keyup时把添加的链接去掉
- if (ua.browser.ie) {
+ if (ua.browser.ie>8) {//这个用例中,ie8不好模拟startContainer.nodeName = p,用下面的用例测是一样的
var div = document.body.appendChild(document.createElement('div'));
div.id = 'ue';
var editor = UE.getEditor('ue', {autolink: false});
diff --git a/_test/plugins/autosave.js b/_test/plugins/autosave.js
index 0b09aa5f33ed639e178892dfee6f12e5115ba4b5..a63ed4930e0a3ca10a57e1784d9f51bb982d8c0a 100644
--- a/_test/plugins/autosave.js
+++ b/_test/plugins/autosave.js
@@ -2,7 +2,7 @@ module( 'plugins.autosave' );
test( '自动保存', function() {
- expect(6);
+ expect(8);
var container = te.obj[0].container,
editor = null,
@@ -43,9 +43,9 @@ test( '自动保存', function() {
data.content = data.content.toLowerCase();
equal( data.content, "
http://www.baidu.com
", "成功触发afterautosave事件" );
-// equal( editor.execCommand( "getlocaldata" ) !== null, true, "getlocaldata命令正常" );
-// editor.execCommand( "clearlocaldata" );
-// equal( editor.execCommand( "getlocaldata" ) === null, true, "clearlocaldata命令正常" );
+ equal( editor.execCommand( "getlocaldata" ) !== null, true, "getlocaldata命令正常" );
+ editor.execCommand( "clearlocaldata" );
+ equal( editor.execCommand( "getlocaldata" ) === null, true, "clearlocaldata命令正常" );
} );
diff --git a/_test/plugins/charts.js b/_test/plugins/charts.js
index 4d46f56cca8e0f34f3c40cdc9e5b896c434a7b9b..2413fdff9582a3538f1b676de9b63a8d90a60c2b 100644
--- a/_test/plugins/charts.js
+++ b/_test/plugins/charts.js
@@ -23,23 +23,23 @@ test( '图表命令检测', function() {
stop();
- window.setTimeout( function () {
+ editor.ready( function () {
- var firstTd = editor.body.getElementsByTagName("td")[0],
- range = editor.selection.getRange();
+ var firstTd = editor.body.getElementsByTagName("td")[0];
+ var range = new baidu.editor.dom.Range(editor.document);
- range.selectNode( firstTd );
- range.collapse();
+ range.selectNode( firstTd).collapse(true).select();
equal( editor.queryCommandState( 'charts' ), -1, '数据验证失败, 状态为禁用' );
+
+
//设置数据格式合法的表格
editor.setContent('');
- firstTd = editor.container.getElementsByTagName("td")[0];
+ firstTd = editor.body.getElementsByTagName("td")[0];
- range.selectNode( firstTd );
- range.collapse();
+ range.setStart( firstTd,0).collapse(true).select();
equal( editor.queryCommandState( 'charts' ) != -1, true, '数据合法, 状态可用' );
@@ -58,8 +58,48 @@ test( '图表命令检测', function() {
equal( tableNode.getAttribute("data-chart") !== null, true, '插入图表命令执行成功' );
- start();
+ setTimeout(function(){
+ UE.delEditor("container");
+ document.getElementById("container")&&te.dom.push( document.getElementById("container"));
+ start();
+ },300);
- } , 500 );
+ } );
} );
+test( '图表命令检测', function() {
+// expect(5);
+
+ UE.delEditor( te.obj[0] );
+ var div = document.createElement( "div" );
+ div.id = "container";
+ document.body.appendChild( div );
+ var editor = UE.getEditor( "container", {
+ initialContent: ''
+ } );
+ stop();
+ editor.ready( function () {
+ var range = editor.selection.getRange();
+ range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
+ equal( editor.queryCommandState( 'charts' ), -1, '列数不够, 状态为禁用' );
+ //
+ editor.setContent('');
+ range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
+ equal( editor.queryCommandState( 'charts' ), -1, '第一行不都是th, 状态为禁用' );
+ editor.setContent('');
+ range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
+ equal( editor.queryCommandState( 'charts' ), -1, '第一列不是th, 状态为禁用' );
+ editor.setContent('');
+ range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
+ equal( editor.queryCommandState( 'charts' ), -1, '每行单元格数不匹配, 状态为禁用' );
+ editor.setContent('');
+ range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select();
+ equal( editor.queryCommandState( 'charts' ), -1, '内容不是数字, 状态为禁用' );
+ setTimeout(function(){
+ UE.delEditor("container");
+ document.getElementById("container")&&te.dom.push( document.getElementById("container"));
+ start();
+ },300);
+ } );
+} );
\ No newline at end of file
diff --git a/_test/plugins/image.js b/_test/plugins/image.js
index 83eae23896bec36821b9604e5f1c7b118addf0c5..9bb61ae28f656c917c8a6c7726791150b11ce6d2 100644
--- a/_test/plugins/image.js
+++ b/_test/plugins/image.js
@@ -7,25 +7,29 @@ module( 'plugins.image' );
*/
/*trace1491 修改动图的宽高*/
test( 'trace1491 修改动图的宽高', function () {
- setTimeout(function(){
+ setTimeout(function () {
+ expect(3);
var editor = te.obj[0];
var range = te.obj[1];
var body = editor.body;
- editor.setContent( '
' );
- range.setStart( body.firstChild, 0 ).collapse( 1 ).select();
- editor.execCommand( 'insertimage', {src:'../data/test.JPG'} );
- ua.manualDeleteFillData( editor.body );
- range.selectNode( body.firstChild.firstChild ).select();
- var img = body.getElementsByTagName( 'img' )[0];
- editor.execCommand( 'insertimage', {src:'../data/test.JPG', width:50, height:80} );
- img.onload = function () {
- equal( $( img ).attr( 'width' ), '50', '比较width' );
- equal( $( img ).attr( 'height' ), '80', '比较width' );
- start();
- };
- ok(/data\/test\.JPG/.test( img.getAttribute( 'src' )), '比较src' );
- },100);
-
+ editor.setContent('
');
+ setTimeout(function () {
+ range.setStart(body.firstChild, 0).collapse(1).select();
+ editor.execCommand('insertimage', {src: '../data/test.JPG'});
+ setTimeout(function () {
+ ua.manualDeleteFillData(editor.body);
+ range.selectNode(body.firstChild.firstChild).select();
+ var img = body.getElementsByTagName('img')[0];
+ editor.execCommand('insertimage', {src: '../data/test.JPG', width: 50, height: 80});
+ setTimeout(function () {
+ equal($(img).attr('width'), '50', '比较width');
+ equal($(img).attr('height'), '80', '比较width');
+ ok(/data\/test\.JPG/.test(img.getAttribute('src')), '比较src');
+ start();
+ }, 500);
+ }, 100);
+ }, 100);
+ }, 100);
stop();
} );
test( '插入新图像', function () {
diff --git a/_test/plugins/table.action.js b/_test/plugins/table.action.js
index 0f8574c220220c7b805acf16c7760d09a0075dcd..0ba1304d21435bef57becd23feceb50ff97f097a 100644
--- a/_test/plugins/table.action.js
+++ b/_test/plugins/table.action.js
@@ -5,6 +5,54 @@
* Time: 下午4:40
* To change this template use File | Settings | File Templates.
*/
+//test('trace 3047 ,3545 全屏插入表格', function () {
+// if (ua.browser.gecko)return;//TODO 1.2.6
+//// if (ua.browser.ie && ua.browser.ie < 9)return;//TODO 1.2.6
+// var div = document.body.appendChild(document.createElement('div'));
+// $(div).css('width', '500px').css('height', '500px').css('border', '1px solid #ccc');
+// var editor = te.obj[2];
+// editor.render(div);
+// stop();
+// editor.ready(function () {
+// editor.setContent('');
+// editor.ui.setFullScreen(!editor.ui.isFullScreen());
+// editor.execCommand('inserttable');
+// var width1 = editor.body.getElementsByTagName('td')[0].width;
+// setTimeout(function () {
+// editor.ui.setFullScreen(!editor.ui.isFullScreen());
+// setTimeout(function () {
+// var width2 = editor.body.getElementsByTagName('td')[0].width;
+// ok((width1 - width2) > 10, '页面宽度自适应');
+// div.parentNode.removeChild(div);
+// start();
+// }, 500);
+// }, 500);
+// });
+//});
+//test('拖拽-最右边的单元格', function () {
+// if (ua.browser.ie && ua.browser.ie < 8) return;
+// var editor = te.obj[0];
+// var range = te.obj[1];
+// editor.setContent('');
+// range.setStart(editor.body.firstChild, 0).collapse(true).select();
+// editor.execCommand('inserttable');
+// ua.manualDeleteFillData(editor.body);
+// var tds = te.obj[0].body.getElementsByTagName('td');
+// var width1 = tds[4].width;
+// ua.mousemove(tds[4], {clientX: 492, clientY: 21});
+// ua.mousedown(tds[4], {clientX: 492, clientY: 21});
+// setTimeout(function () {
+// equal(editor.body.style.cursor, 'col-resize', '检查鼠标显示');
+// ua.mousemove(tds[4], {clientX: 481, clientY: 21});
+// ua.mouseup(tds[4], {clientX: 481, clientY: 21});
+// setTimeout(function () {
+// var width2 = te.obj[0].body.getElementsByTagName('td')[4].width;
+// ok(width1 - width2 > 10, '拖拽后单元格宽度改变');
+// start();
+// }, 200);
+// }, 20);
+// stop();
+//});
//test('', function () {
// stop()
@@ -12,11 +60,7 @@
test('框选', function () {
var editor = te.obj[0];
var range = te.obj[1];
-// var div = document.body.appendChild(document.createElement('div'));
-// div.id = 'ue';
-// var editor = UE.getEditor('ue');
-// editor.ready(function () {
-// var range = new baidu.editor.dom.Range(editor.document);
+
editor.setContent('');
setTimeout(function () {
range.setStart(editor.body.firstChild, 0).collapse(true).select();
@@ -43,16 +87,10 @@ test('框选', function () {
ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 0, 0, true, '检查选中的range')
else
ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 0, true, '检查选中的range');
-// setTimeout(function () {
-// UE.delEditor('ue');
-// te.dom.push(document.getElementById('ue'));
-// te.dom.push(document.getElementById('edui_fixedlayer'));
start();
-// }, 500);
}, 20);
}, 20);
}, 50);
-// });
stop();
});
@@ -365,11 +403,6 @@ test('backspace事件:deletecol', function () {
editor.setContent('');
range.setStart(editor.body.firstChild, 0).collapse(true).select();
editor.execCommand('inserttable', {numCols: 3, numRows: 3});
-// expect(5);
-// 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]);
@@ -378,14 +411,12 @@ test('backspace事件:deletecol', function () {
ua.keydown(editor.body, {'keyCode': 8});
stop();
setTimeout(function () {
- equal(te.obj[0].body.getElementsByTagName('tr')[0].getElementsByTagName('td').length, 2, '删除整列');
- equal(te.obj[0].selection.getRange().collapsed, true, '检查光标');
- equal(te.obj[0].selection.getRange().startContainer, te.obj[0].body.getElementsByTagName('td')[0], '检查光标');
+ equal(editor.body.getElementsByTagName('tr')[0].getElementsByTagName('td').length, 2, '删除整列');
+ equal(editor.selection.getRange().collapsed, true, '检查光标');
+ equal(editor.selection.getRange().startContainer, editor.body.getElementsByTagName('td')[0], '检查光标');
start();
- }, 20);
-
+ }, 100);
});
-
test('backspace事件:delcells', function () {
//TODO
});
diff --git a/_test/plugins/time.js b/_test/plugins/time.js
index b4c8cfee3d037ec9c32ede31a62c38b8cabbd8b2..4a4adb6b5e1ee3df194725585aceaf530d23a287 100644
--- a/_test/plugins/time.js
+++ b/_test/plugins/time.js
@@ -8,6 +8,7 @@ test( '插入时间和日期', function () {
range.setStart( body.firstChild, 0 ).collapse( 1 ).select();
var date = new Date();
var h = date.getHours();
+ h = (h < 10) ? ('0' + h) : h;
var min = date.getMinutes();
min = (min < 10) ? ('0' + min) : min;
var sec = date.getSeconds();
@@ -45,6 +46,7 @@ test( '表格插入时间和日期', function () {
range.setStart( td[0], 0 ).collapse( 1 ).select();
var date = new Date();
var h = date.getHours();
+ h = (h < 10) ? ('0' + h) : h;
var min = date.getMinutes();
min = (min < 10) ? ('0' + min) : min;
var sec = date.getSeconds();
diff --git a/_test/testDesign/demo_1.3.0/uparse.html b/_test/testDesign/demo_1.3.0/uparse.html
index 699439c5a3a29b40b244a7983644b8b6e596c0bf..f70ab84745cf6d94974ac904c9ae62eb1afbd940 100644
--- a/_test/testDesign/demo_1.3.0/uparse.html
+++ b/_test/testDesign/demo_1.3.0/uparse.html
@@ -119,6 +119,53 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+ |
+
+ 1
+ |
+
+ 6
+ |
+
+ o
+ |
+
+ 6
+ |
+
+ 6
+ |
+
+ 6
+ |
+
+ 6
+ |
+
+ 6
+ |
+
+ 6
+ |
+
+
+