forked from geosolutions-it/MapStore2
-
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.
Fix geosolutions-it#9982 dropdown style and toc configuration improve…
…ments (geosolutions-it#10128)
- Loading branch information
1 parent
733af49
commit 4e60e80
Showing
4 changed files
with
63 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2024, 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 React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import usePluginItems from "../usePluginItems"; | ||
import { act } from 'react-dom/test-utils'; | ||
|
||
describe('usePluginItems', () => { | ||
const Component = ({ items = [] }) => { | ||
const configuredItems = usePluginItems({ | ||
items, | ||
loadedPlugins: {} | ||
}); | ||
return <div id="component">{configuredItems.map(({ name }) => name).join(',')}</div>; | ||
}; | ||
|
||
beforeEach((done) => { | ||
document.body.innerHTML = '<div id="container"></div>'; | ||
setTimeout(done); | ||
}); | ||
afterEach((done) => { | ||
ReactDOM.unmountComponentAtNode(document.getElementById("container")); | ||
document.body.innerHTML = ''; | ||
setTimeout(done); | ||
}); | ||
it('should reload the list of confiugred items if they change', () => { | ||
const plugin01 = { | ||
name: 'Plugin01', | ||
Component: () => null | ||
}; | ||
const plugin02 = { | ||
name: 'Plugin02', | ||
Component: () => null | ||
}; | ||
act(() => { | ||
ReactDOM.render(<Component items={[plugin01, plugin02]}/>, document.getElementById('container')); | ||
}); | ||
|
||
expect(document.querySelector('#component').innerText).toBe('Plugin02,Plugin01'); | ||
|
||
act(() => { | ||
ReactDOM.render(<Component items={[plugin01]}/>, document.getElementById('container')); | ||
}); | ||
|
||
expect(document.querySelector('#component').innerText).toBe('Plugin01'); | ||
}); | ||
}); |
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