rhymix/addons/autolink/autolink.spec.html
conory b1cb1f3f34 다른 프레임워크와 css 충돌을 피하기 위해 rhymix.less의 class/id 이름에 prefix 처리
변경전의 xe.less 파일도 rhymix.less와 함께 load 하여 호환정 유지

CSS 충돌 예)
bootstrap의 .btn
사용 예)
bootstrap 사용시엔 {Context::unloadBasicFiles('xe')}으로 unload 시키면 문제없음
2018-08-03 19:45:30 +09:00

112 lines
No EOL
4.3 KiB
HTML

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<title>Autolink Addon Unit Test</title>
<link rel="stylesheet" href="../../common/js/unittest/css/JSSpec.css" />
<script src="../../common/js/jquery.js"></script>
<script src="../../common/js/common.js"></script>
<script src="../../common/js/js_app.js"></script>
<script src="autolink.js"></script>
<script src="../../common/js/unittest/JSSpec/diff_match_patch.js"></script>
<script src="../../common/js/unittest/JSSpec/JSSpec.js"></script>
<script>// <![CDATA[
var testParam = null;
var TestSuite = xe.createPlugin("TestSuite", {
API_BEFORE_AUTOLINK : function(oSender, params) {
return !jQuery(params[0]).parent().is('#test7');
},
API_AFTER_AUTOLINK : function(oSender, params) {
testParam = params[0];
}
});
xe.registerPlugin(new TestSuite);
jQuery(function($){
describe('AutoLink functionality', {
"#test1 - plain text don't have any link text" : function() {
value_of( $('#test1').children().length ).should_be(0);
},
"#test2 - simple link text only" : function() {
value_of( $('#test2 > a').length > 0 ).should_be_true();
value_of( $('#test2 > a').attr('href') ).should_be($('#test2 > a').text());
value_of( $('#test2').children().length ).should_be(1);
},
"#test3 - simple link text and some text" : function() {
value_of( $('#test3 > a').length > 0 ).should_be_true();
value_of( $('#test3 > a').attr('href') ).should_be($('#test3 > a').text());
value_of( $('#test3').contents().length ).should_be(2);
},
"#test4 - complex link text only" : function() {
value_of( $('#test4 > a').length > 0 ).should_be_true();
value_of( $('#test4 > a').attr('href') ).should_be($('#test4 > a').text());
value_of( $('#test4').children().length ).should_be(1);
},
"#test5 - complex link text and some text" : function() {
value_of( $('#test5 > a').length > 0 ).should_be_true();
value_of( $('#test5 > a').attr('href') ).should_be($('#test5 > a').text());
value_of( $('#test5').contents().length ).should_be(3);
},
"#test6 - complex example" : function() {
value_of( $('#test6 a').length ).should_be(8);
value_of( $('#test6 a').eq(0).attr('href') ).should_be($('#test6 a').eq(0).text());
value_of( $('#test6 a').eq(2).parent().is('b') ).should_be_true();
value_of( $('#test6 > textarea > a').length ).should_be(0);
value_of( $('#test6 > div > a').attr("target") ).should_be("_self");
},
"#test9 - don't include parenthesis" : function() {
value_of( $('#test9 a').length ).should_be(1);
value_of( $('#test9 a').attr('href') ).should_be('http://www.naver.com');
},
"#test10 - include tild" : function() {
value_of( $('#test10 a').length ).should_be(1);
value_of( $('#test10 a').attr('href') ).should_be('http://www.xpressengine.com:8000/~user/?mid=def');
}
});
describe('Autolink trigger', {
"#test7 - ignored" : function() {
value_of( $('#test7 > a').length ).should_be(0);
},
"#test8 - parameter on after trigger" : function() {
value_of( $(testParam).is('a') ).should_be_true();
}
});
});
// ]]></script>
</head>
<body>
<div class="rhymix_content" style="display:none">
<div id="test1">This is autolink test. This text don't have any link text.</div>
<div id="test2">http://mygony.com</div>
<div id="test3">Go to http://mygony.com</div>
<div id="test4">http://www.abc.com/some_program?hello=world&encoded=%ED%C2%C1</div>
<div id="test5">Before text. http://www.abc.com/some_program?hello=world&encoded=%ED%C2%C1 After Text</div>
<div id="test6">
<p>This is text. http://www.abc.com/some_program?hello=world&encoded=%ED%C2%C1 Text Text.
Another URL : http://www.decccccf12312.co.uk/path/to/program?mymy=lovelove. XE!
<b>Bold text and http://mail.abc.com/path/to/one_cgi.cgi?hello=world#hash_text Bold text end</b>
<textarea rows="8" cols="42">this text should be ignored http://mygony.com ignored?</textarea>
<div>
Hello~
<a href="http://mygony.com" target="_self">http://mygony.com</a>
Sayonara~
</div>
IP Test http://119.205.243.46 and MMS Link mms://xpressengine.com/a.wmv
http://localhost/some/path/file.ext
Is it OK?</p>
<p>mms://xpressengine.com/a.wmv</p>
</div>
<div id="test7">http://mygony.com</div>
<div id="test8">Go to http://mygony.com</div>
<div id="test9">Naver(http://www.naver.com)</div>
<div id="test10">User homepage : http://www.xpressengine.com:8000/~user/?mid=def should be a link.</div>
</div>
</body>
</html>