Skip to content

Commit

Permalink
helpers for mocking ReactDOM.findDOMNode
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanstitt committed Feb 16, 2017
1 parent 3150e6e commit 66accd7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions shared/specs/helpers/fake-dom-node.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extend = require 'lodash/extend'

# implements just enought to work with ScrollSpy and HTML mixins

class FakeDOMNode
constructor: (attrs) ->
extend(this, {
style: {}
ownerDocument: { styleSheets: [] }
querySelectorAll: jest.fn( ->
[]
)
querySelector: jest.fn( ->
undefined
)
getElementsByTagName: jest.fn( ->
[]
)
getBoundingClientRect: jest.fn( ->
{}
)
}, attrs)

module.exports = FakeDOMNode

0 comments on commit 66accd7

Please sign in to comment.