/**
* Created by JetBrains PhpStorm.
* User: dongyancen
* Date: 12-3-26
* Time: 下午3:05
* To change this template use File | Settings | File Templates.
*/
module('plugins.wordimage');
test('检查取得word_img的url地址', function () {
var editor = te.obj[0];
editor.setContent('


');
stop();
setTimeout(function () {
editor.execCommand('wordimage', 'word_img');
equal(editor.body.getElementsByTagName('img')[0].getAttribute('word_img'), "file:///C:DOCUME~1DONGYA~1LOCALS~1Tempmsohtmlclip1clip_image001.gif", '检查url地址');
editor.setContent('


');
setTimeout(function () {
editor.execCommand('wordimage', 'word_img');
// equal(editor.word_img.length, '2', '有2个wordimg');
equal(editor.body.getElementsByTagName('img')[0].getAttribute('word_img'), "file:///C:\DOCUME~1\DONGYA~1\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.jpg", '检查 第一个url地址');
equal(editor.body.getElementsByTagName('img')[1].getAttribute('word_img'), "file:///C:\DOCUME~1\DONGYA~1\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.gif", '检查 第二个url地址');
equal(editor.queryCommandState('wordimage'), '1', 'queryCommandState');
start();
}, 50);
}, 50);
});
test('多实例编辑器检查取得word_img的url地址', function () {
var div1 = document.createElement('div');
var div2 = document.createElement('div');
document.body.appendChild(div1);
document.body.appendChild(div2);
var editor1 = new UE.Editor({'initialContent':'

','autoFloatEnabled':false});
var editor2 = new UE.Editor({'initialContent':'


', 'autoFloatEnabled':false});
stop();
setTimeout(function () {
editor1.render(div1);
editor1.ready(function () {
editor2.render(div2);
editor2.ready(function () {
editor1.focus();
editor1.execCommand('wordimage', 'word_img');
// equal(editor1.word_img.length, '1', 'editor1有一个wordimg');
equal(editor1.body.getElementsByTagName('img')[0].getAttribute('word_img'), "file:///C:DOCUME~1DONGYA~1LOCALS~1Tempmsohtmlclip1clip_image001.gif", '检查url地址');
editor2.execCommand('wordimage', 'word_img');
// equal(editor2.word_img.length, '2', 'editor2有2个wordimg');
equal(editor2.body.getElementsByTagName('img')[0].getAttribute('word_img'), "file:///C:\DOCUME~1\DONGYA~1\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.jpg", '检查 第一个url地址');
equal(editor2.body.getElementsByTagName('img')[1].getAttribute('word_img'), "file:///C:\DOCUME~1\DONGYA~1\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.gif", '检查 第二个url地址');
equal(editor1.queryCommandState('wordimage'), '1', 'queryCommandState');
equal(editor2.queryCommandState('wordimage'), '1', 'queryCommandState');
start();
});
});
});
});