File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ The HTML legend tag implemented in ruby.
9
9
This component can take 2 optional configuration params and optional content.
10
10
11
11
#### # id (optional)
12
- Expects a string with all ids the main should have.
12
+ Expects a string with all ids the legend should have.
13
13
14
14
#### # class (optional)
15
- Expects a string with all classes the main should have.
15
+ Expects a string with all classes the legend should have.
16
16
17
- ## Example
17
+ ## Example 1: Yield a given block
18
18
19
19
``` ruby
20
20
legend id: " foo" , class : " bar" do
@@ -29,3 +29,16 @@ returns
29
29
Hello World
30
30
</legend >
31
31
```
32
+
33
+ ## Example 2: Render options[ : text ] param
34
+
35
+ ``` ruby
36
+ legend id: " foo" , class : " bar" , text: ' Hello World'
37
+ ```
38
+
39
+ returns
40
+
41
+ ``` html
42
+ <legend id =" foo" class =" bar" >
43
+ Hello World
44
+ </legend >
Original file line number Diff line number Diff line change @@ -9,8 +9,11 @@ class ExamplePage < Matestack::Ui::Page
9
9
10
10
def response
11
11
components {
12
+ legend text : 'I am simple'
13
+
14
+ # enhanced legend
12
15
legend id : 'my-id' , class : 'my-class' do
13
- plain 'Hello World' #optional content
16
+ plain 'I am enhanced'
14
17
end
15
18
}
16
19
end
@@ -22,9 +25,8 @@ def response
22
25
static_output = page . html
23
26
24
27
expected_static_output = <<~HTML
25
- < legend id ="my-id " class ="my-class ">
26
- Hello World
27
- </ legend >
28
+ < legend > I am simple</ legend >
29
+ < legend id ="my-id " class ="my-class "> I am enhanced</ legend >
28
30
HTML
29
31
30
32
expect ( stripped ( static_output ) ) . to include ( stripped ( expected_static_output ) )
You can’t perform that action at this time.
0 commit comments