You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it(`when the url is surrounded by square brackets, it should not include
685
+
should not include the final closing bracket in the URL`,
686
+
()=>{
687
+
letresult=autolinker.link("Click here [google.com] for more details");
688
+
expect(result).toBe('Click here [<a href="http://google.com">google.com</a>] for more details');
689
+
});
690
+
691
+
692
+
it(`when the URL starts with a scheme, and is surrounded by square
693
+
brackets, should not include the final closing bracket in the URL
694
+
(Issue #228)`,
695
+
()=>{
696
+
letresult=autolinker.link("Click here [http://example.com] for more details");
697
+
expect(result).toBe('Click here [<a href="http://example.com">example.com</a>] for more details');
698
+
});
699
+
700
+
701
+
it(`when the URL ends with a closing square bracket, but there is no
702
+
matching open square bracket, should not include the final closing
703
+
bracket in the URL (Issue #228)`,
704
+
()=>{
705
+
letresult=autolinker.link("Click here [cat http://example.com] for more details");
706
+
expect(result).toBe('Click here [cat <a href="http://example.com">example.com</a>] for more details');
707
+
});
708
+
709
+
710
+
it("should not include a final closing bracket in the URL when a path exists",function(){
711
+
letresult=autolinker.link("Click here [google.com/abc] for more details");
712
+
expect(result).toBe('Click here [<a href="http://google.com/abc">google.com/abc</a>] for more details');
713
+
});
714
+
715
+
716
+
it("should not include a final closing bracket in the URL when a query string exists",function(){
717
+
letresult=autolinker.link("Click here [google.com?abc=1] for more details");
718
+
expect(result).toBe('Click here [<a href="http://google.com?abc=1">google.com?abc=1</a>] for more details');
719
+
});
720
+
721
+
722
+
it("should not include a final closing bracket in the URL when a hash anchor exists",function(){
723
+
letresult=autolinker.link("Click here [google.com#abc] for more details");
724
+
expect(result).toBe('Click here [<a href="http://google.com#abc">google.com#abc</a>] for more details');
725
+
});
726
+
727
+
728
+
it("should include escaped brackets in the URL",function(){
729
+
letresult=autolinker.link("Here's an example from CodingHorror: http://en.wikipedia.org/wiki/PC_Tools_%5BCentral_Point_Software%5D");
730
+
expect(result).toBe('Here\'s an example from CodingHorror: <a href="http://en.wikipedia.org/wiki/PC_Tools_%5BCentral_Point_Software%5D">en.wikipedia.org/wiki/PC_Tools_[Central_Point_Software]</a>');
731
+
});
732
+
733
+
734
+
it(`should correctly accept square brackets such as PHP array
735
+
representation in query strings`,
736
+
()=>{
737
+
letresult=autolinker.link("Here's an example: http://www.example.com/foo.php?bar[]=1&bar[]=2&bar[]=3");
738
+
expect(result).toBe(`Here's an example: <a href="http://www.example.com/foo.php?bar[]=1&bar[]=2&bar[]=3">example.com/foo.php?bar[]=1&bar[]=2&bar[]=3</a>`);
739
+
});
740
+
741
+
742
+
it(`should correctly accept square brackets such as PHP array
743
+
representation in query strings, when the entire URL is surrounded
744
+
by square brackets`,
745
+
()=>{
746
+
letresult=autolinker.link("Here's an example: [http://www.example.com/foo.php?bar[]=1&bar[]=2&bar[]=3]");
747
+
expect(result).toBe(`Here's an example: [<a href="http://www.example.com/foo.php?bar[]=1&bar[]=2&bar[]=3">example.com/foo.php?bar[]=1&bar[]=2&bar[]=3</a>]`);
0 commit comments