forked from nfrasser/linkifyjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nfrasser
committed
Dec 24, 2013
1 parent
3e95fab
commit c0be459
Showing
5 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* global test:true */ | ||
/* global equal:true */ | ||
|
||
|
||
test("linkify basics", function () { | ||
|
||
var linkifyTests = [{ | ||
input: 'google.com', | ||
output: '<a href="http://google.com" class="linkified" target="_blank" >google.com</a>', | ||
options: null | ||
}, { | ||
input: 'I like google.com the most', | ||
output: 'I like <span href="http://google.com" class="linkified" target="_blank" >google.com</span> the most', | ||
options: { | ||
tagName: 'span' | ||
} | ||
}, { | ||
input: 'I like Google.com the most', | ||
output: 'I like Google.com the most', | ||
options: null | ||
}, { | ||
input: 'there are two tests, brennan.com and nick.ca -- do they work?', | ||
output: 'there are two tests, <a href="http://brennan.com" class="linkified alink" target="_parent" >brennan.com</a> and <a href="http://nick.ca" class="linkified alink" target="_parent" >nick.ca</a> -- do they work?', | ||
options: { | ||
linkClass: 'alink', | ||
target: '_parent' | ||
} | ||
}, { | ||
input: 'there are two tests!brennan.com. and nick.ca? -- do they work?', | ||
output: 'there are two tests!<a href="http://brennan.com" class="linkified alink blink" target="_blank" data-link-test="awesome" >brennan.com</a>. and <a href="http://nick.ca" class="linkified alink blink" target="_blank" data-link-test="awesome" >nick.ca</a>? -- do they work?', | ||
options: { | ||
linkClasses: ['alink', 'blink'], | ||
linkAttributes: { | ||
'data-link-test': 'awesome' | ||
} | ||
} | ||
}]; | ||
|
||
for (var i = 0; i < linkifyTests.length; i++) { | ||
equal( | ||
(new Linkified( | ||
linkifyTests[i].input, | ||
linkifyTests[i].options | ||
)).toString(), | ||
linkifyTests[i].output | ||
); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Linkify Basic Tests</title> | ||
|
||
<link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css"> | ||
<script src="../bower_components/qunit/qunit/qunit.js"></script> | ||
<script src="../src/linkified.js"></script> | ||
|
||
<script src="js/linkified.js"></script> | ||
</head> | ||
<body> | ||
|
||
<div id="qunit"></div> | ||
|
||
</body> | ||
</html> |