Skip to content

Commit 5c3b1bd

Browse files
committed
Fix typo add and tests
1 parent 207acff commit 5c3b1bd

File tree

6 files changed

+69
-21
lines changed

6 files changed

+69
-21
lines changed

docs/components/rp.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ The HTML rp tag implemented in ruby.
99
This component can take 2 optional configuration params and optional content.
1010

1111
#### # id (optional)
12-
Expects a string with all ids the main should have.
12+
Expects a string with all ids the rp should have.
1313

1414
#### # class (optional)
15-
Expects a string with all classes the main should have.
15+
Expects a string with all classes the rp should have.
1616

17-
## Example
17+
## Example 1: Yield a given block
1818

1919
```ruby
2020
rp id: "foo", class: "bar" do
@@ -29,3 +29,16 @@ returns
2929
Hello World
3030
</rp>
3131
```
32+
33+
## Example 2: Render options[:text] param
34+
35+
```ruby
36+
rp id: "foo", class: "bar", text: 'Hello World'
37+
```
38+
39+
returns
40+
41+
```html
42+
<rp id="foo" class="bar">
43+
Hello World
44+
</rp>

docs/components/rt.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ The HTML rt tag implemented in ruby.
99
This component can take 2 optional configuration params and optional content.
1010

1111
#### # id (optional)
12-
Expects a string with all ids the main should have.
12+
Expects a string with all ids the rt should have.
1313

1414
#### # class (optional)
15-
Expects a string with all classes the main should have.
15+
Expects a string with all classes the rt should have.
1616

17-
## Example
17+
## Example 1: Yield a given block
1818

1919
```ruby
2020
rt id: "foo", class: "bar" do
@@ -29,3 +29,16 @@ returns
2929
Hello World
3030
</rt>
3131
```
32+
33+
## Example 2: Render options[:text] param
34+
35+
```ruby
36+
rt id: "foo", class: "bar", text: 'Hello World'
37+
```
38+
39+
returns
40+
41+
```html
42+
<rt id="foo" class="bar">
43+
Hello World
44+
</rt>

docs/components/ruby.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ The HTML ruby tag implemented in ruby.
99
This component can take 2 optional configuration params and optional content.
1010

1111
#### # id (optional)
12-
Expects a string with all ids the main should have.
12+
Expects a string with all ids the ruby should have.
1313

1414
#### # class (optional)
15-
Expects a string with all classes the main should have.
15+
Expects a string with all classes the ruby should have.
1616

17-
## Example
17+
## Example 1: : Yield a given block
1818

1919
```ruby
2020
ruby id: "foo", class: "bar" do
@@ -29,3 +29,16 @@ returns
2929
Hello World
3030
</ruby>
3131
```
32+
33+
## Example 2: Render options[:text] param
34+
35+
```ruby
36+
ruby id: "foo", class: "bar", text: 'Hello World'
37+
```
38+
39+
returns
40+
41+
```html
42+
<ruby id="foo" class="bar">
43+
Hello World
44+
</ruby>

spec/usage/components/rp_spec.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ class ExamplePage < Matestack::Ui::Page
99

1010
def response
1111
components {
12+
# simple rp
13+
rp text: 'I am simple'
14+
15+
# enhanced rp
1216
rp id: 'my-id', class: 'my-class' do
13-
plain 'Hello World' #optional content
17+
plain 'I am enhanced'
1418
end
1519
}
1620
end
@@ -22,9 +26,8 @@ def response
2226
static_output = page.html
2327

2428
expected_static_output = <<~HTML
25-
<rp id="my-id" class="my-class">
26-
Hello World
27-
</rp>
29+
<rp>I am simple</rp>
30+
<rp id="my-id" class="my-class">I am enhanced</rp>
2831
HTML
2932

3033
expect(stripped(static_output)).to include(stripped(expected_static_output))

spec/usage/components/rt_spec.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ class ExamplePage < Matestack::Ui::Page
99

1010
def response
1111
components {
12+
# simple rt
13+
rt text: 'I am simple'
14+
15+
# enhanced rt
1216
rt id: 'my-id', class: 'my-class' do
13-
plain 'Hello World' #optional content
17+
plain 'I am enhanced'
1418
end
1519
}
1620
end
@@ -22,9 +26,8 @@ def response
2226
static_output = page.html
2327

2428
expected_static_output = <<~HTML
25-
<rt id="my-id" class="my-class">
26-
Hello World
27-
</rt>
29+
<rt>I am simple</rt>
30+
<rt id="my-id" class="my-class">I am enhanced</rt>
2831
HTML
2932

3033
expect(stripped(static_output)).to include(stripped(expected_static_output))

spec/usage/components/ruby_spec.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ class ExamplePage < Matestack::Ui::Page
99

1010
def response
1111
components {
12+
# simple ruby
13+
ruby text: 'I am simple'
14+
15+
# enhanced ruby
1216
ruby id: 'my-id', class: 'my-class' do
13-
plain 'Hello World' #optional content
17+
plain 'I am enhanced'
1418
end
1519
}
1620
end
@@ -22,9 +26,8 @@ def response
2226
static_output = page.html
2327

2428
expected_static_output = <<~HTML
25-
<ruby id="my-id" class="my-class">
26-
Hello World
27-
</ruby>
29+
<ruby>I am simple</ruby>
30+
<ruby id="my-id" class="my-class">I am enhanced</ruby>
2831
HTML
2932

3033
expect(stripped(static_output)).to include(stripped(expected_static_output))

0 commit comments

Comments
 (0)