UNPKG

chai-enzyme

Version:
46 lines (35 loc) 760 B
export default class TestWrapper { isPresent () { return this.wrapper.length > 0 } isEmpty () { return this.wrapper.children().length === 0 } hasId (id) { return this.id() === id } hasValue (value) { return this.value() === value } hasDescendants (selector) { return this.getDescendantsCount(selector) > 0 } getDescendantsCount (selector) { return this.wrapper.find(selector).length } state (key) { return this.wrapper.state(key) } prop (key) { return this.wrapper.prop(key) } props () { return this.wrapper.props() } text () { return this.wrapper.text() } root () { return (typeof this.wrapper.root === 'function') ? this.wrapper.root() : this.wrapper.root } }