@woosmap/ui 3.89.0 → 3.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "3.89.0",
3
+ "version": "3.90.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -426,7 +426,8 @@ const Icons = {
426
426
  class Icon extends Component {
427
427
  render() {
428
428
  const { icon, size, className, title, testId } = this.props;
429
- const IconComponent = Icons[icon];
429
+ const IconComponent = Object.keys(Icons).includes(icon) ? Icons[icon] : Woosmap;
430
+
430
431
  return (
431
432
  <IconComponent
432
433
  className={cl('icon', className)}
@@ -32,3 +32,4 @@ export const All = () => <div className="flex-wrap">{Object.keys(Icons).map(draw
32
32
  export const Website = () => <div className="flex-wrap">{Object.keys(WebsiteIcons).map(drawIcon)}</div>;
33
33
  export const Console = () => <div className="flex-wrap">{Object.keys(ConsoleIcons).map(drawIcon)}</div>;
34
34
  export const Products = () => <div className="flex-wrap">{Object.keys(ProductsIcons).map(drawIcon)}</div>;
35
+ export const NotExisting = () => <div className="flex-wrap">{drawIcon('not-existing-icon')}</div>;
@@ -40,3 +40,13 @@ it('renders all icon components', () => {
40
40
  const { Icons } = Icon;
41
41
  Object.keys(Icons).forEach(isIconRendered);
42
42
  });
43
+
44
+ it('renders woosmap icon component when using bad icon name', () => {
45
+ const { getByTestId } = render(<Icon icon="no-existing-icon" size={64} />);
46
+
47
+ const result = getByTestId('icon-no-existing-icon');
48
+
49
+ expect(result).toHaveClass('icon');
50
+ expect(result).toHaveAttribute('width', '64');
51
+ expect(result).toHaveTextContent('woosmap');
52
+ });