-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca8dcbc
commit 1f1a9a0
Showing
50 changed files
with
1,448 additions
and
59 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
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
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
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
45 changes: 45 additions & 0 deletions
45
web/client/plugins/ResourcesCatalog/components/__tests__/ALink-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,45 @@ | ||
|
||
/* | ||
* Copyright 2025, 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 ALink from '../ALink'; | ||
|
||
describe('ALink 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('should not render with default', () => { | ||
ReactDOM.render(<ALink />, document.getElementById('container')); | ||
const container = document.getElementById('container'); | ||
expect(container.children.length).toBe(0); | ||
}); | ||
it('should apply the link (a) tag if href is provided', () => { | ||
ReactDOM.render(<ALink href="#" className="link"><span className="child"></span></ALink>, document.getElementById('container')); | ||
const container = document.getElementById('container'); | ||
expect(container.children[0].getAttribute('class')).toBe('link'); | ||
}); | ||
it('should not apply the link (a) tag if href is not provided', () => { | ||
ReactDOM.render(<ALink className="link"><span className="child"></span></ALink>, document.getElementById('container')); | ||
const container = document.getElementById('container'); | ||
expect(container.children[0].getAttribute('class')).toBe('child'); | ||
}); | ||
it('should not apply the link (a) tag if href is provided and readOnly is true', () => { | ||
ReactDOM.render(<ALink href="#" readOnly className="link"><span className="child"></span></ALink>, document.getElementById('container')); | ||
const container = document.getElementById('container'); | ||
expect(container.children[0].getAttribute('class')).toBe('child'); | ||
}); | ||
}); |
47 changes: 47 additions & 0 deletions
47
web/client/plugins/ResourcesCatalog/components/__tests__/Button-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,47 @@ | ||
|
||
/* | ||
* Copyright 2025, 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 Button from '../Button'; | ||
|
||
describe('Button 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('should render with default', () => { | ||
ReactDOM.render(<Button><span className="child" /></Button>, document.getElementById('container')); | ||
const button = document.querySelector('.btn'); | ||
expect(button).toBeTruthy(); | ||
expect(document.querySelector('.child')).toBeTruthy(); | ||
}); | ||
it('should apply custom classes based on props', () => { | ||
ReactDOM.render(<Button | ||
variant="primary" | ||
size="md" | ||
borderTransparent | ||
><span className="child" /></Button>, document.getElementById('container')); | ||
const button = document.querySelector('.btn'); | ||
expect(button).toBeTruthy(); | ||
expect(button.getAttribute('class')).toBe(' _border-transparent btn btn-md btn-primary'); | ||
}); | ||
it('should render a square button', () => { | ||
ReactDOM.render(<Button square ><span className="child" /></Button>, document.getElementById('container')); | ||
const button = document.querySelector('.btn'); | ||
expect(button).toBeTruthy(); | ||
expect(button.getAttribute('class')).toBe('square-button-md btn btn-default'); | ||
}); | ||
}); |
Oops, something went wrong.