/** * Created by JetBrains PhpStorm. * User: dongyancen * Date: 13-2-28 * Time: 下午3:20 * To change this template use File | Settings | File Templates. */ module( 'plugins.defaultfilter' ); //test('',function(){ // stop(); //}); test( '对代码的行号不处理', function () { var editor = te.obj[0]; editor.setContent( '
1
2
'); // var br = ua.browser.ie?'':'
'; var html = '
1
2
'; ua.checkSameHtml(editor.body.innerHTML,html,'table补全,对代码的行号不处理') } ); test( '空td,th,caption', function () { var editor = te.obj[0]; editor.setContent( '
' ); var br = ua.browser.ie?'':'
'; var html = '
'+br+'
'+br+''+br+'
'+br+''+br+'
'+br+''+br+'
'; ua.checkSameHtml(editor.body.innerHTML,html,'空td,th,caption,添加text') } ); test( '转换a标签', function () { var editor = te.obj[0]; editor.setContent( '' ); var br = ua.browser.ie?' ':'
'; var html = '

'; ua.checkSameHtml(html,editor.body.innerHTML,'转换a标签'); } ); test( '转换img标签', function () { var editor = te.obj[0]; editor.setContent( '' ); // var html = '

'; equal(editor.body.getElementsByTagName('img')[0].getAttribute('_src'),"http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif"); } ); test( '删span中的white-space标签', function () { if(ua.browser.webkit){ var editor = te.obj[0]; editor.setContent( 'sadfsadf' ); var html = '

sadfsadf

'; ua.checkSameHtml(html,editor.body.innerHTML,'删span中的white-space标签'); } } ); //TODO 1.2.6 //test( '删p中的margin|padding标签', function () { // var editor = te.obj[0]; // editor.setContent( '

hello

' ); // var html = '

hello

'; // ua.checkSameHtml(html,editor.body.innerHTML,'删p中的margin|padding标签'); //} ); test( '给空p加br&&转对齐样式', function () { var editor = te.obj[0]; editor.setContent( '

' ); var br = ua.browser.ie?' ':'
'; // "


" var html = '

'+br+'

'; ua.checkSameHtml(editor.body.innerHTML,html, '给空p加br&&转对齐样式'); } ); test( '删div', function () { var editor = te.obj[0]; editor.setContent( '

视频

' ); var html = '

视频

'; ua.checkSameHtml(html,editor.body.innerHTML,'删div'); } ); test( 'allowDivTransToP--false 不转div', function () { var div = document.body.appendChild(document.createElement('div')); div.id ='ue'; var editor = UE.getEditor('ue',{allowDivTransToP:false}); stop(); editor.ready(function(){ var html = '
视频
'; editor.setContent( html ); var padding = (ua.browser.ie&&ua.browser.ie<9)?'PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 1px':'padding: 1px;'; var html_a = '
视频
'; ua.checkSameHtml(html_a,editor.body.innerHTML,'不转div'); UE.delEditor('ue'); start(); }); } ); test( 'li', function () { var editor = te.obj[0]; editor.setContent( '
  • ' ); var html = ''; ua.checkSameHtml(html,editor.body.innerHTML,'li'); } ); //
  • pistachio天
  • //TODO 现在在过滤机制里面去除无用的标签 test( "getContent--去除无用的空标签:autoClearEmptyNode==true", function() { var div = document.body.appendChild(document.createElement('div')); div.id = 'ue'; var editor = UE.getEditor('ue',{autoClearEmptyNode:true,'autoFloatEnabled':false}); // stop(); editor.ready(function () { te.dom.push(div); editor.focus(); var innerHTML = 'xxem
    xxxx
    '; editor.setContent(innerHTML); editor.execCommand('source'); setTimeout(function () { editor.execCommand('source'); setTimeout(function () { equal(editor.getContent(), '

    xxem

    xxxx

    ', "span style空,套空的em和不空的em"); //style="color:#c4bd97;" innerHTML = 'xxem'; editor.setContent(innerHTML); if (ua.browser.ie>8) { ua.checkSameHtml(editor.getContent().toLowerCase(), '

    xxem

    ', "span style不空,套空的em和不空的em"); } else { ua.checkSameHtml(editor.getContent().toLowerCase(),'

    xxem

    ', "span style不空,套空的em和不空的em"); } innerHTML = 'xxem'; editor.setContent(innerHTML); /*inline标签上只要有属性就不清理*/ if (ua.browser.ie >8) { ua.checkSameHtml(editor.getContent().toLowerCase(), '

    xxem

    ', "span 有style但内容为空"); } else { ua.checkSameHtml(editor.getContent().toLowerCase(), '

    xxem

    ', "span 有style但内容为空"); } innerHTML = 'asdfxxem'; editor.setContent(innerHTML); if (ua.browser.ie >8) { ua.checkSameHtml(editor.getContent().toLowerCase(), '

    asdfxxem

    ', "span 有style内容不空"); } else { ua.checkSameHtml(editor.getContent().toLowerCase(), '

    asdfxxem

    ', "span 有style内容不空"); } innerHTML = 'axxem'; editor.setContent(innerHTML); ua.checkSameHtml(editor.getContent(), '

    axxem

    ', "a 有href但内容为空,不过滤a标签"); setTimeout(function () { UE.delEditor('ue'); start() },300); }, 50); }, 50); }); }); //editor.options.autoClearEmptyNode test("getContent--不去除无用的空标签:autoClearEmptyNode==false", function() { var div = document.body.appendChild(document.createElement('div')); div.id = 'ue'; var editor = UE.getEditor('ue',{autoClearEmptyNode:false,'autoFloatEnabled':false}); stop(); editor.ready(function () { te.dom.push(div); editor.focus(); var innerHTML = 'xxem'; editor.setContent(innerHTML); equal(editor.getContent().toLowerCase(), '

    xxem

    ', "span style空,套空的em和不空的em"); innerHTML = 'xxem'; editor.setContent(innerHTML); ua.manualDeleteFillData(editor.body); if (ua.browser.ie >8) { ua.checkSameHtml(editor.getContent().toLowerCase(), '

    xxem

    ', "span 有style但内容为空"); } else { ua.checkSameHtml(editor.getContent().toLowerCase(), '

    xxem

    ', "span 有style但内容为空"); } setTimeout(function () { UE.delEditor('ue'); start() }, 500); }); }); test("getContent--转换空格,nbsp与空格相间显示", function() { var editor = te.obj[0]; editor.focus(); //策略改变,原nbsp不做处理,类似:'

    d

    '中的空格会被过滤 var innerHTML = '
    x x x  x    
    '; editor.setContent(innerHTML); equal(editor.getContent(), '

    x  x   x  x     

    ', "转换空格,nbsp与空格相间显示"); }); test( '转换script标签', function () { var editor = te.obj[0]; var br = ua.browser.ie?'

     

    ':(ua.browser.gecko?'
    ':'


    '); editor.setContent( '' ); var html = br+'
    ueditor
    '; ua.checkSameHtml(editor.body.innerHTML,html,'转换script标签'); } ); test( 'trace 3698 1.3.0 版本修复: script(style)标签里面的内容不转码', function () { var editor = te.obj[0]; editor.setContent(''); equal(editor.document.getElementById('myEditor').innerHTML,'var ue=UE.getEditor("editor");','内容不转码') // todo 1.3.0 trace 3698 editor.setContent(''); equal(editor.getContent(),'


    ','内容不转码'); } ); test( '转换style标签:style data不为空', function () { var editor = te.obj[0]; editor.setContent( '' ); var br = ua.browser.ie?'

     

    ':(ua.browser.gecko?'
    ':'


    '); var html = br+'
    sdf
    '; ua.checkSameHtml(editor.body.innerHTML,html,'转换script标签'); } ); test( '转换style标签:style data不空', function () { var editor = te.obj[0]; editor.setContent( '' ); var br = ua.browser.ie?'

     

    ':(ua.browser.gecko?'
    ':'


    '); var html = br+'
    '; ua.checkSameHtml(editor.body.innerHTML,html,'转换script标签'); } ); test( 'div出编辑器转换', function () { var editor = te.obj[0]; var str = '' ; var html = '
    ueditor
    '; editor.body.innerHTML = html; editor.execCommand( 'source' ); stop(); setTimeout(function(){ equal(editor.getContent(),str,'div出编辑器转换'); start(); },20); } ); test( 'img出编辑器转换', function () { var editor = te.obj[0]; var str = ua.browser.ie? '

    ':'

    ' ; if(ua.browser.ie==8) str ='

    '; var html = '

    '; editor.body.innerHTML = html; editor.execCommand( 'source' ); stop(); setTimeout(function(){ ua.checkSameHtml(editor.getContent(),str,'img出编辑器转换'); start(); },20); } ); //ue.setContent('');