mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
[WiP] rename project from Caravel to Superset (#1576)
* Change in files * Renamin files and folders * cleaning up a single piece of lint * Removing boat picture from docs * add superset word mark * Update rename note in docs * Fixing images * Pinning datatables * Fixing issues with mapbox-gl * Forgot to rename one file * Linting * v0.13.0 * adding pyyaml to dev-reqs
This commit is contained in:
committed by
GitHub
parent
973537fd9a
commit
15b67b2c6c
@@ -0,0 +1,61 @@
|
||||
import React from 'react';
|
||||
import Link from '../../../javascripts/SqlLab/components/Link';
|
||||
import TableElement from '../../../javascripts/SqlLab/components/TableElement';
|
||||
import ColumnElement from '../../../javascripts/SqlLab/components/ColumnElement';
|
||||
import { mockedActions, table } from './fixtures';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import { describe, it } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
|
||||
|
||||
describe('TableElement', () => {
|
||||
const mockedProps = {
|
||||
actions: mockedActions,
|
||||
table,
|
||||
timeout: 0,
|
||||
};
|
||||
it('renders', () => {
|
||||
expect(
|
||||
React.isValidElement(<TableElement />)
|
||||
).to.equal(true);
|
||||
});
|
||||
it('renders with props', () => {
|
||||
expect(
|
||||
React.isValidElement(<TableElement {...mockedProps} />)
|
||||
).to.equal(true);
|
||||
});
|
||||
it('has 2 Link elements', () => {
|
||||
const wrapper = shallow(<TableElement {...mockedProps} />);
|
||||
expect(wrapper.find(Link)).to.have.length(2);
|
||||
});
|
||||
it('has 14 columns', () => {
|
||||
const wrapper = shallow(<TableElement {...mockedProps} />);
|
||||
expect(wrapper.find(ColumnElement)).to.have.length(14);
|
||||
});
|
||||
it('mounts', () => {
|
||||
mount(<TableElement {...mockedProps} />);
|
||||
});
|
||||
it('sorts columns', () => {
|
||||
const wrapper = mount(<TableElement {...mockedProps} />);
|
||||
expect(wrapper.state().sortColumns).to.equal(false);
|
||||
expect(wrapper.find(ColumnElement).first().props().column.name).to.equal('id');
|
||||
wrapper.find('.sort-cols').simulate('click');
|
||||
expect(wrapper.state().sortColumns).to.equal(true);
|
||||
expect(wrapper.find(ColumnElement).first().props().column.name).to.equal('last_login');
|
||||
});
|
||||
it('calls the collapseTable action', () => {
|
||||
const wrapper = mount(<TableElement {...mockedProps} />);
|
||||
expect(mockedActions.collapseTable.called).to.equal(false);
|
||||
wrapper.find('.table-name').simulate('click');
|
||||
expect(mockedActions.collapseTable.called).to.equal(true);
|
||||
});
|
||||
it('removes the table', () => {
|
||||
const wrapper = mount(<TableElement {...mockedProps} />);
|
||||
expect(wrapper.state().expanded).to.equal(true);
|
||||
wrapper.find('.table-remove').simulate('click');
|
||||
expect(wrapper.state().expanded).to.equal(false);
|
||||
setTimeout(() => {
|
||||
expect(mockedActions.removeTable.called).to.equal(true);
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user