File size: 1,682 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import React from 'react';
import { spy, stub } from 'sinon';
import { mount, shallow } from 'enzyme';
import { assert, expect, should } from 'chai';
import Checkbox from '@mui/material/Checkbox';
import TableSelectCell from '../src/components/TableSelectCell';
describe('<TableSelectCell />', function() {
before(() => {});
it('should render table select cell', () => {
const mountWrapper = mount(<TableSelectCell checked={false} selectableOn={true} />);
const actualResult = mountWrapper.find(Checkbox);
assert.strictEqual(actualResult.length, 1);
});
it('should render table select cell checked', () => {
const mountWrapper = mount(<TableSelectCell checked={true} selectableOn={true} />);
const actualResult = mountWrapper.find(Checkbox);
assert.strictEqual(actualResult.props().checked, true);
});
it('should render table select cell unchecked', () => {
const mountWrapper = mount(<TableSelectCell checked={false} selectableOn={true} />);
const actualResult = mountWrapper.find(Checkbox);
assert.strictEqual(actualResult.props().checked, false);
});
// it("should trigger onColumnUpdate prop callback when calling method handleColChange", () => {
// const options = {};
// const onColumnUpdate = spy();
// const shallowWrapper = shallow(
// <MUIDataTableViewCol
// columns={columns}
// onColumnUpdate={onColumnUpdate}
// viewColStyles={defaultViewColStyles}
// options={options}
// />,
// ).dive();
// const instance = shallowWrapper.instance();
// instance.handleColChange(0);
// assert.strictEqual(onColumnUpdate.callCount, 1);
// });
});
|