|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21585/root/home/queenjbs/xe/addons/autolink/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ko" xml:lang="ko" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Autolink Addon Unit Test</title>
<link rel="stylesheet" type="text/css" href="../../common/js/unittest/css/JSSpec.css" />
<script type="text/javascript" src="../../common/js/jquery.js"></script>
<script type="text/javascript" src="../../common/js/common.js"></script>
<script type="text/javascript" src="../../common/js/js_app.js"></script>
<script type="text/javascript" src="autolink.js"></script>
<script type="text/javascript" src="../../common/js/unittest/JSSpec/diff_match_patch.js"></script>
<script type="text/javascript" src="../../common/js/unittest/JSSpec/JSSpec.js"></script>
<script type="text/javascript">// <![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="xe_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>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>