-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
1ad9c6e
commit 779d321
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
web/client/components/data/query/__tests__/QueryToolbar-test.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,42 @@ | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const React = require('react'); | ||
const ReactDOM = require('react-dom'); | ||
|
||
const expect = require('expect'); | ||
const QueryToolbar = require('../QueryToolbar'); | ||
describe('QueryToolbar component', () => { | ||
beforeEach((done) => { | ||
document.body.innerHTML = '<div id="container"></div>'; | ||
setTimeout(done); | ||
}); | ||
afterEach((done) => { | ||
ReactDOM.unmountComponentAtNode(document.getElementById("container")); | ||
document.body.innerHTML = ''; | ||
setTimeout(done); | ||
}); | ||
it('QueryToolbar rendering with defaults', () => { | ||
ReactDOM.render(<QueryToolbar />, document.getElementById("container")); | ||
const container = document.getElementById('container'); | ||
const el = container.querySelector('.query-toolbar'); | ||
expect(el).toExist(); | ||
}); | ||
it('QueryToolbar check empty filter warning', () => { | ||
ReactDOM.render(<QueryToolbar emptyFilterWarning allowEmptyFilter spatialField={{}} crossLayerFilter={{attribute: "ATTR", operation: undefined}}/>, document.getElementById("container")); | ||
const container = document.getElementById('container'); | ||
const el = container.querySelector('#query-toolbar-query.showWarning'); | ||
expect(el).toExist(); | ||
ReactDOM.render(<QueryToolbar emptyFilterWarning allowEmptyFilter spatialField={{}} crossLayerFilter={{attribute: "ATTR", operation: "INTERSECT"}}/>, document.getElementById("container")); | ||
expect(container.querySelector('#query-toolbar-query.showWarning')).toNotExist(); | ||
expect(container.querySelector('#query-toolbar-query')).toExist(); | ||
ReactDOM.render(<QueryToolbar emptyFilterWarning allowEmptyFilter spatialField={{geometry: {}}} crossLayerFilter={{attribute: "ATTR", operation: undefined}}/>, document.getElementById("container")); | ||
expect(container.querySelector('#query-toolbar-query.showWarning')).toNotExist(); | ||
|
||
}); | ||
}); |