diff --git a/spec/lib/microformats2/collection_spec.rb b/spec/lib/microformats2/collection_spec.rb index 44e5c49..55b6b1e 100644 --- a/spec/lib/microformats2/collection_spec.rb +++ b/spec/lib/microformats2/collection_spec.rb @@ -138,6 +138,20 @@ describe Microformats2::Collection do end end + describe "nested-format-with-property-of-same-name.html" do + before do + html = "spec/support/lib/microformats2/nested-format-with-property-of-same-name.html" + @collection = Microformats2.parse(html) + end + describe "#to_json" do + it "should match nested-format-with-property-of-same-name.js" do + json = "spec/support/lib/microformats2/nested-format-with-property-of-same-name.js" + json = open(json).read + JSON.parse(@collection.to_json).should == JSON.parse(json) + end + end + end + describe "nested-format-with-property.html" do before do html = "spec/support/lib/microformats2/nested-format-with-property.html" diff --git a/spec/support/lib/microformats2/nested-format-with-property-of-same-name.html b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.html new file mode 100644 index 0000000..4b858d9 --- /dev/null +++ b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.html @@ -0,0 +1,13 @@ + + + +
+
+ + 123 Rainbow Lane + + +
+
+ + diff --git a/spec/support/lib/microformats2/nested-format-with-property-of-same-name.js b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.js new file mode 100644 index 0000000..9114012 --- /dev/null +++ b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.js @@ -0,0 +1,16 @@ +{ "items": [{ + "type": ["h-card"], + "properties": { + "adr": [{ + "value": "123 Rainbow Lane", + "type": ["h-adr"], + "properties": { + "street-address": ["123 Rainbow Lane"], + "name": ["123 Rainbow Lane"] + } + }], + "name": ["123 Rainbow Lane"] + } + }], + "rels": {} +}