Skip to content

Commit

Permalink
Add empty state to featuregrid widget
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz committed Apr 6, 2018
1 parent 7bdff39 commit 9e10728
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 75 deletions.
74 changes: 0 additions & 74 deletions TableWidget.jsx

This file was deleted.

2 changes: 2 additions & 0 deletions web/client/components/widgets/widget/TableWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const React = require('react');
const Message = require('../../I18N/Message');
const BorderLayout = require('../../layout/BorderLayout');
const LoadingSpinner = require('../../misc/LoadingSpinner');
const EmptyRowsView = require('../../data/featuregrid/EmptyRowsView');
const loadingState = require('../../misc/enhancers/loadingState');
const errorChartState = require('../enhancers/errorChartState');

Expand Down Expand Up @@ -76,6 +77,7 @@ module.exports = ({
</div>) : null}
>
<FeatureGrid
emptyRowsView={() => <EmptyRowsView loading={loading} />}
gridEvents={gridEvents}
sortable={false}
defaultSize={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const React = require('react');
const ReactDOM = require('react-dom');
const ReactTestUtils = require('react-dom/test-utils');
const expect = require('expect');
const TableWidget = require('../ChartWidget');
const TableWidget = require('../TableWidget');
const describePois = require('json-loader!../../../../test-resources/wfs/describe-pois.json');

describe('TableWidget component', () => {
beforeEach((done) => {
Expand Down Expand Up @@ -47,4 +48,17 @@ describe('TableWidget component', () => {
ReactTestUtils.Simulate.click(el); // <-- trigger event callback
expect(spyonEdit).toHaveBeenCalled();
});
it('TableWidget loading', () => {
ReactDOM.render(<TableWidget loading />, document.getElementById("container"));
const container = document.getElementById('container');
const el = container.querySelector('.loader-container');
expect(el).toExist();
});
it('TableWidget empty', () => {
ReactDOM.render(<TableWidget describeFeatureType={describePois} features={[]} />, document.getElementById("container"));
const container = document.getElementById('container');
const el = container.querySelector('.react-grid-Empty');
expect(el).toExist();
});

});

0 comments on commit 9e10728

Please sign in to comment.