Update all node icons to SVG

When listing icons provided by a module, if there is a png and svg
with the same name, only the svg will be listed.

If a node asks for a png icon which is not known, but there is a
corresponding svg, that will be used instead.
This commit is contained in:
Nick O'Leary
2019-06-21 12:36:20 +01:00
parent 92cb57eb7b
commit d623848c87
81 changed files with 127 additions and 66 deletions

View File

@@ -33,7 +33,7 @@ describe("api/editor/ui", function() {
nodes: {
getIcon: function(opts) {
return new Promise(function(resolve,reject) {
fs.readFile(NR_TEST_UTILS.resolve("@node-red/editor-client/src/images/icons/arrow-in.png"), function(err,data) {
fs.readFile(NR_TEST_UTILS.resolve("@node-red/editor-client/src/images/icons/arrow-in.svg"), function(err,data) {
resolve(data);
})
});
@@ -94,7 +94,7 @@ describe("api/editor/ui", function() {
}
}
it('returns the requested icon', function(done) {
var defaultIcon = fs.readFileSync(NR_TEST_UTILS.resolve("@node-red/editor-client/src/images/icons/arrow-in.png"));
var defaultIcon = fs.readFileSync(NR_TEST_UTILS.resolve("@node-red/editor-client/src/images/icons/arrow-in.svg"));
request(app)
.get("/icons/module/icon.png")
.expect("Content-Type", /image\/png/)

View File

@@ -192,7 +192,7 @@ describe("red/nodes/registry/localfilesystem",function() {
list["node-red"].icons[0].should.have.property("path",path.join(__dirname,"resources/local/NestedDirectoryNode/NestedNode/icons"))
list["node-red"].icons[0].should.have.property("icons");
list["node-red"].icons[0].icons.should.have.length(1);
list["node-red"].icons[0].icons[0].should.eql("arrow-in.png");
list["node-red"].icons[0].icons[0].should.eql("arrow-in.svg");
done();
});
it("scans icons dir in library",function(done) {
@@ -297,7 +297,7 @@ describe("red/nodes/registry/localfilesystem",function() {
nodeModule.TestNodeModule.icons.should.have.length(1);
nodeModule.TestNodeModule.icons[0].should.have.property("path");
nodeModule.TestNodeModule.icons[0].should.have.property("icons");
nodeModule.TestNodeModule.icons[0].icons[0].should.eql("arrow-in.png");
nodeModule.TestNodeModule.icons[0].icons[0].should.eql("arrow-in.svg");
done();
});
});