Skip to content

Commit 282f454

Browse files
author
Nils Henning
committed
update span, main, map, mark, meter, noscript, object, optgroup, option, output, paragraph, param, picture, plain, pre, progress, q, rp, rt, ruby, s, samp, section, small, strong, sub, sup, template, time, transition components and specs
1 parent 45f25be commit 282f454

36 files changed

+400
-4032
lines changed

.byebug_history

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
continue
22
static_output
3+
continue
4+
static_output

app/concepts/matestack/ui/core/pg/pg.haml

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/concepts/matestack/ui/core/pg/pg.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/matestack/ui/core/components.rb

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,43 @@ def self.require_core_component(name)
6969
require_core_component "li"
7070
require_core_component "link"
7171
require_core_component "main"
72+
require_core_component "map"
73+
require_core_component "mark"
74+
require_core_component "meter"
7275
require_core_component "nav"
76+
require_core_component "noscript"
77+
require_core_component "object"
7378
require_core_component "ol"
79+
require_core_component "optgroup"
80+
require_core_component "option"
81+
require_core_component "output"
7482
require_core_component "paragraph"
83+
require_core_component "param"
84+
require_core_component "picture"
7585
require_core_component "plain"
86+
require_core_component "pre"
87+
require_core_component "progress"
88+
require_core_component "q"
89+
require_core_component "rp"
90+
require_core_component "rt"
91+
require_core_component "ruby"
92+
require_core_component "s"
93+
require_core_component "samp"
94+
require_core_component "section"
95+
require_core_component "small"
7696
require_core_component "span"
97+
require_core_component "strong"
98+
require_core_component "sub"
7799
require_core_component "summary"
100+
require_core_component "sup"
78101
require_core_component "table"
79102
require_core_component "tbody"
80103
require_core_component "td"
104+
require_core_component "template"
81105
require_core_component "tfoot"
82106
require_core_component "th"
83107
require_core_component "thead"
108+
require_core_component "time"
84109
require_core_component "tr"
85110
require_core_component "transition"
86111
require_core_component "ul"
@@ -136,20 +161,46 @@ def self.require_core_component(name)
136161
li: Matestack::Ui::Core::Li::Li,
137162
link: Matestack::Ui::Core::Link::Link,
138163
main: Matestack::Ui::Core::Main::Main,
164+
map: Matestack::Ui::Core::Map::Map,
165+
mark: Matestack::Ui::Core::Mark::Mark,
166+
meter: Matestack::Ui::Core::Meter::Meter,
139167
nav: Matestack::Ui::Core::Nav::Nav,
168+
noscript: Matestack::Ui::Core::Noscript::Noscript,
169+
object: Matestack::Ui::Core::Object::Object,
140170
ol: Matestack::Ui::Core::Ol::Ol,
171+
optgroup: Matestack::Ui::Core::Optgroup::Optgroup,
172+
option: Matestack::Ui::Core::Option::Option,
173+
output: Matestack::Ui::Core::Output::Output,
141174
paragraph: Matestack::Ui::Core::Paragraph::Paragraph,
175+
pg: Matestack::Ui::Core::Paragraph::Paragraph, # alias paragraph as pg
176+
param: Matestack::Ui::Core::Param::Param,
177+
picture: Matestack::Ui::Core::Picture::Picture,
142178
plain: Matestack::Ui::Core::Plain::Plain,
179+
pre: Matestack::Ui::Core::Pre::Pre,
180+
progress: Matestack::Ui::Core::Progress::Progress,
181+
q: Matestack::Ui::Core::Q::Q,
182+
rp: Matestack::Ui::Core::Rp::Rp,
183+
rt: Matestack::Ui::Core::Rt::Rt,
184+
ruby: Matestack::Ui::Core::Ruby::Ruby,
185+
s: Matestack::Ui::Core::S::S,
186+
samp: Matestack::Ui::Core::Samp::Samp,
187+
section: Matestack::Ui::Core::Section::Section,
188+
small: Matestack::Ui::Core::Small::Small,
143189
span: Matestack::Ui::Core::Span::Span,
190+
strong: Matestack::Ui::Core::Strong::Strong,
191+
sub: Matestack::Ui::Core::Sub::Sub,
144192
summary: Matestack::Ui::Core::Summary::Summary,
145-
transition: Matestack::Ui::Core::Transition::Transition,
193+
sup: Matestack::Ui::Core::Sup::Sup,
146194
table: Matestack::Ui::Core::Table::Table,
147195
tbody: Matestack::Ui::Core::Tbody::Tbody,
148196
td: Matestack::Ui::Core::Td::Td,
197+
template: Matestack::Ui::Core::Template::Template,
149198
tfoot: Matestack::Ui::Core::Tfoot::Tfoot,
150199
th: Matestack::Ui::Core::Th::Th,
151200
thead: Matestack::Ui::Core::Thead::Thead,
201+
time: Matestack::Ui::Core::Time::Time,
152202
tr: Matestack::Ui::Core::Tr::Tr,
203+
transition: Matestack::Ui::Core::Transition::Transition,
153204
ul: Matestack::Ui::Core::Ul::Ul,
154205
form: Matestack::Ui::Core::Form::Form,
155206
form_input: Matestack::Ui::Core::Form::Input::Input,

spec/0.7/components/span_spec.rb

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,44 @@
44
describe 'Span Component', type: :feature, js: true do
55

66
it 'Example 1 - yield, no options[:text]' do
7-
87
class ExamplePage < Matestack::Ui::Page
9-
108
def response
11-
components {
12-
# simple span
13-
span do
14-
plain 'I am simple'
15-
end
16-
17-
# enhanced span
18-
span id: 'my-id', class: 'my-class' do
19-
plain 'I am enhanced'
20-
end
21-
}
9+
# simple span
10+
span do
11+
plain 'I am simple'
12+
end
13+
# enhanced span
14+
span id: 'my-id', class: 'my-class' do
15+
plain 'I am enhanced'
16+
end
2217
end
23-
2418
end
2519

2620
visit '/example'
27-
2821
static_output = page.html
29-
3022
expected_static_output = <<~HTML
31-
<span>I am simple</span>
32-
<span id="my-id" class="my-class">I am enhanced</span>
23+
<span>I am simple</span>
24+
<span id="my-id" class="my-class">I am enhanced</span>
3325
HTML
34-
3526
expect(stripped(static_output)).to include(stripped(expected_static_output))
3627
end
3728

3829
it 'Example 2 - render options[:text]' do
39-
4030
class ExamplePage < Matestack::Ui::Page
41-
4231
def response
43-
components {
44-
# simple span
45-
span text: 'I am simple'
46-
47-
# enhanced span
48-
span id: 'my-id', class: 'my-class',text: 'I am enhanced'
49-
}
32+
# simple span
33+
span text: 'I am simple'
34+
# enhanced span
35+
span id: 'my-id', class: 'my-class',text: 'I am enhanced'
5036
end
51-
5237
end
5338

5439
visit '/example'
55-
5640
static_output = page.html
57-
5841
expected_static_output = <<~HTML
59-
<span>I am simple</span>
60-
<span id="my-id" class="my-class">I am enhanced</span>
42+
<span>I am simple</span>
43+
<span id="my-id" class="my-class">I am enhanced</span>
6144
HTML
62-
6345
expect(stripped(static_output)).to include(stripped(expected_static_output))
6446
end
6547

spec/0.8/components/main_spec.rb

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,21 @@
44
describe 'Main Component', type: :feature, js: true do
55

66
it 'Example 1' do
7-
87
class ExamplePage < Matestack::Ui::Page
9-
108
def response
11-
components {
12-
main id: 'my-id', class: 'my-class' do
13-
plain 'Hello World' #optional content
14-
end
15-
}
9+
main id: 'my-id', class: 'my-class' do
10+
plain 'Hello World' #optional content
11+
end
1612
end
17-
1813
end
1914

2015
visit '/example'
21-
2216
static_output = page.html
23-
2417
expected_static_output = <<~HTML
25-
<main id="my-id" class="my-class">
26-
Hello World
27-
</main>
18+
<main id="my-id" class="my-class">
19+
Hello World
20+
</main>
2821
HTML
29-
3022
expect(stripped(static_output)).to include(stripped(expected_static_output))
3123
end
3224

spec/0.8/components/map_spec.rb

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,26 @@
44
describe 'Map Component', type: :feature, js: true do
55

66
it 'Renders an image and a map containing areas on the page' do
7-
87
class ExamplePage < Matestack::Ui::Page
98
def response
10-
components {
11-
img path: 'matestack-logo.png', width: 500, height: 300, alt: "otherlogo", usemap: "#newmap"
12-
13-
map name: 'newmap' do
14-
area shape: 'rect', coords: [0,0,100,100], href: 'first.htm', alt: 'First'
15-
area shape: 'rect', coords: [100,100,200,200], href: 'second.htm', alt: 'Second'
16-
area shape: 'rect', coords: [200,200,300,300], href: 'third.htm', alt: 'Third'
17-
end
18-
}
9+
img path: 'matestack-logo.png', width: 500, height: 300, alt: "otherlogo", usemap: "#newmap"
10+
map name: 'newmap' do
11+
area shape: 'rect', coords: [0,0,100,100], href: 'first.htm', alt: 'First'
12+
area shape: 'rect', coords: [100,100,200,200], href: 'second.htm', alt: 'Second'
13+
area shape: 'rect', coords: [200,200,300,300], href: 'third.htm', alt: 'Third'
14+
end
1915
end
2016
end
2117

2218
visit '/example'
23-
2419
static_output = page.html
25-
2620
expected_static_output = <<~HTML
27-
<map name="newmap">
28-
<area alt="First" coords="0,0,100,100" href="first.htm" shape="rect"/>
29-
<area alt="Second" coords="100,100,200,200" href="second.htm" shape="rect"/>
30-
<area alt="Third" coords="200,200,300,300" href="third.htm" shape="rect"/>
31-
</map>
21+
<map name="newmap">
22+
<area alt="First" coords="0,0,100,100" href="first.htm" shape="rect"/>
23+
<area alt="Second" coords="100,100,200,200" href="second.htm" shape="rect"/>
24+
<area alt="Third" coords="200,200,300,300" href="third.htm" shape="rect"/>
25+
</map>
3226
HTML
33-
3427
expect(stripped(static_output)).to include(stripped(expected_static_output))
3528
expect(page).to have_xpath("//img[contains(@src,'matestack-logo') and @alt='otherlogo' and @width='500' and @height='300' and @usemap='\#newmap']")
3629
end

spec/0.8/components/mark_spec.rb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,26 @@
22
include Utils
33

44
describe 'mark Component', type: :feature, js: true do
5+
56
it 'Renders a simple and enhanced mark tag on a page' do
67
class ExamplePage < Matestack::Ui::Page
78
def response
8-
components {
9-
# simple mark
10-
mark text: 'Simple mark Tag'
11-
12-
# enhanced mark
13-
mark id: 'my-id', class: 'my-class' do
14-
plain 'Enhanced mark Tag'
15-
end
16-
}
9+
# simple mark
10+
mark text: 'Simple mark Tag'
11+
# enhanced mark
12+
mark id: 'my-id', class: 'my-class' do
13+
plain 'Enhanced mark Tag'
14+
end
1715
end
1816
end
1917

2018
visit '/example'
21-
2219
static_output = page.html
23-
2420
expected_static_output = <<~HTML
2521
<mark>Simple mark Tag</mark>
2622
<mark id="my-id" class="my-class">Enhanced mark Tag</mark>
2723
HTML
28-
2924
expect(stripped(static_output)).to include(stripped(expected_static_output))
3025
end
26+
3127
end

spec/0.8/components/meter_spec.rb

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,29 @@
44
describe 'Meter Component', type: :feature, js: true do
55

66
it 'Renders an meter tag on the page' do
7-
87
class ExamplePage < Matestack::Ui::Page
98
def response
10-
components {
11-
#label for: 'meter_id'
12-
meter id: 'meter_id', value: 0.6
13-
14-
#label for: 'meter'
15-
meter id: 'meter', min: 0, max: 10, value: 6 do
16-
plain '6 out of 10. 60%.'
17-
end
18-
19-
meter id: 'meter', low: 2, high: 8, optimum: 6, min: 0, max: 10, value: 6 do
20-
plain '6 out of 10. 60%.'
21-
end
22-
}
9+
#label for: 'meter_id'
10+
meter id: 'meter_id', value: 0.6
11+
#label for: 'meter'
12+
meter id: 'meter', min: 0, max: 10, value: 6 do
13+
plain '6 out of 10. 60%.'
14+
end
15+
meter id: 'meter', low: 2, high: 8, optimum: 6, min: 0, max: 10, value: 6 do
16+
plain '6 out of 10. 60%.'
17+
end
2318
end
2419
end
2520

2621
visit '/example'
27-
2822
output_html = page.html
29-
3023
expected_output = <<~HTML
3124
<meter id="meter_id" value="0.6"></meter>
32-
3325
<meter id="meter" max="10" min="0" value="6">6 out of 10. 60%.</meter>
34-
3526
<meter high="8" id="meter" low="2" max="10" min="0" optimum="6" value="6">
3627
6 out of 10. 60%.
3728
</meter>
3829
HTML
39-
4030
expect(stripped(output_html)).to include(stripped(expected_output))
4131
end
4232
end

spec/0.8/components/noscript_spec.rb

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,23 @@
44
describe 'Noscript Component', type: :feature, js: true do
55

66
it 'Example 1' do
7-
87
class ExamplePage < Matestack::Ui::Page
9-
108
def response
11-
components {
12-
# simple noscript
13-
noscript text: 'I am simple'
14-
15-
# enhanced noscript
16-
noscript id: 'my-id', class: 'my-class' do
17-
plain 'I am enhanced'
18-
end
19-
}
9+
# simple noscript
10+
noscript text: 'I am simple'
11+
# enhanced noscript
12+
noscript id: 'my-id', class: 'my-class' do
13+
plain 'I am enhanced'
14+
end
2015
end
21-
2216
end
2317

2418
visit '/example'
25-
2619
static_output = page.html
27-
2820
expected_static_output = <<~HTML
29-
<noscript>I am simple</noscript>
30-
<noscript id="my-id" class="my-class">I am enhanced</noscript>
21+
<noscript>I am simple</noscript>
22+
<noscript id="my-id" class="my-class">I am enhanced</noscript>
3123
HTML
32-
3324
expect(stripped(static_output)).to include(stripped(expected_static_output))
3425
end
3526

0 commit comments

Comments
 (0)