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('

abcdef
1999123456
'); - 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, '列数不够, 状态为禁用' ); + //
12
22
+ editor.setContent('
e
12
22
'); + range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select(); + equal( editor.queryCommandState( 'charts' ), -1, '第一行不都是th, 状态为禁用' ); + editor.setContent('
e
12
22
'); + range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select(); + equal( editor.queryCommandState( 'charts' ), -1, '第一列不是th, 状态为禁用' ); + editor.setContent('
552
2
24
'); + range.selectNode( editor.body.getElementsByTagName("td")[0]).collapse(true).select(); + equal( editor.queryCommandState( 'charts' ), -1, '每行单元格数不匹配, 状态为禁用' ); + editor.setContent('
1ee
22
'); + 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 @@
asdf




















+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 1 + + 6 + + o + + 6 + + 6 + + 6 + + 6 + + 6 + + 6 +
diff --git a/_test/testDesign/test list for 1.3.0.xmind b/_test/testDesign/test list for 1.3.0.xmind index f6759b5acf202767c43aefcecf6a3427ebf2f4ee..b4f52da6f59ab58aabb7624bbc4b45d443dd25d3 100644 Binary files a/_test/testDesign/test list for 1.3.0.xmind and b/_test/testDesign/test list for 1.3.0.xmind differ diff --git a/_test/tools/br/config.php b/_test/tools/br/config.php index 1cac816e13a9d6b747602a372fdb2f3e18730671..07206b399a4ec7d3c3046fe87b2bbf581e046d3c 100644 --- a/_test/tools/br/config.php +++ b/_test/tools/br/config.php @@ -2,8 +2,8 @@ class Config { public static $BROWSERS = array( -// 'ie8' => array( '10.81.58.64@8500' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" ) -// , + 'ie8' => array( '10.81.58.64@8500' , "C:\\Program Files\\Internet Explorer\\iexplore.exe" ) + , 'firefox' => array( '10.81.58.86@8500' , "C:\\Program Files\\mozilla firefox\\firefox.exe" ) // 'firefox' => array( '10.81.96.46@8500' , "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" ) // , '360ie8' => array('10.81.58.64@8500',"C:\\Program Files\\360\\360se\\360SE.exe") diff --git a/_test/tools/br/js/run.js b/_test/tools/br/js/run.js index 95d97fdbf835537b94f1d0d5164fccbe0a698a30..5334ec028e54f719b581f2cde56470207d752162 100644 --- a/_test/tools/br/js/run.js +++ b/_test/tools/br/js/run.js @@ -125,14 +125,18 @@ function run( kiss, runnext ) { /* 隐藏报告区 */ $( 'div#id_reportarea' ).empty().hide(); /* 展示执行区 */ -// if(ua.browser.ie){ -// if(document.frames['running'] ){ -// document.frames['running'].location.href = ''; -// document.frames['running'].location.reload(); -// } -// } - - $( 'div#id_runningarea' ).empty().css( 'display', 'block' ).append( '' ); + if(ua.browser.ie){ + if($( 'div#id_runningarea' )[0].getElementsByTagName('iframe').length){ + var iframe_old = $( 'div#id_runningarea' )[0].getElementsByTagName('iframe')[0]; + iframe_old.src = ''; + } + + } + var iframe =document.createElement('iframe'); + iframe.src= url; + iframe.id= fid; + iframe.className= "runningframe"; + $( 'div#id_runningarea' ).empty().css( 'display', 'block' ).append( iframe); wb.kissstart = new Date().getTime(); }; // 需要根据一次批量执行整合所有文件的覆盖率情况 diff --git a/jsp/imageUp.jsp b/jsp/imageUp.jsp index f3aa521675293376e83c4d97668b0cec3201c146..cb4dd0bb6d8ad3560db9addadae752cc1f7a7da1 100755 --- a/jsp/imageUp.jsp +++ b/jsp/imageUp.jsp @@ -1,13 +1,13 @@ -<%@ page language="java" contentType="text/html; charset=utf-8" - pageEncoding="utf-8"%> - <%@ page import="java.util.Properties" %> - <%@ page import="java.util.List" %> - <%@ page import="java.util.Iterator" %> - <%@ page import="java.util.Arrays" %> - <%@ page import="java.io.FileInputStream" %> - <%@ page import="ueditor.Uploader" %> + <%@ page language="java" contentType="text/html; charset=utf-8" + pageEncoding="utf-8"%> + <%@ page import="java.util.Properties" %> + <%@ page import="java.util.List" %> + <%@ page import="java.util.Iterator" %> + <%@ page import="java.util.Arrays" %> + <%@ page import="java.io.FileInputStream" %> + <%@ page import="ueditor.Uploader" %> - <% + <% request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); @@ -51,9 +51,16 @@ if ( request.getParameter( "fetch" ) != null ) { } +Uploader up = new Uploader(request); + //获取前端提交的path路径 String dir = request.getParameter( "dir" ); +//普通请求中拿不到参数, 则从上传表单中拿 +if ( dir == null ) { + dir = up.getParameter("dir"); +} + if ( dir == null || "".equals( dir ) ) { //赋予默认值 @@ -67,7 +74,6 @@ if ( dir == null || "".equals( dir ) ) { } -Uploader up = new Uploader(request); up.setSavePath( dir ); String[] fileType = {".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp"}; up.setAllowFiles(fileType); diff --git a/jsp/ueditor.jar b/jsp/ueditor.jar index 36a3be18f0f181d997445024b351861e6e222a7d..08ad759a34b571a8be3e66d091100584a24753f0 100755 Binary files a/jsp/ueditor.jar and b/jsp/ueditor.jar differ diff --git a/net/getRemoteImage.ashx b/net/getRemoteImage.ashx index bac8ba2d17af97aa2bcdb2c6c69407e00e4262a6..91612e85e94a839c5bd90ee4294d00ddecfd5bad 100755 --- a/net/getRemoteImage.ashx +++ b/net/getRemoteImage.ashx @@ -18,7 +18,7 @@ public class getRemoteImage : IHttpHandler public void ProcessRequest(HttpContext context) { - string savePath = context.Server.MapPath("upload/"); //保存文件地址 + string savePath = "upload/"; //保存文件地址 string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式 int fileSize = 3000; //文件大小限制,单位kb @@ -29,7 +29,7 @@ public class getRemoteImage : IHttpHandler ArrayList tmpNames = new ArrayList(); WebClient wc = new WebClient(); HttpWebResponse res; - String tmpName = String.Empty; + String filename = String.Empty; String imgUrl = String.Empty; String currentType = String.Empty; @@ -81,16 +81,18 @@ public class getRemoteImage : IHttpHandler } res.Close(); + var filepath = savePath + DateTime.Now.ToString("yyyy-MM-dd") + "/"; + //创建保存位置 - if (!Directory.Exists(savePath)) + if (!Directory.Exists(context.Server.MapPath(filepath))) { - Directory.CreateDirectory(savePath); + Directory.CreateDirectory(context.Server.MapPath(filepath)); } //写入文件 - tmpName = DateTime.Now.ToString("yyyy-MM-dd") + "/" + System.Guid.NewGuid() + currentType; - wc.DownloadFile(imgUrl, savePath + tmpName); - tmpNames.Add("upload/" + tmpName); + filename = filepath + System.Guid.NewGuid() + currentType; + wc.DownloadFile(imgUrl, context.Server.MapPath(filename)); + tmpNames.Add(filename); } } catch (Exception)