Normalize u-* property values

This commit is contained in:
Jessica Lynn Suttles 2013-11-04 15:13:34 -08:00
parent c7a9820168
commit e65c1a2407
10 changed files with 42 additions and 18 deletions

View file

@ -35,13 +35,13 @@ describe Microformats2::Collection do
@collection.card.name.should be_kind_of Microformats2::Property::Text
end
end
describe "'.h-card .p-url'" do
describe "'.h-card .u-url'" do
it "assigns all urls to HCard#urls" do
urls = ["http://flickr.com/jlsuttles", "http://twitter.com/jlsuttles"]
urls = ["http://example.org/", "http://flickr.com/", "http://twitter.com/jlsuttles"]
@collection.card.urls.map(&:to_s).should == urls
end
it "assigns then first url to HCard#url" do
@collection.card.url.to_s.should == "http://flickr.com/jlsuttles"
@collection.card.url.to_s.should == "http://example.org/"
end
it "HCard#url is a Property::Url" do
@collection.card.url.should be_kind_of Microformats2::Property::Url
@ -176,7 +176,7 @@ describe Microformats2::Collection do
end
end
end
describe "rels.html" do
before do
html = "spec/support/lib/microformats2/rels.html"

View file

@ -1,10 +1,14 @@
<!DOCTYPE html>
<html>
<base href="http://example.org/">
<body>
<div class="h-card">
<a href="http://flickr.com/jlsuttles" class="u-url p-name">
<a href="/" class="u-url p-name">
Jessica Lynn Suttles
</a>
<a href="http://flickr.com" class="u-url">
@jlsuttles
</a>
<a href="http://twitter.com/jlsuttles" class="u-url">
@jlsuttles
</a>

View file

@ -1,7 +1,7 @@
{ "items": [{
"type": ["h-card"],
"properties": {
"url": ["http://flickr.com/jlsuttles", "http://twitter.com/jlsuttles"],
"url": ["http://example.org/", "http://flickr.com/", "http://twitter.com/jlsuttles"],
"name": ["Jessica Lynn Suttles"],
"bday": ["1990-10-15"],
"content": ["<p>Vegan. Cat lover. Coder.</p>"]