Skip to content

Commit

Permalink
fix(explore): Incorrect conversion from simple bool filter to custom …
Browse files Browse the repository at this point in the history
…sql (#21293)
  • Loading branch information
kgabryje authored Sep 1, 2022
1 parent eb80568 commit 076af60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions superset-frontend/src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export function optionLabel(opt) {
return EMPTY_STRING;
}
if (opt === true) {
return '<true>';
return TRUE_STRING;
}
if (opt === false) {
return '<false>';
return FALSE_STRING;
}
if (typeof opt !== 'string' && opt.toString) {
return opt.toString();
Expand Down
9 changes: 7 additions & 2 deletions superset-frontend/src/utils/common.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ import {
optionFromValue,
prepareCopyToClipboardTabularData,
NULL_STRING,
TRUE_STRING,
FALSE_STRING,
} from 'src/utils/common';

describe('utils/common', () => {
describe('optionFromValue', () => {
it('converts values as expected', () => {
expect(optionFromValue(false)).toEqual({
value: false,
label: '<false>',
label: FALSE_STRING,
});
expect(optionFromValue(true)).toEqual({
value: true,
label: TRUE_STRING,
});
expect(optionFromValue(true)).toEqual({ value: true, label: '<true>' });
expect(optionFromValue(null)).toEqual({
value: NULL_STRING,
label: NULL_STRING,
Expand Down

0 comments on commit 076af60

Please sign in to comment.