Skip to content

Commit

Permalink
Test improvements
Browse files Browse the repository at this point in the history
* Adds test to ensure strings that begin with URLs are correctly
  hyperlinked

* Adds a pending test to address #7. Not sure of the best solution yet.
  • Loading branch information
bryanwoods committed May 31, 2013
1 parent 3f1e556 commit 185618d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 12 additions & 1 deletion test/autolink-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe "autolink", ->
toEqual(
"Click here <a href='ftp://ftp.google.com'>ftp://ftp.google.com</a>"
)

it "sets link attributes based on the options provided", ->
expect("Google it: http://google.com".autoLink(target: "_blank")).
toEqual(
Expand All @@ -77,6 +77,17 @@ describe "autolink", ->
"rel='nofollow'>http://google.com</a>"
)

xit "correctly handles surrounding HTML tags", ->
expect("<p>http://nba.com</p>".autoLink()).
toEqual("<p><a href='http://nba.com'>http://nba.com</a></p>")

it "can begin with a hyperlink", ->
expect("http://google.com That is a link to Google".autoLink()).
toEqual(
"<a href='http://google.com'>http://google.com</a> " +
"That is a link to Google"
)

describe "callback option", ->
it "can be passed to redefine how link will be rendered", ->
expect("Google it: http://google.com"
Expand Down
8 changes: 7 additions & 1 deletion test/autolink-spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 185618d

Please sign in to comment.