Skip to content

Commit 340d6ae

Browse files
Merge pull request #223 from basemate/issue-123
Adds aside component to main components
2 parents 627d275 + afa4079 commit 340d6ae

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
%aside{@tag_attributes}
2+
- if block_given?
3+
= yield
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Matestack::Ui::Core::Aside
2+
class Aside < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end

docs/components/aside.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# matestack core component: Aside
2+
3+
Show [specs](/spec/usage/components/aside_spec.rb)
4+
5+
The HTML `<aside>` tag implemented in ruby.
6+
7+
## Parameters
8+
9+
This component can take 2 optional configuration params and optional content.
10+
11+
#### # id (optional)
12+
Expects a string with all ids the aside tag should have.
13+
14+
#### # class (optional)
15+
Expects a string with all classes the aside tag should have.
16+
17+
## Example 1
18+
19+
```ruby
20+
aside id: "foo", class: "bar" do
21+
paragraph text: "This is some text"
22+
end
23+
```
24+
25+
returns
26+
27+
```html
28+
<aside id="foo" class="bar">
29+
<p>This is some text</p>
30+
</aside>
31+
```

spec/usage/components/aside_spec.rb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
require_relative "../../support/utils"
2+
include Utils
3+
4+
describe "Aside Component", type: :feature, js: true do
5+
it "Example 1" do
6+
class ExamplePage < Matestack::Ui::Page
7+
8+
def response
9+
components {
10+
#simple aside
11+
aside
12+
13+
#simple aside with attributes
14+
aside id: "my-id", class: "my-class"
15+
16+
#nested aside
17+
aside do
18+
paragraph text: "This is some text"
19+
end
20+
}
21+
end
22+
23+
end
24+
25+
visit "/example"
26+
27+
static_output = page.html
28+
29+
expected_static_output = <<~HTML
30+
<aside></aside>
31+
32+
<aside id="my-id" class="my-class"></aside>
33+
34+
<aside>
35+
<p>This is some text</p>
36+
</aside>
37+
HTML
38+
39+
expect(stripped(static_output)).to include(stripped(expected_static_output))
40+
end
41+
42+
end
43+
44+

0 commit comments

Comments
 (0)