mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
A nice CacheLabel React component (#2628)
Introducing a nice component as a label that show when data was loaded from cache, when the cache was taken (in humanize duration as in `a few minutes ago`) in a tooltip, and it can act as a button that can trigger a force-refresh. While working on it, it became clear that it was going to be hard to use this component in the Dashboard view since it's not pure React. I'm planning on refactoring the dashboard view with proper React/Redux and introducing the CachedLabel component at that point. While digging around in the Dashboard view I realized that there was a bunch on unused code around managing timers that was used in explorev1 and decided to rip it out.
This commit is contained in:
committed by
GitHub
parent
23aeee5a9c
commit
787daf6005
@@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it } from 'mocha';
|
||||
import { shallow } from 'enzyme';
|
||||
import { Label } from 'react-bootstrap';
|
||||
|
||||
import CachedLabel from '../../../javascripts/components/CachedLabel';
|
||||
|
||||
describe('CachedLabel', () => {
|
||||
const defaultProps = {
|
||||
onClick: () => {},
|
||||
cachedTimestamp: '2017-01-01',
|
||||
};
|
||||
|
||||
it('is valid', () => {
|
||||
expect(
|
||||
React.isValidElement(<CachedLabel {...defaultProps} />),
|
||||
).to.equal(true);
|
||||
});
|
||||
it('renders', () => {
|
||||
const wrapper = shallow(
|
||||
<CachedLabel {...defaultProps} />,
|
||||
);
|
||||
expect(wrapper.find(Label)).to.have.length(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user