Skip to content

Commit

Permalink
Remove underscored element aliases (#799)
Browse files Browse the repository at this point in the history
You’ll be able to use `tag` instead.
  • Loading branch information
joeldrapper authored Oct 3, 2024
1 parent fe60f93 commit c27229e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 44 deletions.
2 changes: 0 additions & 2 deletions lib/phlex/sgml/elements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ def #{method_name}(**attributes)
nil
end
alias_method :_#{method_name}, :#{method_name}
RUBY

__registered_elements__[method_name] = tag
Expand Down
14 changes: 0 additions & 14 deletions quickdraw/html/standard_elements.test.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# frozen_string_literal: true

Phlex::HTML::StandardElements.__registered_elements__.each do |method_name, tag|
test "<#{tag}> called with an underscore prefix while overridden" do
example = Class.new(Phlex::HTML) do
define_method :view_template do
__send__("_#{method_name}")
end

define_method method_name do
super(class: "overridden")
end
end

expect(example.call) == %(<#{tag}></#{tag}>)
end

test "<#{tag}> with block content and attributes" do
example = Class.new(Phlex::HTML) do
define_method :view_template do
Expand Down
14 changes: 0 additions & 14 deletions quickdraw/html/void_elements.test.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# frozen_string_literal: true

Phlex::HTML::VoidElements.__registered_elements__.each do |method_name, tag|
test "<#{tag}> called with an underscore prefix while overridden" do
example = Class.new(Phlex::HTML) do
define_method :view_template do
__send__("_#{method_name}")
end

define_method tag do
super(class: "overridden")
end
end

expect(example.call) == %(<#{tag}>)
end

test "<#{tag}> with attributes" do
example = Class.new(Phlex::HTML) do
define_method :view_template do
Expand Down
14 changes: 0 additions & 14 deletions quickdraw/svg/standard_elements.test.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# frozen_string_literal: true

Phlex::SVG::StandardElements.__registered_elements__.each do |method_name, tag|
test "<#{tag}> called with an underscore prefix while overridden" do
example = Class.new(Phlex::SVG) do
define_method :view_template do
__send__("_#{method_name}")
end

define_method method_name do
super(class: "overridden")
end
end

expect(example.call) == %(<#{tag}></#{tag}>)
end

test "<#{tag}> with block text content and attributes" do
example = Class.new(Phlex::SVG) do
define_method :view_template do
Expand Down

0 comments on commit c27229e

Please sign in to comment.