Skip to content

Commit 493c175

Browse files
author
p_doub
committed
add tests for pg and label core components
1 parent 8ea6f91 commit 493c175

File tree

3 files changed

+78
-6
lines changed

3 files changed

+78
-6
lines changed

spec/usage/components/label_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
require_relative '../../support/utils'
2+
include Utils
3+
4+
describe 'Label Component', type: :feature, js: true do
5+
6+
it 'Example 1' do
7+
8+
class ExamplePage < Page::Cell::Page
9+
10+
def response
11+
components {
12+
# simple label
13+
label text: 'I am simple'
14+
15+
# enhanced label
16+
label id: 'my-id', class: 'my-class' do
17+
plain 'I am enhanced'
18+
end
19+
}
20+
end
21+
22+
end
23+
24+
visit '/example'
25+
26+
static_output = page.html
27+
28+
expected_static_output = <<~HTML
29+
<label>I am simple</label>
30+
<label id="my-id" class="my-class">I am enhanced</label>
31+
HTML
32+
33+
expect(stripped(static_output)).to include(stripped(expected_static_output))
34+
end
35+
36+
end

spec/usage/components/main_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
require_relative "../../support/utils"
1+
require_relative '../../support/utils'
22
include Utils
33

4-
describe "Main Component", type: :feature, js: true do
4+
describe 'Main Component', type: :feature, js: true do
55

6-
it "Example 1" do
6+
it 'Example 1' do
77

88
class ExamplePage < Page::Cell::Page
99

1010
def response
1111
components {
12-
main id: "my-id", class: "my-class" do
13-
plain "Hello World" #optional content
12+
main id: 'my-id', class: 'my-class' do
13+
plain 'Hello World' #optional content
1414
end
1515
}
1616
end
1717

1818
end
1919

20-
visit "/example"
20+
visit '/example'
2121

2222
static_output = page.html
2323

spec/usage/components/pg_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
require_relative '../../support/utils'
2+
include Utils
3+
4+
describe 'Paragraph Component', type: :feature, js: true do
5+
6+
it 'Example 1' do
7+
8+
class ExamplePage < Page::Cell::Page
9+
10+
def response
11+
components {
12+
# simple paragraph
13+
pg text: 'I am simple'
14+
15+
# enhanced paragraph
16+
pg id: 'my-id', class: 'my-class' do
17+
plain 'I am enhanced'
18+
end
19+
}
20+
end
21+
22+
end
23+
24+
visit '/example'
25+
26+
static_output = page.html
27+
28+
expected_static_output = <<~HTML
29+
<p>I am simple</p>
30+
<p id="my-id" class="my-class">I am enhanced</p>
31+
HTML
32+
33+
expect(stripped(static_output)).to include(stripped(expected_static_output))
34+
end
35+
36+
end

0 commit comments

Comments
 (0)