@@ -61,24 +61,36 @@ def render_top_level(controller, component_name)
61
61
expect ( render_top_level ( "Controller" , "::Components::Component1" ) ) . to eq ( '<span>Components::Component1</span>' )
62
62
end
63
63
64
- it 'React.html_tag? will return true for normal html tags' do
65
- expect ( React . html_tag? ( 'a' ) ) . to eq ( true )
66
- expect ( React . html_tag? ( 'div' ) ) . to eq ( true )
67
- end
64
+ describe '.html_tag?' do
65
+ it 'is truthy for valid html tags' do
66
+ expect ( React . html_tag? ( 'a' ) ) . to be_truthy
67
+ expect ( React . html_tag? ( 'div' ) ) . to be_truthy
68
+ end
68
69
69
- it 'React.html_tag? will return true for svg element names ' do
70
- expect ( React . html_tag? ( 'svg' ) ) . to eq ( true )
71
- expect ( React . html_tag? ( 'circle' ) ) . to eq ( true )
72
- end
70
+ it 'is truthy for valid svg tags ' do
71
+ expect ( React . html_tag? ( 'svg' ) ) . to be_truthy
72
+ expect ( React . html_tag? ( 'circle' ) ) . to be_truthy
73
+ end
73
74
74
- it 'React.html_attr? will return true for normal html attribute names ' do
75
- expect ( React . html_attr ?( 'id ' ) ) . to eq ( true )
76
- expect ( React . html_attr? ( 'data' ) ) . to eq ( true )
75
+ it 'is falsey for invalid tags ' do
76
+ expect ( React . html_tag ?( 'tagizzle ' ) ) . to be_falsey
77
+ end
77
78
end
78
79
79
- it 'React.html_attr? will return true for svg attribute names' do
80
- expect ( React . html_attr? ( 'cx' ) ) . to eq ( true )
81
- expect ( React . html_attr? ( 'strokeWidth' ) ) . to eq ( true )
80
+ describe '.html_attr?' do
81
+ it 'is truthy for valid html attributes' do
82
+ expect ( React . html_attr? ( 'id' ) ) . to be_truthy
83
+ expect ( React . html_attr? ( 'data' ) ) . to be_truthy
84
+ end
85
+
86
+ it 'is truthy for valid svg attributes' do
87
+ expect ( React . html_attr? ( 'cx' ) ) . to be_truthy
88
+ expect ( React . html_attr? ( 'strokeWidth' ) ) . to be_truthy
89
+ end
90
+
91
+ it 'is falsey for invalid attributes' do
92
+ expect ( React . html_tag? ( 'attrizzle' ) ) . to be_falsey
93
+ end
82
94
end
83
95
end
84
96
end
0 commit comments