-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de2e0fb
commit 3fbc982
Showing
8 changed files
with
115 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
{ div: "div" }.each do |method_name, tag| | ||
describe "<#{tag}> with class array attribute" do | ||
test "<#{tag}> with class array attribute" do | ||
example = Class.new(Phlex::HTML) do | ||
define_method :view_template do | ||
__send__(method_name, class: ["class", nil, inactive: false, truthy: 1]) { "content" } | ||
end | ||
end | ||
|
||
test "produces the correct output" do | ||
expect(example.call) == %(<#{tag} class="class truthy">content</#{tag}>) | ||
end | ||
expect(example.call) == %(<#{tag} class="class truthy">content</#{tag}>) | ||
end | ||
|
||
describe "<#{tag}> with class hash attribute" do | ||
test "<#{tag}> with class hash attribute" do | ||
example = Class.new(Phlex::HTML) do | ||
define_method :view_template do | ||
__send__(method_name, class: { class: true, inactive: false, truthy: 1 }) { "content" } | ||
end | ||
end | ||
|
||
test "produces the correct output" do | ||
expect(example.call) == %(<#{tag} class="class truthy">content</#{tag}>) | ||
end | ||
expect(example.call) == %(<#{tag} class="class truthy">content</#{tag}>) | ||
end | ||
|
||
describe "<#{tag}> with style array attribute" do | ||
test "<#{tag}> with style array attribute" do | ||
example = Class.new(Phlex::HTML) do | ||
define_method :view_template do | ||
__send__(method_name, style: ["color: red", nil, font_weight: "bold", opacity: 0]) { "content" } | ||
end | ||
end | ||
|
||
test "produces the correct output" do | ||
expect(example.call) == %(<#{tag} style="color: red;font-weight:bold;opacity:0;">content</#{tag}>) | ||
end | ||
expect(example.call) == %(<#{tag} style="color: red;font-weight:bold;opacity:0;">content</#{tag}>) | ||
end | ||
|
||
describe "<#{tag}> with style hash attribute" do | ||
test "<#{tag}> with style hash attribute" do | ||
example = Class.new(Phlex::HTML) do | ||
define_method :view_template do | ||
__send__(method_name, style: { color: "red", word_break: nil, font_weight: "bold" }) { "content" } | ||
end | ||
end | ||
|
||
test "produces the correct output" do | ||
expect(example.call) == %(<#{tag} style="color:red;font-weight:bold;">content</#{tag}>) | ||
end | ||
expect(example.call) == %(<#{tag} style="color:red;font-weight:bold;">content</#{tag}>) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.