Skip to content

Commit 7795ff1

Browse files
committed
cleaned up some brittle specs in hyper-component
1 parent 0c597b0 commit 7795ff1

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

ruby/hyper-component/spec/client_features/dsl_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class Foo
6565
end
6666
end
6767
end
68-
expect(page.body).to match(/<input data-foo="12" data-reactroot="" \/>/)
68+
expect(find('input')['data-reactroot']).to eq('')
69+
expect(find('input')['data-foo']).to eq('12')
6970
end
7071

7172
it "will turn the last string in a block into a element" do
@@ -287,11 +288,11 @@ class Foo
287288
class Foo
288289
include Hyperstack::Component
289290
render do
290-
DIV(title: { bar: :foo })
291+
DIV(id: :div, title: { bar: :foo }) { 'the div' }
291292
end
292293
end
293294
end
294-
expect(page.body[-80..-19]).to include('<div title="{&quot;bar&quot;=&gt;&quot;foo&quot;}"></div>')
295+
expect(find('#div')['title']).to eq('{"bar"=>"foo"}')
295296
end
296297

297298
it "will remove all elements passed as params from the rendering buffer" do

ruby/hyper-component/spec/client_features/element_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ class Foo
2828
end
2929
end
3030
end
31-
expect(page.body[-285..-233]).to match(/<input (type="text" value=""|value="" type="text").*\/>/)
31+
# these checks are really not doing anything except making sure a proper
32+
# input tag is created as expected. However if false, nil, or a blank event
33+
# name was not filtered errors would be raised during rendering which will
34+
# throw errors.
35+
expect(find('input')['type']).to eq('text')
36+
expect(find('input')['value']).to eq('')
3237
end
3338
end
3439

0 commit comments

Comments
 (0)