Extract methods in link list component
Since we're simplifying the main method, we can use a view file instead of the `call` method. This way we make the code more consistent with the rest of our components, since we always use a separate file. Doing so generates an extra newline at the end of the generated HTML, so we need to change a couple of tests a little bit.
This commit is contained in:
@@ -21,7 +21,7 @@ describe Shared::LinkListComponent, type: :component do
|
||||
|
||||
expect(list).to eq '<ul class="menu">' + "\n" +
|
||||
'<li><a href="/">Home</a></li>' + "\n" +
|
||||
'<li><a href="/info">Info</a></li>' + "\n</ul>"
|
||||
'<li><a href="/info">Info</a></li>' + "\n</ul>\n"
|
||||
end
|
||||
|
||||
it "accepts anchor tags" do
|
||||
@@ -32,7 +32,7 @@ describe Shared::LinkListComponent, type: :component do
|
||||
|
||||
expect(list).to eq '<ul class="menu">' + "\n" +
|
||||
'<li><a href="/">Home</a></li>' + "\n" +
|
||||
'<li><a href="/info">Info</a></li>' + "\n</ul>"
|
||||
'<li><a href="/info">Info</a></li>' + "\n</ul>\n"
|
||||
end
|
||||
|
||||
it "accepts options for links" do
|
||||
|
||||
Reference in New Issue
Block a user