mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 19:07:59 +08:00
refactor findOne method
This commit is contained in:
@@ -291,7 +291,7 @@ suite('Container', function() {
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('select shape by id and name with findOne', function() {
|
||||
test('select shape with findOne', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer({
|
||||
id: 'myLayer'
|
||||
@@ -330,6 +330,10 @@ suite('Container', function() {
|
||||
assert.equal(node, undefined, 'node should be undefined');
|
||||
node = stage.findOne('#myLayer');
|
||||
assert.equal(node, layer, 'node type should be Layer');
|
||||
node = stage.findOne(function(node) {
|
||||
return node.getType() === 'Shape';
|
||||
});
|
||||
assert.equal(node, circle, 'findOne should work with functions');
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
|
Reference in New Issue
Block a user