File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ require_relative "../../support/utils"
2
+ include Utils
3
+
4
+ describe 'Sup Component' , type : :feature , js : true do
5
+
6
+ it 'Example 1 - yield, no options[:text]' do
7
+
8
+ class ExamplePage < Matestack ::Ui ::Page
9
+
10
+ def response
11
+ components {
12
+ # simple sup
13
+ sup do
14
+ plain 'I am simple'
15
+ end
16
+
17
+ # enhanced sup
18
+ sup id : 'my-id' , class : 'my-class' do
19
+ plain 'I am enhanced'
20
+ end
21
+ }
22
+ end
23
+
24
+ end
25
+
26
+ visit '/example'
27
+
28
+ static_output = page . html
29
+
30
+ expected_static_output = <<~HTML
31
+ < sup > I am simple</ sup >
32
+ < sup id ="my-id " class ="my-class "> I am enhanced</ sup >
33
+ HTML
34
+
35
+ expect ( stripped ( static_output ) ) . to include ( stripped ( expected_static_output ) )
36
+ end
37
+
38
+ it 'Example 2 - render options[:text]' do
39
+
40
+ class ExamplePage < Matestack ::Ui ::Page
41
+
42
+ def response
43
+ components {
44
+ # simple sup
45
+ sup text : 'I am simple'
46
+
47
+ # enhanced sup
48
+ sup id : 'my-id' , class : 'my-class' , text : 'I am enhanced'
49
+ }
50
+ end
51
+
52
+ end
53
+
54
+ visit '/example'
55
+
56
+ static_output = page . html
57
+
58
+ expected_static_output = <<~HTML
59
+ < sup > I am simple</ sup >
60
+ < sup id ="my-id " class ="my-class "> I am enhanced</ sup >
61
+ HTML
62
+
63
+ expect ( stripped ( static_output ) ) . to include ( stripped ( expected_static_output ) )
64
+ end
65
+
66
+ end
You can’t perform that action at this time.
0 commit comments