提交 0c5dac78 编写于 作者: Y yancend

[case]添加dragdrop用例

上级 575dba09
......@@ -50,7 +50,7 @@
///import plugins/delete;
///import plugins/snapscreen;
///import plugins/print;
///import plugins/dragdrop;
///import plugins/searchreplace;
///import plugins/formatmatch;
///import plugins/basestyle;
......
/**
* Created with JetBrains PhpStorm.
* User: Administrator
* Date: 13-4-29
* Time: 上午11:40
* To change this template use File | Settings | File Templates.
*/
module( 'plugins.dragdrop' );
test( '拖拽图像不会把p切开', function () {
var editor = te.obj[0];
var range = te.obj[1];
var body = editor.body;
editor.setContent( '<p>hel</p><p>lo<br></p>' );
range.setStart( body, 1 ).collapse( 1 ).select();
editor.execCommand( 'insertimage', {src:'http://img.baidu.com/hi/jx2/j_0001.gif', width:50, height:51} );
range.selectNode(body.childNodes[1]).select();
editor.execCommand( 'imagefloat', 'right' );
equal(body.childNodes.length,3,'img在两个p之间');
equal(body.firstChild.tagName.toLowerCase(),"p",'img在两个p之间');
equal(body.childNodes[1].tagName.toLowerCase(),"img",'img在两个p之间');
equal(body.childNodes[2].tagName.toLowerCase(),"p",'img在两个p之间');
ua.dragend(body);
stop();
setTimeout(function(){
equal(body.childNodes.length,1,'img在p里面');
equal(body.firstChild.tagName.toLowerCase(),'p','img在p里面');
equal(body.firstChild.childNodes[1].tagName.toLowerCase(),'img','img在p里面');
start();
},30);
} );
test( '拖拽图像不会把p切开,删除空span', function () {
var editor = te.obj[0];
var range = te.obj[1];
var body = editor.body;
body.innerHTML = '<p>asds</p><img src="http://img.baidu.com/hi/jx2/j_0001.gif" _src="http://img.baidu.com/hi/jx2/j_0001.gif" width="18" height="20" border="0" hspace="0" vspace="0" title="" style="line-height: 16px; width: 18px; height: 20px; float: right;"><span style="line-height: 16px;"></span><p>ad<br></p>';
range.selectNode(body.childNodes[1]).select();
ua.dragend(body);
stop();
setTimeout(function(){
equal(body.childNodes.length,1,'img在p里面')
equal(body.firstChild.tagName.toLowerCase(),'p','img在p里面');
equal(body.firstChild.childNodes[1].tagName.toLowerCase(),'img','img在p里面');
start();
},30);
} );
\ No newline at end of file
......@@ -320,6 +320,7 @@ UserAction = {
case "mouseenter":// 非标准支持,仅为测试提供,该项仅IE下work
case "mouseleave":
case "contextmenu":
case "dragend":
case "blur":
break;
default:
......@@ -638,6 +639,19 @@ UserAction = {
contextmenu:function (target /* :HTMLElement */, options /* :Object */) /* :Void */ {
this.fireMouseEvent(target, "contextmenu", options);
},
/**
* Simulates a dragend on a particular element.
*
* @param {HTMLElement}
* target The element to show dragend.
* @param {Object}
* options Additional event options (use DOM standard names).
* @method dragend
* @static
*/
dragend:function (target /* :HTMLElement */, options /* :Object */) /* :Void */ {
this.fireMouseEvent(target, "dragend", options);
},
/**
* Simulates a blur on a particular element.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册