Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_14980201
ueditor
提交
41ca1f74
U
ueditor
项目概览
qq_14980201
/
ueditor
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
ueditor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
41ca1f74
编写于
3月 01, 2013
作者:
L
luqiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【test】整理用例plugins/anchor
上级
963fda19
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
50 deletion
+7
-50
_test/plugins/anchor.js
_test/plugins/anchor.js
+7
-50
未找到文件。
_test/plugins/anchor.js
浏览文件 @
41ca1f74
...
...
@@ -5,17 +5,14 @@ test( '插入锚点后切换源码', function() {
var
range
=
te
.
obj
[
1
];
var
body
=
editor
.
body
;
stop
();
//1.2版本,ie中‘’-〉' '
var
br
=
baidu
.
editor
.
browser
.
ie
?
'
'
:
'
<br />
'
;
var
br
=
baidu
.
editor
.
browser
.
ie
?
'
'
:
'
<br />
'
;
//1.2版本,ie中‘’-〉' '
setTimeout
(
function
()
{
editor
.
setContent
(
'
<p>
'
+
br
+
'
</p>
'
);
range
.
setStart
(
body
.
firstChild
,
0
).
collapse
(
1
).
select
();
editor
.
execCommand
(
'
anchor
'
,
'
hello
'
);
//1.2版本后,在img前有的不可见字符没有删去,这里改成之比较img内的内容
// ua.checkHTMLSameStyle( '<img anchorname="hello" class="anchorclass">' + br, editor.document, body.firstChild, '检查锚点html' );
ua
.
checkHTMLSameStyle
(
'
<img anchorname="hello" class="anchorclass">
'
+
br
,
editor
.
document
,
body
.
firstChild
,
'
检查锚点html
'
);
//1.2版本后,在img前有的不可见字符没有删去,这里改成之比较img内的内容
ok
(
body
.
getElementsByTagName
(
'
img
'
)[
0
].
attributes
[
'
anchorname
'
].
nodeValue
==
"
hello
"
&&
body
.
getElementsByTagName
(
'
img
'
)[
0
].
attributes
[
'
class
'
].
nodeValue
==
"
anchorclass
"
,
'
检查锚点
'
);
editor
.
execCommand
(
'
source
'
);
/*切到源码模式下会有一个超时*/
editor
.
execCommand
(
'
source
'
);
/*切到源码模式下会有一个超时*/
setTimeout
(
function
()
{
var
tas
=
editor
.
iframe
.
parentNode
.
getElementsByTagName
(
'
textarea
'
);
ok
(
tas
[
0
].
value
.
indexOf
(
'
<a name="hello"
'
)
!=
-
1
||
tas
[
0
].
value
.
indexOf
(
'
<a anchorname="1"
'
)
!=
-
1
,
'
查看是否转换成功
'
);
...
...
@@ -29,55 +26,18 @@ test( '插入锚点后切换源码', function() {
},
10
);
},
20
);
}
);
//两次设定textarea中的内容总会出错,把这个用例拆成两个
//test( '在源码模式设置超链接的name属性,切换到编辑器模式检查超链接是否变为锚点', function() {
// var editor = te.obj[0];
// editor.setContent( '' );
// var body = editor.body;
// stop();
// /*切到源码模式下会有一个超时*/
// setTimeout( function() {
// editor.execCommand( 'source' );
// setTimeout( function() {
// var ta = editor.iframe.parentNode.getElementsByTagName( 'textarea' )[0];
// /*这种情况认为是锚点*/
//// ta.value
//// ta.textContent='<p><a name="source" anchorname="1"></a></p>';
// ta.value = '<p><a name="source" anchorname="1"></a></p>';
// setTimeout( function() {
// editor.execCommand( 'source' );
// ua.checkHTMLSameStyle( '<img anchorname="source" class="anchorclass">', editor.document, body.firstChild, '检查锚点html' );
// /*这种情况不应当转换为锚点*/
// editor.execCommand( 'source' );
// setTimeout( function() {
//// ta = editor.iframe.parentNode.getElementsByTagName( 'textarea' )[0];
// editor.iframe.parentNode.getElementsByTagName( 'textarea' )[0].value = '<p><a name="source">你好</a></p>';
// setTimeout( function() {
// editor.execCommand( 'source' );
// equal( body.firstChild.firstChild.tagName.toLowerCase(), 'a', 'a标签不会转化' );
// /*用例结束前等一下,因为还有个超时操作会获取窗口*/
// setTimeout( function() {
// start();
// }, 50 );
// }, 50 );
// }, 50 );
// }, 20 );
// }, 10 );
// }, 20 );
//} );
test
(
'
在源码模式设置超链接的name属性,切换到编辑器模式检查超链接是否变为锚点
'
,
function
()
{
var
editor
=
te
.
obj
[
0
];
var
body
=
editor
.
body
;
stop
();
setTimeout
(
function
(){
editor
.
setContent
(
''
);
/*切到源码模式下会有一个超时*/
setTimeout
(
function
()
{
editor
.
execCommand
(
'
source
'
);
setTimeout
(
function
()
{
var
ta
=
editor
.
iframe
.
parentNode
.
getElementsByTagName
(
'
textarea
'
)[
0
];
/*这种情况认为是锚点*/
ta
.
value
=
'
<p><a name="source" anchorname="1"></a></p>
'
;
ta
.
value
=
'
<p><a name="source" anchorname="1"></a></p>
'
;
/*这种情况认为是锚点*/
setTimeout
(
function
()
{
editor
.
execCommand
(
'
source
'
);
ua
.
checkHTMLSameStyle
(
'
<img anchorname="source" class="anchorclass">
'
,
editor
.
document
,
body
.
firstChild
,
'
检查锚点html
'
);
...
...
@@ -88,22 +48,20 @@ test( '在源码模式设置超链接的name属性,切换到编辑器模式检
},
100
);
}
);
test
(
'
在源码模式设置超链接没有name属性,切换到编辑器模式检查超链接不变为锚点
'
,
function
()
{
var
editor
=
te
.
obj
[
0
];
editor
.
setContent
(
''
);
var
body
=
editor
.
body
;
stop
();
/*切到源码模式下会有一个超时*/
setTimeout
(
function
()
{
editor
.
execCommand
(
'
source
'
);
setTimeout
(
function
()
{
var
ta
=
editor
.
iframe
.
parentNode
.
getElementsByTagName
(
'
textarea
'
)[
0
];
ta
.
value
=
'
<p><a name="source">你好</a></p>
'
;
ta
.
value
=
'
<p><a name="source"
href="www.baidu.com"
>你好</a></p>
'
;
setTimeout
(
function
()
{
editor
.
execCommand
(
'
source
'
);
ua
.
manualDeleteFillData
(
editor
.
body
);
equal
(
body
.
firstChild
.
firstChild
.
tagName
.
toLowerCase
(),
'
a
'
,
'
a标签不会转化
'
);
start
();
},
50
);
...
...
@@ -120,7 +78,6 @@ test( '已存在锚点', function() {
range
.
selectNode
(
body
.
firstChild
).
select
();
editor
.
execCommand
(
'
anchor
'
,
'
hello
'
);
var
name
=
body
.
firstChild
.
firstChild
.
getAttribute
(
'
anchorname
'
);
// equal(ua.getChildHTML(editor.body),'<p><img anchorname=\"hello\" class=\"anchorclass\" _src=\"undefined\"></p>','更改name');
equal
(
name
,
'
hello
'
,
'
更改name
'
);
editor
.
setContent
(
'
<p><img anchorname="1" class="anchorclass"/></p>
'
);
range
.
selectNode
(
body
.
firstChild
).
select
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录