@gisce/react-ooui 1.1.28 → 1.1.29

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": "@gisce/react-ooui",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -16,4 +16,15 @@ describe("A IconMapper instance", () => {
16
16
  const icon = iconMapper("gtk-find-and-replace");
17
17
  expect(icon).toBe(findAndReplaceIcon);
18
18
  })
19
+ test("should return gtk-go", () => {
20
+ const findAndReplaceIcon = Icons.FileSearchOutlined;
21
+ const icon = iconMapper("gtk-find-and-replace");
22
+ expect(icon).toBe(findAndReplaceIcon);
23
+ })
24
+ describe("If key doesn't exist in iconMapper", () => {
25
+ test("should return undefined", () => {
26
+ const icon = iconMapper("gtk-foo-bar");
27
+ expect(icon).toBe(undefined);
28
+ })
29
+ })
19
30
  });
@@ -103,8 +103,7 @@ const iconMapping: { [key: string]: string } = {
103
103
  export default (key: string) => {
104
104
  if (key.indexOf("gtk-") !== -1) {
105
105
  const rootIcon = key.replace("gtk-", "").replace(/\-/g, "_");
106
- const newKey = `STOCK_${rootIcon.toUpperCase()}`;
107
- return getIconForKey(iconMapping[newKey]);
106
+ key = `STOCK_${rootIcon.toUpperCase()}`;
108
107
  }
109
108
 
110
109
  if (iconMapping.hasOwnProperty(key)) {