module( 'plugins.indent' ); /*trace 1030*/ test( '同时加缩进和段前距', function() { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent('
hello1
hello2
'); /*selectNode不能直接选body,否则在ff下回冒到外面去了,一直回冒到外面的html上去了*/ // range.selectNode( editor.body ).select(); setTimeout(function () { range.setStart(editor.body.firstChild, 0).setEnd(editor.body.lastChild, 1).select(); editor.execCommand('rowspacing', 15, 'top'); editor.execCommand('indent'); // stop() equal(editor.body.firstChild.style['textIndent'], '2em', '查看缩进量'); equal(editor.queryCommandValue('rowspacing', 'top'), 15, '查询段前距'); start(); }, 50); stop(); } ); test( 'trace1241--首行缩进的状态反射', function() { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hello1
hello2
' ); setTimeout(function () { range.setStart(editor.body.firstChild, 0).setEnd(editor.body.lastChild, 1).select(); editor.execCommand('indent'); editor.execCommand('paragraph', 'h1'); equal(editor.queryCommandValue('paragraph'), 'h1', '段落格式为h1'); equal(editor.body.firstChild.style['textIndent'], '2em', '查看缩进量'); start(); }, 50); stop(); } ); test( '先设h1再缩进', function() { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hello1
hello2
' ); setTimeout(function () { range.setStart(editor.body.firstChild, 0).setEnd(editor.body.lastChild, 1).select(); editor.execCommand('paragraph', 'h1'); editor.execCommand('indent'); // equal(editor.queryCommandValue('paragraph'), 'h1', '段落格式为h1'); equal(editor.body.firstChild.style['textIndent'], '2em', '查看缩进量'); start(); }, 50); stop(); } ); /*trace 1479 首行缩进按钮功能有效*/ test('trace 1479 首行缩进按钮功能有效',function(){ var editor = te.obj[0]; var range = te.obj[1]; editor.setContent('hello
'); setTimeout(function () { range.setStart(editor.body.firstChild, 0).collapse(true).select(); editor.execCommand('indent'); equal(editor.body.firstChild.style['textIndent'], '2em', '选择文字,首行缩进');//text-indent:2em equal(editor.queryCommandState('indent'), 1, '缩进按钮高亮'); start(); }, 50); stop(); }); /*trace 1516 选Heading格式的文字首行缩进按钮高亮*/ test('trace 1516 选Heading格式的文字首行缩进按钮高亮',function(){ var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hello1
hello2
' ); setTimeout(function () { range.setStart(editor.body.firstChild, 0).setEnd(editor.body.lastChild, 1).select(); editor.execCommand('justify', 'right'); editor.execCommand('indent'); equal(editor.queryCommandValue('justify'), 'right', '段落格式为h1'); equal(editor.body.firstChild.style['textIndent'], '2em', '查看缩进量'); start(); }, 50); stop(); } ); test( '先缩进再对齐方式', function() { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hello1
hello2
' ); setTimeout(function () { range.setStart(editor.body.firstChild, 0).setEnd(editor.body.lastChild, 1).select(); editor.execCommand('indent'); editor.execCommand('justify', 'right'); equal(editor.queryCommandValue('justify'), 'right', '段落格式为h1'); equal(editor.body.firstChild.style['textIndent'], '2em', '查看缩进量'); start(); }, 50); stop(); } ); /*trace 1033*/ test( '非闭合取消缩进', function() { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent('hello1
hello2
'); setTimeout(function () { range.setStart(editor.body.firstChild, 0).setEnd(editor.body.lastChild, 1).select(); editor.execCommand('indent'); equal(editor.body.firstChild.style['textIndent'], '2em', '查看缩进量'); editor.execCommand('indent'); equal(editor.body.firstChild.style['textIndent'], '0em', '查看缩进量'); start(); }, 50); stop(); } ); test( '闭合取消缩进', function() { var editor = te.obj[0]; var range = te.obj[1]; editor.setContent( 'hello1
hello2
' ); setTimeout(function () { range.setStart(editor.body.firstChild, 0).setEnd(editor.body.lastChild, 1).select(); editor.execCommand('indent'); equal(editor.body.firstChild.style['textIndent'], '2em', '查看缩进量'); range.setStart(editor.body.firstChild, 0).collapse(true).select(); ua.manualDeleteFillData(editor.body); editor.execCommand('indent'); equal(editor.body.firstChild.style['textIndent'], '0em', '查看缩进量'); start(); }, 50); stop(); } ); //test( '表格内闭合缩进和取消缩进', function() { // var editor = te.obj[0]; // var range = te.obj[1]; // editor.setContent( 'hello |
hello1 | hello2 |
hello3 | hello4 |