Fixed bug with getCurrentLayer when no current layer.
This commit is contained in:
@@ -414,7 +414,7 @@ svgedit.draw.Drawing.prototype.getLayerName = function (i) {
|
|||||||
* @returns {SVGGElement} The SVGGElement representing the current layer.
|
* @returns {SVGGElement} The SVGGElement representing the current layer.
|
||||||
*/
|
*/
|
||||||
svgedit.draw.Drawing.prototype.getCurrentLayer = function() {
|
svgedit.draw.Drawing.prototype.getCurrentLayer = function() {
|
||||||
return this.current_layer.getGroup();
|
return this.current_layer ? this.current_layer.getGroup() : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -248,9 +248,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Test identifyLayers() with empty document', function() {
|
test('Test identifyLayers() with empty document', function() {
|
||||||
expect(10);
|
expect(11);
|
||||||
|
|
||||||
var drawing = new svgedit.draw.Drawing(svg);
|
var drawing = new svgedit.draw.Drawing(svg);
|
||||||
|
equals(drawing.getCurrentLayer(), null);
|
||||||
// By default, an empty document gets an empty group created.
|
// By default, an empty document gets an empty group created.
|
||||||
drawing.identifyLayers();
|
drawing.identifyLayers();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user