superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: Fixing label issue when columnType is null (#4700)
Date Wed, 28 Mar 2018 00:54:26 GMT
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 485b0c2  Fixing label issue when columnType is null (#4700)
485b0c2 is described below

commit 485b0c275e6b274f2665a8f2da0c1f388447c87a
Author: michellethomas <michelle.q.thomas@gmail.com>
AuthorDate: Tue Mar 27 17:54:24 2018 -0700

    Fixing label issue when columnType is null (#4700)
---
 .../assets/javascripts/components/ColumnOption.jsx  |  2 +-
 .../javascripts/components/ColumnOption_spec.jsx    | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/superset/assets/javascripts/components/ColumnOption.jsx b/superset/assets/javascripts/components/ColumnOption.jsx
index 0a16db6..11fca00 100644
--- a/superset/assets/javascripts/components/ColumnOption.jsx
+++ b/superset/assets/javascripts/components/ColumnOption.jsx
@@ -24,7 +24,7 @@ export default function ColumnOption({ column, showType }) {
 
   return (
     <span>
-      {showType && <ColumnTypeLabel type={columnType} />}
+      {showType && columnType && <ColumnTypeLabel type={columnType} />}
       <span className="m-r-5 option-label">
         {column.verbose_name || column.column_name}
       </span>
diff --git a/superset/assets/spec/javascripts/components/ColumnOption_spec.jsx b/superset/assets/spec/javascripts/components/ColumnOption_spec.jsx
index 4768f16..d8f6ada 100644
--- a/superset/assets/spec/javascripts/components/ColumnOption_spec.jsx
+++ b/superset/assets/spec/javascripts/components/ColumnOption_spec.jsx
@@ -47,8 +47,14 @@ describe('ColumnOption', () => {
     expect(wrapper.find('.option-label').first().text()).to.equal('foo');
   });
   it('shows a column type label when showType is true', () => {
-    props.showType = true;
-    wrapper = shallow(factory(props));
+    wrapper = shallow(factory({
+      ...props,
+      showType: true,
+      column: {
+        expression: null,
+        type: 'str',
+      },
+    }));
     expect(wrapper.find(ColumnTypeLabel)).to.have.length(1);
   });
   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).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', () => {
     props.showType = true;
     props.column.is_dttm = true;

-- 
To stop receiving notification emails like this one, please contact
graceguo@apache.org.

Mime
View raw message