commit
02c0e1ce9b
3 changed files with 5 additions and 4 deletions
|
@ -1,9 +1,6 @@
|
||||||
module Microformats2
|
module Microformats2
|
||||||
module Property
|
module Property
|
||||||
class DateTime < Foundation
|
class DateTime < Foundation
|
||||||
def to_s
|
|
||||||
@to_s ||= value_class_pattern || element_value || text_value
|
|
||||||
end
|
|
||||||
|
|
||||||
def value
|
def value
|
||||||
::DateTime.parse(to_s)
|
::DateTime.parse(to_s)
|
||||||
|
|
|
@ -2,7 +2,7 @@ module Microformats2
|
||||||
module Property
|
module Property
|
||||||
class Embedded < Foundation
|
class Embedded < Foundation
|
||||||
def to_s
|
def to_s
|
||||||
@to_s ||= @element.inner_html.strip
|
@to_s ||= string_value || @element.inner_html.strip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -83,6 +83,10 @@ describe Microformats2::Collection do
|
||||||
@collection.first.add_property("p-foo", value)
|
@collection.first.add_property("p-foo", value)
|
||||||
@collection.first.to_json.should include(value)
|
@collection.first.to_json.should include(value)
|
||||||
end
|
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
|
it "raises a InvalidPropertyPrefix error if the prefix is invalid" do
|
||||||
expect {
|
expect {
|
||||||
@collection.first.add_property("xxx-foo", value)
|
@collection.first.add_property("xxx-foo", value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue