about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorAlan Pearce2014-10-10 16:23:32 +0100
committerAlan Pearce2014-10-10 16:23:32 +0100
commit3213c0c46a152e709772f0818a9281f5ce0e1988 (patch)
tree8aeba85dd1a45b6ae06a01497e993bcd52b754ca /test
parent49ed30908feb17d4ca6ea5dd2536b7cf79e395d1 (diff)
downloadmicroformats-3213c0c46a152e709772f0818a9281f5ce0e1988.tar.lz
microformats-3213c0c46a152e709772f0818a9281f5ce0e1988.tar.zst
microformats-3213c0c46a152e709772f0818a9281f5ce0e1988.zip
Normalise parsed URLs
Diffstat (limited to 'test')
-rw-r--r--test/microformats/parser_expectations.clj25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/microformats/parser_expectations.clj b/test/microformats/parser_expectations.clj
index 6ce942e..92e4448 100644
--- a/test/microformats/parser_expectations.clj
+++ b/test/microformats/parser_expectations.clj
@@ -157,6 +157,11 @@
 (expect {:author '("http://example.com/a")}
         (parse-rels (snippets "<a rel=\"author\" href=\"http://example.com/a\">author a</a>")))
 
+(expect {:author '("http://example.com/a")}
+        (parse-rels (snippets "
+<html><head><base href=\"http://example.com\"><body>
+<a rel=\"author\" href=\"/a\">author a</a>")))
+
 (expect {:author '("http://example.com/a" "http://example.com/b")}
         (parse-rels (snippets "<a rel=\"author\" href=\"http://example.com/a\">author a</a>
 <a rel=\"author\" href=\"http://example.com/b\">author b</a>")))
@@ -276,3 +281,23 @@
 <span class=\"p-name\">John Doe</span>
 <span class=\"p-org h-card h-org\">Example</span>
 </div>"))
+
+(expect {:items '({:type ("h-card") :properties {:name ("Example User") :url ("http://example.com/")}}) :rels {}}
+        (parse "<html><head><base href=\"http://example.com\"></head><body>
+<div class=\"h-card\"><a class=\"u-url\" href=\"/\">Example User</a></div></body></html>"))
+
+(expect {:items '({:type ("h-card") :properties {:name ("Example User") :url ("http://example.com/")}}) :rels {}}
+        (parse "<html><head><base href=\"http://example.com\"></head><body>
+<div class=\"h-card\"><a href=\"/\">Example User</a></div></body></html>"))
+
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")
+                                                 :photo ("http://example.com/me.png")}}) :rels {}}
+        (parse "<html><head><base href=\"http://example.com/\"></head><body>
+<div class=\"h-card\"><img alt=\"Example User\" src=\"me.png\"></div>
+</body></html>"))
+
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")
+                                                 :photo ("http://example.com/me.png")}}) :rels {}}
+        (parse "<html><head><base href=\"http://example.com/\"></head><body>
+<div class=\"h-card\"><img class=\"u-photo\" alt=\"Example User\" src=\"me.png\"></div>
+</body></html>"))