fix multiple selector for find() method. close #735

This commit is contained in:
Anton Lavrenov 2019-09-09 10:54:23 -05:00
parent c8aa734808
commit c3f4e53be5
4 changed files with 54 additions and 1333 deletions

View File

@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## Not released: ## Not released:
* Fix multiple selector for find() method
## 4.0.9 - 2019-09-06 ## 4.0.9 - 2019-09-06
* Fix `Konva.Transformer` behavior on mirrored nodes * Fix `Konva.Transformer` behavior on mirrored nodes

1379
konva.js

File diff suppressed because it is too large Load Diff

View File

@ -1569,7 +1569,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
if (this.hasName(sel.slice(1))) { if (this.hasName(sel.slice(1))) {
return true; return true;
} }
} else if (this.className === selector || this.nodeType === selector) { } else if (this.className === sel || this.nodeType === sel) {
return true; return true;
} }
} }

View File

@ -889,7 +889,7 @@ suite('Container', function() {
}); });
// ====================================================== // ======================================================
test('node type selector', function() { test.only('node type selector', function() {
var stage = addStage(); var stage = addStage();
var layer = new Konva.Layer(); var layer = new Konva.Layer();
var fooLayer = new Konva.Layer(); var fooLayer = new Konva.Layer();
@ -928,6 +928,8 @@ suite('Container', function() {
assert.equal(layer.find('Shape').length, 2, 'layer should have 2 shapes'); assert.equal(layer.find('Shape').length, 2, 'layer should have 2 shapes');
assert.equal(layer.find('Layer').length, 0, 'layer should have 0 layers'); assert.equal(layer.find('Layer').length, 0, 'layer should have 0 layers');
assert.equal(layer.find('Group, Rect').length, 3, 'layer should have 3 [group or rects]');
assert.equal( assert.equal(
fooLayer.find('Group').length, fooLayer.find('Group').length,
0, 0,