forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[line] fix verbose names in time shift (apache#4765)
* [line] fix verbose names in time shift * Addressing comments
- Loading branch information
1 parent
ec08d05
commit 63402a3
Showing
4 changed files
with
56 additions
and
27 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
superset/assets/spec/javascripts/visualizations/nvd3_viz_spec.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
import { formatLabel } from '../../../visualizations/nvd3_vis'; | ||
|
||
describe('nvd3 viz', () => { | ||
const verboseMap = { | ||
foo: 'Foo', | ||
bar: 'Bar', | ||
}; | ||
describe('formatLabel', () => { | ||
it('formats simple labels', () => { | ||
expect(formatLabel('foo')).to.equal('foo'); | ||
expect(formatLabel(['foo'])).to.equal('foo'); | ||
expect(formatLabel(['foo', 'bar'])).to.equal('foo, bar'); | ||
}); | ||
it('formats simple labels with lookups', () => { | ||
expect(formatLabel('foo', verboseMap)).to.equal('Foo'); | ||
expect(formatLabel('baz', verboseMap)).to.equal('baz'); | ||
expect(formatLabel(['foo'], verboseMap)).to.equal('Foo'); | ||
expect(formatLabel(['foo', 'bar', 'baz'], verboseMap)).to.equal('Foo, Bar, baz'); | ||
}); | ||
it('deals with --- properly', () => { | ||
expect(formatLabel(['foo', '---'], verboseMap)).to.equal('Foo ---'); | ||
expect(formatLabel(['foo', 'bar', 'baz', '---'], verboseMap)).to.equal('Foo, Bar, baz ---'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters