From 185618d7685791f8cf499b9edb946477f890f034 Mon Sep 17 00:00:00 2001 From: Bryan Woods Date: Fri, 31 May 2013 15:51:15 -0400 Subject: [PATCH] Test improvements * 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. --- test/autolink-spec.coffee | 13 ++++++++++++- test/autolink-spec.js | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/test/autolink-spec.coffee b/test/autolink-spec.coffee index ac2c45c..d9b78f3 100644 --- a/test/autolink-spec.coffee +++ b/test/autolink-spec.coffee @@ -61,7 +61,7 @@ describe "autolink", -> toEqual( "Click here ftp://ftp.google.com" ) - + it "sets link attributes based on the options provided", -> expect("Google it: http://google.com".autoLink(target: "_blank")). toEqual( @@ -77,6 +77,17 @@ describe "autolink", -> "rel='nofollow'>http://google.com" ) + xit "correctly handles surrounding HTML tags", -> + expect("

http://nba.com

".autoLink()). + toEqual("

http://nba.com

") + + it "can begin with a hyperlink", -> + expect("http://google.com That is a link to Google".autoLink()). + toEqual( + "http://google.com " + + "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" diff --git a/test/autolink-spec.js b/test/autolink-spec.js index 8d3095c..70620a0 100644 --- a/test/autolink-spec.js +++ b/test/autolink-spec.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.1 (function() { describe("autolink", function() { @@ -46,6 +46,12 @@ rel: "nofollow" })).toEqual("Google it: http://google.com"); }); + xit("correctly handles surrounding HTML tags", function() { + return expect("

http://nba.com

".autoLink()).toEqual("

http://nba.com

"); + }); + it("can begin with a hyperlink", function() { + return expect("http://google.com That is a link to Google".autoLink()).toEqual("http://google.com " + "That is a link to Google"); + }); describe("callback option", function() { it("can be passed to redefine how link will be rendered", function() { return expect("Google it: http://google.com".autoLink({