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

Commit d695db6

Browse files
authored
combined the to_key specs / removed extra pause
1 parent ccdf5cc commit d695db6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

spec/react/to_key_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,29 @@
2525
true.to_key == true && false.to_key == false
2626
end.to be_truthy
2727
end
28+
29+
it "will use the use the to_key method to get the react key" do
30+
mount "TestComponent" do
31+
class MyTestClass
32+
attr_reader :to_key_called
33+
def to_key
34+
@to_key_called = true
35+
super
36+
end
37+
end
38+
class TestComponent < Hyperloop::Component
39+
before_mount { @test_object = MyTestClass.new }
40+
render do
41+
DIV(key: @test_object) { TestComponent2(test_object: @test_object) }
42+
end
43+
end
44+
class TestComponent2 < Hyperloop::Component
45+
param :test_object
46+
render do
47+
"to key was called!" if params.test_object.to_key_called
48+
end
49+
end
50+
end
51+
expect(page).to have_content('to key was called!')
52+
end
2853
end

0 commit comments

Comments
 (0)