module( "plugins.blockquote" ); /*trace 967*/ //这个用例暂不测ie,因为ie中输入回车无效 //test( '切换到源码模式再切换回来点引用', function () { // if(!ua.browser.ie){ // var editor = te.obj[0]; // var body = editor.body; // editor.setContent( 'hello' ); // editor.execCommand( 'source' ); // var tas = editor.iframe.parentNode.getElementsByTagName( 'textarea' ); // tas[tas.length - 1].value = ''; // stop(); // setTimeout( function () { //source.js中有延时操作 // editor.execCommand( 'source' ); // editor.execCommand( 'blockquote' ); // setTimeout( function () { //模拟回车,在引用后回车两段都是引用 // //firefox竟然要多触发一次。。什么乱七八糟的bug啊 // //if ( ua.getBrowser() == "firefox" ) // //te.presskey( "enter", "" ); // editor.focus(); // te.presskey( "enter", "" ); // setTimeout( function () { // editor.focus(); // setTimeout( function () { // var bq = body.firstChild; // equal( body.childNodes.length, 1, 'body有1个孩子' ); // equal( bq.childNodes.length, 2, 'blockquote有2个孩子' ); // ok( bq.childNodes[0]&&bq.childNodes[0].tagName.toLowerCase()=='p', '第一个孩子是p' ); // ok( bq.childNodes[1]&&bq.childNodes[1].tagName.toLowerCase()=='p', '第二个孩子是p' ); // start(); // }, 50 ); // }, 30 ); // }, 60 ); // }, 50 ); // } // else // ok(ua.browser.ie,'这个用例暂不测,因为ie中输入回车无效'); //} ); test( '在表格中添加和去除引用', function () { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hello
hello |
hello1
hello2
hello1
hello2
' ); var body = editor.body; range.setStart( body, 0 ).setEnd( body, 2 ).select(); editor.execCommand( 'insertorderedlist' ); /*添加列表*/ ua.manualDeleteFillData( editor.body ); var ol = body.getElementsByTagName( 'ol' )[0]; var html = ua.getChildHTML( ol ); editor.execCommand( 'blockquote' ); editor.execCommand( 'blockquote' ); ua.manualDeleteFillData( editor.body ); equal( ua.getChildHTML( body.getElementsByTagName( 'ol' )[0] ), html, '引用前后列表没有发生变化' ); equal( body.getElementsByTagName( 'ol' ).length, 1, '只有一个有序列表' ); } ); test( 'trace 3298:对段落添加引用和去除引用', function () { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hello1
hello2 world
' ); var body = editor.body; range.setStart( body.firstChild, 0 ).setEnd( body.lastChild, 1 ).select(); /*不闭合添加引用*/ editor.execCommand( 'blockquote' ); equal( ua.getChildHTML( body ), '', '不闭合添加引用' ); equal( editor.queryCommandState( 'blockquote' ), 1, '引用高亮' ); range.setStart( body.firstChild.lastChild, 0 ).collapse( true ).select(); /*闭合去除引用*/ editor.execCommand( 'blockquote' ); equal( ua.getChildHTML( body ), 'hello1
hello2 world
hello1
hello2 world
', '闭合去除引用' ); equal( editor.queryCommandState( 'blockquote' ), 0, '引用不高亮' ); range.setStart( body.firstChild, 0 ).setEnd( body.lastChild, 1 ).select(); /*非闭合去除引用*/ editor.execCommand( 'blockquote' ); equal( ua.getChildHTML( body ), 'hello1
hello2 world
' ); equal( editor.queryCommandState( 'blockquote' ), 0, '非闭合去除引用后,引用不高亮' ); range.setStart( body.lastChild, 0 ).collapse( true ).select(); /*闭合添加引用*/ editor.execCommand( 'blockquote' ); equal( ua.getChildHTML( body ), 'hello1
', '闭合添加引用 ' ); } ); /*trace 3285*/ test( 'trace 3285:startContainer为body添加引用', function () { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hellohello2 world
', '选中body加引用' ); equal( editor.queryCommandState( 'blockquote' ), 1, '引用高亮' ); editor.undoManger.undo(); range.setStart( body, 1 ).collapse( true ).select(); /*闭合选取*/ equal( editor.queryCommandState( 'blockquote' ), 0, '引用不高亮' ); } ); //ie 不通过 test('aa标签',function(){ var editor = te.obj[0]; var range = te.obj[1]; if(!ua.browser.ie){ editor.setContent('hello
hello1
hello2
','aa标签'); editor.setContent('hellohello
hello
','hello2
hello1
hello2
hello1
hello2