Support for string arg on Embedded
This commit is contained in:
parent
e924f0d5d3
commit
f7fd944446
2 changed files with 5 additions and 1 deletions
|
@ -2,7 +2,7 @@ module Microformats2
|
|||
module Property
|
||||
class Embedded < Foundation
|
||||
def to_s
|
||||
@to_s ||= @element.inner_html.strip
|
||||
@to_s ||= string_value || @element.inner_html.strip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -83,6 +83,10 @@ describe Microformats2::Collection do
|
|||
@collection.first.add_property("p-foo", value)
|
||||
@collection.first.to_json.should include(value)
|
||||
end
|
||||
it "supports Embedded" do
|
||||
@collection.first.add_property("e-foo", value)
|
||||
@collection.first.foo.to_s.should == value
|
||||
end
|
||||
it "raises a InvalidPropertyPrefix error if the prefix is invalid" do
|
||||
expect {
|
||||
@collection.first.add_property("xxx-foo", value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue