UNPKG

@carbon/ibm-cloud-cognitive-cdai

Version:
39 lines (38 loc) 1.57 kB
// // Copyright IBM Corp. 2020, 2020 // // This source code is licensed under the Apache-2.0 license found in the // LICENSE file in the root directory of this source tree. // import React from 'react'; import { IdeTableToolbarSearch } from '../IdeTableToolbarSearch'; import { shallow } from 'enzyme'; import { settings } from 'carbon-components'; var prefix = settings.prefix; describe('IdeTableToolbarSearch', function () { describe('Renders as expected by default', function () { var wrapper = shallow( /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/tabindex-no-positive React.createElement(IdeTableToolbarSearch, null)); it('Should have the correct classes', function () { expect(wrapper.dive().hasClass('ide-table-toolbar-search')).toBe(true); expect(wrapper.dive().hasClass("".concat(prefix, "--toolbar-search-container-expandable"))).toBe(true); }); }); describe('Renders as expected with custom class', function () { var wrapper = shallow( /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/tabindex-no-positive React.createElement(IdeTableToolbarSearch, { className: "extra-class" })); it('Should have the correct classes', function () { expect(wrapper.dive().hasClass('ide-table-toolbar-search')).toBe(true); expect(wrapper.dive().hasClass("".concat(prefix, "--toolbar-search-container-expandable"))).toBe(true); }); it('Should add extra classes via className', function () { expect(wrapper.dive().hasClass('extra-class')).toBe(true); }); }); });