mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	allow a node's icon to be set dynamically (#1490)
* create a proto type * Fixed some problems after reviewing
This commit is contained in:
		
				
					committed by
					
						 Nick O'Leary
						Nick O'Leary
					
				
			
			
				
	
			
			
			
						parent
						
							cc88ebd2b9
						
					
				
				
					commit
					6d2389945b
				
			| @@ -493,7 +493,7 @@ describe("red/nodes/registry/registry",function() { | ||||
|  | ||||
|         it('returns a registered icon' , function() { | ||||
|             var testIcon = path.resolve(__dirname+'/../../../../resources/icons/test_icon.png'); | ||||
|             events.emit("node-icon-dir",{name:"test-module", path: path.resolve(__dirname+'/../../../../resources/icons')}); | ||||
|             events.emit("node-icon-dir",{name:"test-module", path: path.resolve(__dirname+'/../../../../resources/icons'), icons:[]}); | ||||
|             var iconPath = typeRegistry.getNodeIconPath('test-module','test_icon.png'); | ||||
|             iconPath.should.eql(testIcon); | ||||
|         }); | ||||
| @@ -505,4 +505,24 @@ describe("red/nodes/registry/registry",function() { | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     describe('#getNodeIcons', function() { | ||||
|         it('returns empty icon list when no modules are registered', function() { | ||||
|             var iconList = typeRegistry.getNodeIcons(); | ||||
|             iconList.should.eql({}); | ||||
|         }); | ||||
|  | ||||
|         it('returns an icon list of registered node module', function() { | ||||
|             typeRegistry.addNodeSet("test-module/test-name",testNodeSet1,"0.0.1"); | ||||
|             events.emit("node-icon-dir",{name:"test-module", path:"",icons:["test_icon1.png"]}); | ||||
|             var iconList = typeRegistry.getNodeIcons(); | ||||
|             iconList.should.eql({"test-module":["test_icon1.png"]}); | ||||
|         }); | ||||
|  | ||||
|         it('returns an icon list of unregistered node module', function() { | ||||
|             events.emit("node-icon-dir",{name:"test-module", path:"", icons:["test_icon1.png", "test_icon2.png"]}); | ||||
|             var iconList = typeRegistry.getNodeIcons(); | ||||
|             iconList.should.eql({"test-module":["test_icon1.png","test_icon2.png"]}); | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user