Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/components / controls / Menu / Menu.spec.js
Size: Mime:
import React from 'react';
import { shallow } from 'enzyme';
import Menu from './Menu';

describe('Test Menu', () => {
  describe('Test menu position', () => {
    it('should be at bottom by default', () => {
      const entries = [
        {
          label: 'Test',
          icon: 'target',
        },
      ];
      const wrapper = shallow(
        <Menu items={entries}>
          <span>child</span>
        </Menu>
      );

      expect(
        wrapper
          .childAt(1)
          .props()
          .className.indexOf('Menu-list--position-bottom')
      ).not.toBe(-1);
    });

    it('should be at top if top position is passed', () => {
      const entries = [
        {
          label: 'Test',
          target: 'target',
        },
      ];
      const wrapper = shallow(
        <Menu items={entries} position="top">
          <span>child</span>
        </Menu>
      );

      expect(
        wrapper
          .childAt(1)
          .props()
          .className.indexOf('Menu-list--position-top')
      ).not.toBe(-1);
    });
  });
});