From 347e598715defb5e8f3fe2d0a3c58e8b9798d03a Mon Sep 17 00:00:00 2001 From: Kazuki Nakanishi Date: Tue, 4 Jul 2017 17:04:27 +0900 Subject: [PATCH] Fix missing icons for some nodes (#1321) --- red/runtime/nodes/registry/registry.js | 3 +++ test/red/runtime/nodes/registry/registry_spec.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/red/runtime/nodes/registry/registry.js b/red/runtime/nodes/registry/registry.js index 5372d7be6..8f2239dea 100644 --- a/red/runtime/nodes/registry/registry.js +++ b/red/runtime/nodes/registry/registry.js @@ -599,6 +599,9 @@ function getNodeIconPath(module,icon) { } } } + if (module !== "node-red") { + return getNodeIconPath("node-red", icon); + } return defaultIcon; } diff --git a/test/red/runtime/nodes/registry/registry_spec.js b/test/red/runtime/nodes/registry/registry_spec.js index 12bb9a8b4..828609aa7 100644 --- a/test/red/runtime/nodes/registry/registry_spec.js +++ b/test/red/runtime/nodes/registry/registry_spec.js @@ -497,6 +497,12 @@ describe("red/nodes/registry/registry",function() { var iconPath = typeRegistry.getNodeIconPath('test-module','test_icon.png'); iconPath.should.eql(testIcon); }); + + it('returns the debug icon when getting an unknown module', function() { + var debugIcon = path.resolve(__dirname+'/../../../../../public/icons/debug.png'); + var iconPath = typeRegistry.getNodeIconPath('unknown-module', 'debug.png'); + iconPath.should.eql(debugIcon); + }); }); });