dragdrop.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Created with JetBrains PhpStorm.
  3. * User: Administrator
  4. * Date: 13-4-29
  5. * Time: 上午11:40
  6. * To change this template use File | Settings | File Templates.
  7. */
  8. module( 'plugins.dragdrop' );
  9. test( 'trace 3385:拖拽图像不会把p切开', function () {
  10. var editor = te.obj[0];
  11. var range = te.obj[1];
  12. var body = editor.body;
  13. stop();
  14. body.innerHTML = '<p>hel</p><img src="http://img.baidu.com/hi/jx2/j_0001.gif" width="50" height="51" _src="http://img.baidu.com/hi/jx2/j_0001.gif" style="float: right;"><p>lo<br></p>';
  15. range.selectNode(body.childNodes[1]).select();
  16. equal(body.childNodes.length,3,'img在两个p之间');
  17. equal(body.firstChild.tagName.toLowerCase(),"p",'img在两个p之间');
  18. equal(body.childNodes[1].tagName.toLowerCase(),"img",'img在两个p之间');
  19. equal(body.childNodes[2].tagName.toLowerCase(),"p",'img在两个p之间');
  20. ua.dragend(body);
  21. setTimeout(function(){
  22. equal(body.childNodes.length,1,'img在p里面');
  23. equal(body.firstChild.tagName.toLowerCase(),'p','img在p里面');
  24. equal(body.firstChild.childNodes[1].tagName.toLowerCase(),'img','img在p里面');
  25. 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>';
  26. range.selectNode(body.childNodes[1]).select();
  27. ua.dragend(body);
  28. setTimeout(function(){
  29. equal(body.childNodes.length,1,'拖拽图像不会把p切开,删除空span:img在p里面')
  30. equal(body.firstChild.tagName.toLowerCase(),'p','img在p里面');
  31. equal(body.firstChild.childNodes[1].tagName.toLowerCase(),'img','img在p里面');
  32. start();
  33. },300);
  34. },100);
  35. } );