commit: 4a456eff42a97a5d3902af4a099c9ed092f5d2b1
parent: 7858b65ae9459cd0f899e234aaa244faaca215df
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 27 Feb 2019 06:55:36 +0100
Fix schemes in tests
Diffstat:
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/auto_linker/parser.ex b/lib/auto_linker/parser.ex
@@ -12,7 +12,7 @@ defmodule AutoLinker.Parser do
## Examples
- iex> AutoLinker.Parser.parse("Check out http://google.com/")
+ iex> AutoLinker.Parser.parse("Check out http://google.com")
~s{Check out <a href="http://google.com" class="auto-linker" target="_blank" rel="noopener noreferrer">http://google.com</a>}
"""
diff --git a/test/auto_linker_test.exs b/test/auto_linker_test.exs
@@ -4,7 +4,7 @@ defmodule AutoLinkerTest do
test "default link" do
assert AutoLinker.link("http://google.com") ==
- "<a href=\"http://google.com\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">google.com</a>"
+ "<a href=\"http://google.com\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">http://google.com</a>"
end
test "markdown" do
@@ -25,10 +25,10 @@ defmodule AutoLinkerTest do
test "all kinds of links" do
text =
- "hello google.com https://ddg.com 888 888-8888 mailto:user@email.com [google.com](http://google.com)"
+ "hello http://google.com https://ddg.com 888 888-8888 mailto:user@email.com [google.com](http://google.com)"
expected =
- "hello <a href=\"http://google.com\">http://google.com</a> <a href=\"https://ddg.com\">https://ddg.com</a> 888 888-8888 <a href=\"mailto:user@email.com\">mailto:user@email.com</a> <a href='http://google.com'>http://google.com</a>"
+ "hello <a href=\"http://google.com\">http://google.com</a> <a href=\"https://ddg.com\">https://ddg.com</a> 888 888-8888 <a href=\"mailto:user@email.com\">mailto:user@email.com</a> <a href='http://google.com'>google.com</a>"
assert AutoLinker.link(text,
markdown: true,
@@ -40,9 +40,9 @@ defmodule AutoLinkerTest do
end
test "rel as function" do
- text = "google.com"
+ text = "http://google.com"
- expected = "<a href=\"http://google.com\" rel=\"com\">google.com</a>"
+ expected = "<a href=\"http://google.com\" rel=\"com\">http://google.com</a>"
custom_rel = fn url ->
url |> String.split(".") |> List.last()
@@ -191,7 +191,7 @@ defmodule AutoLinkerTest do
text = "#test http://google.com/#test #tag"
expected =
- "<a href=\"https://example.com/tag/test\">#test</a> <a href=\"http://google.com/#test\">google.com/#test</a> <a href=\"https://example.com/tag/tag\">#tag</a>"
+ "<a href=\"https://example.com/tag/test\">#test</a> <a href=\"http://google.com/#test\">http://google.com/#test</a> <a href=\"https://example.com/tag/tag\">#tag</a>"
assert AutoLinker.link(text,
scheme: true,
@@ -301,10 +301,10 @@ defmodule AutoLinkerTest do
end
test "email" do
- text = "user@example.com"
+ text = "mailto:user@example.com"
expected =
- "<a href=\"mailto:user@example.com\" class=\"auto-linker\">mailto:user@example.com</a>"
+ "<a href=\"mailto:user@example.com\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">mailto:user@example.com</a>"
assert AutoLinker.link(text) == expected
end