Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions spec/object_fit_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require "./spec_helper"

class ObjectFitStyle < CSS::Stylesheet
rule img do
object_fit :fill
object_fit :contain
object_fit :cover
object_fit :none
object_fit :scale_down
end
end

describe "ObjectFitStyle.to_s" do
it "should return the correct CSS" do
expected = <<-CSS
img {
object-fit: fill;
object-fit: contain;
object-fit: cover;
object-fit: none;
object-fit: scale-down;
}
CSS

ObjectFitStyle.to_s.should eq(expected)
end
end
7 changes: 7 additions & 0 deletions src/css/enums/object_fit.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
css_enum ObjectFit do
Fill
Contain
Cover
None
ScaleDown
end
2 changes: 1 addition & 1 deletion src/stylesheet.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ module CSS
prop min_inline_size, CSS::LengthPercentage | CSS::Enums::Size | CSS::Enums::Auto
prop min_width, CSS::LengthPercentage | CSS::Enums::Size | CSS::Enums::Auto
prop mix_blend_mode, String
prop object_fit, String
prop object_fit, CSS::Enums::ObjectFit
prop object_position, String
prop offset, String
prop offset_anchor, String
Expand Down