How to use the enzyme/build.mount function in enzyme

To help you get started, we’ve selected a few enzyme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sheinsight / shineout / test / src / Select / Select.clearable.spec.js View on Github external
test('should have clear button & clear value', () => {
    const wrapper = mount(<select>)
    expect(wrapper.find(`.${SO_PREFIX}-select-close`).length).toBe(1)
    // clear value
    wrapper.find(`.${SO_PREFIX}-select-close`).simulate('click')
    expect(wrapper.find('Select').prop('value')).toBeUndefined()
  })
  test('should have clear button &amp; clear value on multiple select', () =&gt; {</select>
github sheinsight / shineout / test / src / Select / Select.format.spec.js View on Github external
test('should set format key and renderItem on single select', () =&gt; {
    const format = 'id'
    const renderItem = 'city'
    const changeFn = jest.fn()
    const wrapper = mount(
      <select> v === d.id}
        renderItem={renderItem}
      /&gt;
    )
    appendToDOM(wrapper.html())
    vSingle({ changeFn, format, citys, wrapper, renderItem })
  })
</select>
github greena13 / react-hotkeys / test / GlobalHotKeys / ClosingHangingCombinationsInHotKeysComponents.spec.js View on Github external
};

      this.nextHandler = sinon.spy();

      const handlers = {
        'NEXT': () =&gt; {
          this.secondElement.focus();

          this.nextHandler();
        }
      };

      this.reactDiv = document.createElement('div');
      document.body.appendChild(this.reactDiv);

      this.wrapper = mount(
        <div>
          

          
            <div>
          

          <div>
        </div>,
        { attachTo: this.reactDiv }
      );

      this.firstElement = new FocusableElement(this.wrapper, '.firstChildElement');
      this.secondElement = new FocusableElement(this.wrapper, '.secondChildElement');

      this.firstElement.focus();</div></div>
github sheinsight / shineout / test / src / Select / Select.datum.spec.js View on Github external
return (
          <select value="{this.state.value}" multiple=""> v === d.id}
            renderItem={renderItem}
          /&gt;
        )
      }
    }

    const wrapper = mount()
    appendToDOM(wrapper.html())
    vMultiple({ wrapper, format: datum.format, changeFn, citys })
  })
})</select>