forked from geosolutions-it/geonode-mapstore-client
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Home and catalogue pages' layout breaks after multiple successive res…
…ource deletions (#888)
- Loading branch information
1 parent
c356bcf
commit 12245eb
Showing
10 changed files
with
134 additions
and
29 deletions.
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
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
41 changes: 41 additions & 0 deletions
41
geonode_mapstore_client/client/js/routes/__tests__/UploadCard-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,41 @@ | ||
/* | ||
* Copyright 2022, 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. | ||
*/ | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import expect from 'expect'; | ||
import UploadCard from '../upload/UploadCard'; | ||
|
||
describe('upload card tests', () => { | ||
beforeEach((done) => { | ||
document.body.innerHTML = '<div id="container"></div>'; | ||
setTimeout(done); | ||
}); | ||
|
||
afterEach((done) => { | ||
ReactDOM.unmountComponentAtNode(document.getElementById('container')); | ||
document.body.innerHTML = ''; | ||
setTimeout(done); | ||
}); | ||
|
||
it('renders upload card with defaults', () => { | ||
ReactDOM.render(<UploadCard />, document.getElementById('container')); | ||
const uploadCard = document.querySelector( | ||
'.gn-upload-card' | ||
); | ||
expect(uploadCard).toExist(); | ||
}); | ||
|
||
it('renders error card', () => { | ||
ReactDOM.render(<UploadCard state="INVALID" error={{code: 'test'}} />, document.getElementById('container')); | ||
const uploadCard = document.querySelector( | ||
'.gn-upload-card-error-message' | ||
); | ||
expect(uploadCard).toExist(); | ||
}); | ||
}); |
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
55 changes: 55 additions & 0 deletions
55
geonode_mapstore_client/client/js/selectors/__tests__/search-test.js
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,55 @@ | ||
/* | ||
* Copyright 2022, 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. | ||
*/ | ||
|
||
import expect from 'expect'; | ||
import { getSearchResults, getFeaturedResults, getTotalResources } from '../search'; | ||
|
||
describe('Search selectors tests', () => { | ||
|
||
it('should getSearchResults', () => { | ||
const testState = { | ||
resourceservice: { | ||
processes: [{ resource: { pk: 1 }, processType: 'deleteResource', output: { status: 'finished' }, completed: true }] | ||
}, | ||
gnsearch: { | ||
resources: [{ pk: 1, processed: true }, { pk: 2 }] | ||
} | ||
}; | ||
expect(getSearchResults(testState)).toEqual([{ pk: 2 }]); | ||
}); | ||
|
||
it('should getFeaturedResults', () => { | ||
const testState = { | ||
resourceservice: { | ||
processes: [{ resource: { pk: 1 }, processType: 'deleteResource', output: { status: 'finished' }, completed: true }] | ||
}, | ||
gnsearch: { | ||
featuredResources: { | ||
resources: [{ pk: 1, processed: true }, { pk: 2 }] | ||
} | ||
} | ||
}; | ||
expect(getFeaturedResults(testState)).toEqual([{ pk: 2 }]); | ||
}); | ||
|
||
it('should getTotalResources', () => { | ||
const testState = { | ||
resourceservice: { | ||
processes: [{ resource: { pk: 1 }, processType: 'deleteResource', output: { status: 'finished' }, completed: true }] | ||
}, | ||
gnsearch: { | ||
resources: [ | ||
{ pk: 1, processed: true }, { pk: 2 }, { | ||
pk: 3, '@temporary': true | ||
}], | ||
total: 1 | ||
} | ||
}; | ||
expect(getTotalResources(testState)).toEqual(2); | ||
}); | ||
}); |
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