Skip to content

Commit 5895efc

Browse files
committed
Merge branch 'develop' of github.com:basemate/matestack-ui-core into issue-183
2 parents 89d4975 + 91e3353 commit 5895efc

File tree

22 files changed

+515
-2
lines changed

22 files changed

+515
-2
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
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%cite{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Matestack::Ui::Core::Cite
2+
class Cite < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%dl{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Matestack::Ui::Core::Dl
2+
class Dl < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%noscript{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Matestack::Ui::Core::Noscript
2+
class Noscript < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%pre{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Matestack::Ui::Core::Pre
2+
class Pre < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end

docs/components/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ You can build your [own components](/docs/extend/custom_components.md) as well,
3333
- [link](/docs/components/link.md)
3434
- [label](/docs/components/label.md)
3535
- [progress](/docs/components/progress.md)
36+
- [noscript](/docs/components/noscript.md)
3637

3738
## Dynamic Core Components
3839

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+
```

docs/components/cite.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# matestack core component: Cite
2+
3+
Show [specs](/spec/usage/components/cite_spec.rb)
4+
5+
The HTML cite tag implemented in ruby.
6+
7+
## Parameters
8+
9+
This component can take 2 optional configuration params and either yield content or display what gets passed to the `text` configuration param.
10+
11+
#### # id (optional)
12+
Expects a string with all ids the cite tag should have.
13+
14+
#### # class (optional)
15+
Expects a string with all classes the cite tag should have.
16+
17+
## Example 1: Yield a given block
18+
19+
```ruby
20+
cite id: "foo", class: "bar" do
21+
plain 'Hello World' # optional content
22+
end
23+
```
24+
25+
returns
26+
27+
```html
28+
<cite id="foo" class="bar">
29+
Hello World
30+
</cite>
31+
```
32+
33+
## Example 2: Render options[:text] param
34+
35+
```ruby
36+
cite id: "foo", class: "bar", text: 'Hello World'
37+
```
38+
39+
returns
40+
41+
```html
42+
<cite id="foo" class="bar">
43+
Hello World
44+
</cite>

docs/components/dl.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# matestack core component: Dl
2+
3+
Show [specs](/spec/usage/components/dl_spec.rb)
4+
5+
The HTML dl tag implemented in ruby.
6+
7+
## Parameters
8+
9+
This component can take 3 optional configuration params and either yield content or display what gets passed to the `text` configuration param.
10+
11+
#### # id (optional)
12+
Expects a string with all ids the `dl` should have.
13+
14+
#### # class (optional)
15+
Expects a string with all classes the `dl` should have.
16+
17+
## Example 1: Yield a given block
18+
19+
```ruby
20+
dl id: "foo", class: "bar" do
21+
dt text: "dt component"
22+
dd text: "dd component"
23+
end
24+
```
25+
26+
returns
27+
28+
```html
29+
<dl id="foo" class="bar">
30+
<dt>dt component</dt>
31+
<dd>dd component</dd>
32+
</dl>
33+
```
34+
35+
## Example 2: Render options[:text] param
36+
37+
```ruby
38+
dl id: "foo", class: "bar", text: 'Hello World'
39+
```
40+
41+
returns
42+
43+
```html
44+
<dl id="foo" class="bar">
45+
Hello World
46+
</dl>
47+
```

docs/components/em.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ end
2525
returns
2626

2727
```html
28-
<em id="foo" class="bar">Emphasized text</small>
28+
<em id="foo" class="bar">Emphasized text</em>
2929
```
3030

3131
## Example 2: Render options[:text] param
@@ -37,4 +37,4 @@ em id: "foo", class: "bar", text: 'Emphasized text'
3737
returns
3838

3939
```html
40-
<em id="foo" class="bar">Emphasized text</small>
40+
<em id="foo" class="bar">Emphasized text</em>

docs/components/noscript.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# matestack core component: Noscript
2+
3+
Show [specs](/spec/usage/components/noscript_spec.rb)
4+
5+
The HTML noscript tag implemented in ruby.
6+
7+
## Parameters
8+
9+
This component can take 2 optional configuration params and either yield content or display what gets passed to the `text` configuration param.
10+
11+
#### # id (optional)
12+
Expects a string with all ids the noscript should have.
13+
14+
#### # class (optional)
15+
Expects a string with all classes the noscript should have.
16+
17+
## Example 1: Yield a given block
18+
19+
```ruby
20+
noscript id: "foo", class: "bar" do
21+
plain 'Hello World' # optional content
22+
end
23+
```
24+
25+
returns
26+
27+
```html
28+
<noscript id="foo" class="bar">
29+
Hello World
30+
</noscript>
31+
```
32+
33+
## Example 2: Render options[:text] param
34+
35+
```ruby
36+
noscript id: "foo", class: "bar", text: 'Hello World'
37+
```
38+
39+
returns
40+
41+
```html
42+
<noscript id="foo" class="bar">
43+
Hello World
44+
</noscript>
45+

docs/components/pre.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# matestack core component: Pre
2+
3+
Show [specs](/spec/usage/components/pre_spec.rb)
4+
5+
The HTML pre tag implemented in ruby.
6+
7+
## Parameters
8+
9+
This component can take 3 optional configuration params and either yield content or display what gets passed to the `text` configuration param.
10+
11+
#### # id (optional)
12+
Expects a string with all ids the pre should have.
13+
14+
#### # class (optional)
15+
Expects a string with all classes the pre should have.
16+
17+
#### # text (optional)
18+
Expects a ruby string with the text the address tag should show.
19+
20+
## Example 1: Yield a given block
21+
22+
```ruby
23+
pre id: "foo", class: "bar" do
24+
plain 'Hello World' # optional content
25+
end
26+
```
27+
28+
returns
29+
30+
```html
31+
<pre id="foo" class="bar">
32+
Hello World
33+
</pre>
34+
```
35+
36+
## Example 2: Render options[:text] param
37+
38+
```ruby
39+
pre id: "foo", class: "bar", text: 'Hello World'
40+
```
41+
42+
returns
43+
44+
```html
45+
<pre id="foo" class="bar">
46+
Hello World
47+
</pre>

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)