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

Commit d017107

Browse files
committed
Fix spec
1 parent f43cdc7 commit d017107

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

lib/react/component.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ def method_missing(name, *args, &block)
104104
@buffer << element
105105
element
106106
end
107-
107+
108+
def to_n
109+
self
110+
end
108111

109112
module ClassMethods
110113
def prop_types

lib/react/component/api.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ def set_state(state, &block)
1919

2020
#FIXME: Should be deprecated in favor of sth like, React.find_dom_node(component)
2121
def dom_node
22-
Native(`React.findDOMNode(#{self})`)
22+
if self.respond_to?(:getDOMNode)
23+
self.getDOMNode
24+
else
25+
Native(`React.findDOMNode(#{self})`)
26+
end
2327
end
2428
end
2529
end

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def renderElementToDocument(element)
1616

1717
def simulateEvent(event, element, params = {})
1818
simulator = Native(`ReactTestUtils.Simulate`)
19-
simulator[event.to_s].call(`#{element.to_n}.getDOMNode()`, params)
19+
simulator[event.to_s].call(`#{element.dom_node.to_n}`, params)
2020
end
2121

2222
def isElementOfType(element, type)

0 commit comments

Comments
 (0)