mirror of
https://github.com/apache/superset.git
synced 2024-09-17 19:19:38 -04:00
Fixing label issue when columnType is null (#4700)
This commit is contained in:
parent
d8d860facc
commit
485b0c275e
@ -24,7 +24,7 @@ export default function ColumnOption({ column, showType }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
{showType && <ColumnTypeLabel type={columnType} />}
|
{showType && columnType && <ColumnTypeLabel type={columnType} />}
|
||||||
<span className="m-r-5 option-label">
|
<span className="m-r-5 option-label">
|
||||||
{column.verbose_name || column.column_name}
|
{column.verbose_name || column.column_name}
|
||||||
</span>
|
</span>
|
||||||
|
@ -47,8 +47,14 @@ describe('ColumnOption', () => {
|
|||||||
expect(wrapper.find('.option-label').first().text()).to.equal('foo');
|
expect(wrapper.find('.option-label').first().text()).to.equal('foo');
|
||||||
});
|
});
|
||||||
it('shows a column type label when showType is true', () => {
|
it('shows a column type label when showType is true', () => {
|
||||||
props.showType = true;
|
wrapper = shallow(factory({
|
||||||
wrapper = shallow(factory(props));
|
...props,
|
||||||
|
showType: true,
|
||||||
|
column: {
|
||||||
|
expression: null,
|
||||||
|
type: 'str',
|
||||||
|
},
|
||||||
|
}));
|
||||||
expect(wrapper.find(ColumnTypeLabel)).to.have.length(1);
|
expect(wrapper.find(ColumnTypeLabel)).to.have.length(1);
|
||||||
});
|
});
|
||||||
it('column with expression has correct column label if showType is true', () => {
|
it('column with expression has correct column label if showType is true', () => {
|
||||||
@ -57,6 +63,17 @@ describe('ColumnOption', () => {
|
|||||||
expect(wrapper.find(ColumnTypeLabel)).to.have.length(1);
|
expect(wrapper.find(ColumnTypeLabel)).to.have.length(1);
|
||||||
expect(wrapper.find(ColumnTypeLabel).props().type).to.equal('expression');
|
expect(wrapper.find(ColumnTypeLabel).props().type).to.equal('expression');
|
||||||
});
|
});
|
||||||
|
it('shows no column type label when type is null', () => {
|
||||||
|
wrapper = shallow(factory({
|
||||||
|
...props,
|
||||||
|
showType: true,
|
||||||
|
column: {
|
||||||
|
expression: null,
|
||||||
|
type: null,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
expect(wrapper.find(ColumnTypeLabel)).to.have.length(0);
|
||||||
|
});
|
||||||
it('dttm column has correct column label if showType is true', () => {
|
it('dttm column has correct column label if showType is true', () => {
|
||||||
props.showType = true;
|
props.showType = true;
|
||||||
props.column.is_dttm = true;
|
props.column.is_dttm = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user