module( 'plugins.paste' ); //不能模拟出真实的粘贴效果,此用例用于检查中间值 test( '粘贴', function() { if(ua.browser.ie || ua.browser.opera)return; var div = document.body.appendChild( document.createElement( 'div' ) ); $( div ).css( 'width', '500px' ).css( 'height', '500px' ).css( 'border', '1px solid #ccc' ); var me = te.obj[2]; me.render(div); stop(); me.ready(function(){ var range = new baidu.editor.dom.Range( te.obj[2].document ); me.focus(); me.setContent('
hello
'); range.setStart(me.body.firstChild,0).collapse(true).select(); ua.keydown(me.body,{'keyCode':65,'ctrlKey':true}); ua.keydown(me.body,{'keyCode':67,'ctrlKey':true}); setTimeout(function(){ me.focus(); range.setStart(me.body.firstChild,0).collapse(true).select(); ua.paste(me.body,{'keyCode':86,'ctrlKey':true}); equal(me.body.lastChild.id,'baidu_pastebin','检查id'); equal(me.body.lastChild.style.position,'absolute','检查style'); div.parentNode.removeChild(div); start(); },50); stop(); }); } ); //me.fireEvent('pasteTransfer','paste');//todo test( 'getClipboardData--ctrl+v', function() { // var editor = new baidu.editor.Editor( {'plugins':['paste']} ) // var div = te.dom[0]; // editor.render( div ); // editor.focus(); // editor.setContent( '你好
' ) // var doc = editor.document; // var r = new baidu.editor.dom.Range( doc ); // /*从word中粘贴的未经过滤的列表*/ // var html = 'l 列表1
l 列表2
hello
'); // editor.focus(); // // editor.execCommand('selectall'); // editor.body.document.execCommand('copy'); // editor.setContent('test
'); // editor.execCommand('selectall'); // editor.execCommand('paste'); // // setTimeout(function(){ // equal(utils.trim(editor.getContent().replace('', '').replace('', '')), '
hello
', '检查html内容,IE下成功粘贴内容'); // equal(utils.trim(editor.getContentTxt()), 'hello', '检查text内容,IE下成功粘贴内容'); // start(); // },100); // // stop(); // } // //});