How to use the enzyme-adapter-react-16.3 function in enzyme-adapter-react-16

To help you get started, we’ve selected a few enzyme-adapter-react-16 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 mAAdhaTTah / brookjs / packages / brookjs-silt / src / __tests__ / observableOf.spec.js View on Github external
/* eslint-env mocha */
/* eslint-disable no-console */
import { expect, use } from 'chai';
import Adapter from 'enzyme-adapter-react-16.3';
import { configure, mount } from 'enzyme';
import sinonChai from 'sinon-chai';
import sinon from 'sinon';
import Kefir from 'kefir';
import React from 'react';
import { chaiPlugin } from 'brookjs-desalinate';
import PropTypes from 'prop-types';
import observableOf from '../observableOf';

const { plugin , prop, value, send, error, end } = chaiPlugin({ Kefir });
use(plugin);
configure({ adapter: new Adapter() });
use(sinonChai);

describe('observableOf', () => {
    let wrapper;

    beforeEach(() => {
        sinon.stub(console, 'error');
    });

    afterEach(() => {
        console.error.restore();
        wrapper.unmount();
    });

    it('should not complain if nothing provided', () => {
        const NothingProvided = () =&gt; <button>Click me</button>;
github mAAdhaTTah / brookjs / packages / brookjs-silt / src / __tests__ / Collector.spec.js View on Github external
/* eslint-env mocha */
import Adapter from 'enzyme-adapter-react-16.3';
import { configure, mount } from 'enzyme';
import { expect, use } from 'chai';
import Kefir from 'kefir';
import { chaiPlugin } from 'brookjs-desalinate';
import h from '../h';
import Collector from '../Collector';
import { Provider } from '../context';

const { plugin, value } = chaiPlugin({ Kefir });

configure({ adapter: new Adapter() });
use(plugin);

describe('Collector', () =&gt; {
    const onButtonClick = e$ =&gt; e$.map(() =&gt; ({ type: 'CLICK' }));

    const CollectedButton = ({ text, enabled, aggregated$ }) =&gt; (
        
            
                {enabled ?
                    <button>
                        {text}
                    </button> :
                    <span>nothing to click</span>}
            
        
    );
github assembl / assembl / assembl / static2 / js / app / components / common / icons / mailIcon / mailIcon.spec.jsx View on Github external
import React from 'react';
/* eslint-disable import/no-extraneous-dependencies */
import initStoryshots from '@storybook/addon-storyshots';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.3';
/* eslint-enable */

import MailIcon from './mailIcon';

// Separate the snapshots in directories next to each component
// Name should match with the story name
initStoryshots({
  storyKindRegex: /^MailIcon$/
});

configure({ adapter: new Adapter() });

describe(' - with shallow', () =&gt; {
  let wrapper;

  beforeEach(() =&gt; {
    wrapper = shallow();
  });

  it('should render a svg composed by 2 path', () =&gt; {
    expect(wrapper.find('svg[className="mailIcon"]')).toHaveLength(1);
  });
});
github assembl / assembl / assembl / static2 / js / app / components / common / icons / sentimentBarIcon / sentimentBarIcon.spec.jsx View on Github external
// @flow
import React from 'react';
/* eslint-disable import/no-extraneous-dependencies */
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.3';
/* eslint-enable */

import SentimentBarIcon from './sentimentBarIcon';
import type { Props as SentimentBarIconProps } from './sentimentBarIcon';

configure({ adapter: new Adapter() });

describe(' - with shallow', () =&gt; {
  let wrapper;
  let sentimentBarIcon: SentimentBarIconProps;

  beforeEach(() =&gt; {
    sentimentBarIcon = { level: 2 };
    wrapper = shallow();
  });

  it('should render a loading icon', () =&gt; {
    expect(wrapper.find('svg[className="icon"]')).toHaveLength(1);
  });
});
github assembl / assembl / assembl / static2 / js / app / components / common / icons / tooltipIcon / tooltipIcon.spec.jsx View on Github external
// @flow
import React from 'react';
/* eslint-disable import/no-extraneous-dependencies */
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.3';
/* eslint-enable */

import TooltipIcon from './tooltipIcon';

configure({ adapter: new Adapter() });

describe(' - with shallow', () =&gt; {
  let wrapper;

  beforeEach(() =&gt; {
    wrapper = shallow();
  });

  it('should render a tooltip icon', () =&gt; {
    expect(wrapper.find('svg[className="icon tooltip"]')).toHaveLength(1);
    expect(wrapper.find('text[className="text"]')).toHaveLength(1);
    expect(wrapper.find('circle[className="circle"]')).toHaveLength(1);
  });
});
github assembl / assembl / assembl / static2 / js / app / components / common / icons / editPostIcon / editPostIcon.spec.jsx View on Github external
import React from 'react';
/* eslint-disable import/no-extraneous-dependencies */
import { configure, shallow } from 'enzyme';
import initStoryshots from '@storybook/addon-storyshots';
import Adapter from 'enzyme-adapter-react-16.3';
/* eslint-enable */

import EditPostIcon from './editPostIcon';

// Separate the snapshots in directories next to each component
// Name should match with the story name
initStoryshots({
  storyKindRegex: /^EditPostIcon$/
});

configure({ adapter: new Adapter() });

describe(' - with shallow', () =&gt; {
  let wrapper;

  beforeEach(() =&gt; {
    wrapper = shallow();
  });

  it('should render a svg with editPostIcon class', () =&gt; {
    expect(wrapper.find('svg[className="editPostIcon"]')).toHaveLength(1);
    expect(wrapper.find('path')).toHaveLength(1);
  });
});
github assembl / assembl / assembl / static2 / js / app / components / common / icons / tickIcon / tickIcon.spec.jsx View on Github external
import React from 'react';
/* eslint-disable import/no-extraneous-dependencies */
import initStoryshots from '@storybook/addon-storyshots';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.3';
/* eslint-enable */

import TickIcon from './tickIcon';

// Separate the snapshots in directories next to each component
// Name should match with the story name
initStoryshots({
  storyKindRegex: /^TickIcon$/
});

configure({ adapter: new Adapter() });

describe(' - with shallow', () =&gt; {
  let wrapper;

  beforeEach(() =&gt; {
    wrapper = shallow();
  });

  it('should render a svg composed by 2 path', () =&gt; {
    expect(wrapper.find('svg[className="tickIcon"]')).toHaveLength(1);
  });
});
github assembl / assembl / assembl / static2 / js / app / components / common / title / title.spec.jsx View on Github external
/* eslint-disable import/no-extraneous-dependencies */
import initStoryshots from '@storybook/addon-storyshots';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.3';
/* eslint-enable */
import Title from './title';
import type { Props as TitleProps } from './title';
import { defaultTitleProps } from './title.stories';

// Separate the snapshots in directories next to each component
// Name should match with the story name
initStoryshots({
  storyKindRegex: /^Semantic\s{1}Analysis\|Title$/
});

configure({ adapter: new Adapter() });

describe('<title> - with shallow', () =&gt; {
  let wrapper;
  let title: TitleProps;

  beforeEach(() =&gt; {
    title = { ...defaultTitleProps };
    wrapper = shallow(&lt;Title {...title} /&gt;);
  });

  describe('when level is set to 1 (default value) with grey-title1 class', () =&gt; {
    it('should render a h1', () =&gt; {
      expect(wrapper.find('h1[className="grey-title1"]').text()).toEqual('My awesome title');
    });
  });
</title>
github assembl / assembl / assembl / static2 / js / app / integration / 101 / components / checkbox101 / checkbox101.spec.jsx View on Github external
/* eslint-disable import/no-extraneous-dependencies */
import initStoryshots from '@storybook/addon-storyshots';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.3';
/* eslint-enable */

import Checkbox101 from './checkbox101';
import type { Checkbox101Type } from './checkbox101';

// Separate the snapshots in directories next to each component
// Name should match with the story name
initStoryshots({
  storyKindRegex: /^Checkbox101$/
});

configure({ adapter: new Adapter() });

const defaultCheckbox: Checkbox101Type = {
  onChangeHandler: jest.fn()
};

describe(' - with shallow', () =&gt; {
  let wrapper: any;
  let checkbox: Checkbox101Type;

  beforeEach(() =&gt; {
    checkbox = { ...defaultCheckbox };
    wrapper = shallow();
  });

  it('should render one checkbox with a default label', () =&gt; {
    const defaultLabel = 'Default';
github elastic / eui / scripts / jest / setup / enzyme.js View on Github external
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.3';

configure({ adapter: new Adapter() });

enzyme-adapter-react-16

JavaScript Testing utilities for React

MIT
Latest version published 3 months ago

Package Health Score

87 / 100
Full package analysis