Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 49aea4d

Browse files
committed
test the invalid case for tag and attr predicates
1 parent 75486c9 commit 49aea4d

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

spec/react/top_level_component_spec.rb

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,36 @@ def render_top_level(controller, component_name)
6161
expect(render_top_level("Controller", "::Components::Component1")).to eq('<span>Components::Component1</span>')
6262
end
6363

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
6869

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
7374

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
7778
end
7879

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
8294
end
8395
end
8496
end

0 commit comments

Comments
 (0)