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
29 changes: 29 additions & 0 deletions spec/pointer_events_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require "./spec_helper"

class PointerEventsStyle < CSS::Stylesheet
rule svg do
pointer_events :auto
pointer_events :none
pointer_events :visible_painted
pointer_events :visible_fill
pointer_events :visible_stroke
pointer_events :bounding_box
end
end

describe "PointerEventsStyle.to_s" do
it "should return the correct CSS" do
expected = <<-CSS
svg {
pointer-events: auto;
pointer-events: none;
pointer-events: visiblePainted;
pointer-events: visibleFill;
pointer-events: visibleStroke;
pointer-events: bounding-box;
}
CSS

PointerEventsStyle.to_s.should eq(expected)
end
end
30 changes: 30 additions & 0 deletions src/css/enums/pointer_events.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module CSS::Enums
enum PointerEvents
Auto
BoundingBox
VisiblePainted
VisibleFill
VisibleStroke
Visible
Painted
Fill
Stroke
All
None

def to_css_value
case self
when BoundingBox
"bounding-box"
when VisiblePainted
"visiblePainted"
when VisibleFill
"visibleFill"
when VisibleStroke
"visibleStroke"
else
to_s.downcase
end
end
end
end
2 changes: 1 addition & 1 deletion src/stylesheet.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ module CSS
prop place_content, String
prop place_items, String
prop place_self, String
prop pointer_events, String
prop pointer_events, CSS::Enums::PointerEvents
prop position, CSS::Enums::Position
prop print_color_adjust, String
prop quotes, String
Expand Down