insertparagraph.js 643 B

123456789101112131415
  1. module( 'plugins.insertparagraph' );
  2. test( '插入空行', function() {
  3. var editor = te.obj[0];
  4. var range = te.obj[1];
  5. var body = editor.body;
  6. editor.setContent( 'hello' );
  7. range.setStart( body.firstChild, 0 ).collapse( 1 ).select();
  8. editor.execCommand( 'insertparagraph', true );
  9. var br = ua.browser.ie?'':'<br>'
  10. equal( ua.getChildHTML( body ), '<p>'+br+'</p><p>hello</p>', '插入空行' );
  11. range.setStart( body.firstChild.nextSibling, 0 ).collapse( 1 ).select();
  12. editor.execCommand( 'insertparagraph', false );
  13. equal( ua.getChildHTML( body ), '<p>'+br+'</p><p>hello</p><p>'+br+'</p>', '' );
  14. } );