mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 21:34:50 +08:00
warning on dublicate ids
This commit is contained in:
@@ -118,20 +118,23 @@ suite('Node', function() {
|
||||
assert.equal(layer.getAbsoluteOpacity(), 0.5);
|
||||
});
|
||||
|
||||
test.skip('warn on duplicate id', function() {
|
||||
test.only('warn on duplicate id', function() {
|
||||
var oldWarn = Konva.Util.warn;
|
||||
var called = false;
|
||||
Konva.Util.warn = function() {
|
||||
called = true;
|
||||
};
|
||||
var circle = new Konva.Circle({
|
||||
var circle1 = new Konva.Circle({
|
||||
id: 'circle'
|
||||
});
|
||||
var circle = new Konva.Circle({
|
||||
var circle2 = new Konva.Circle({
|
||||
id: 'circle'
|
||||
});
|
||||
|
||||
assert.equal(called, true);
|
||||
Konva.Util.warn = oldWarn;
|
||||
circle1.destroy();
|
||||
circle2.destroy();
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
@@ -1153,8 +1156,6 @@ suite('Node', function() {
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* add custom attr that points to self. The setAttrs method should
|
||||
* not inifinitely recurse causing a stack overflow
|
||||
@@ -3085,7 +3086,7 @@ suite('Node', function() {
|
||||
|
||||
// last shape is registered
|
||||
assert.equal(Konva.ids.shape, rect);
|
||||
|
||||
|
||||
// destroying circle should not remove rect from regiter
|
||||
circle.destroy();
|
||||
|
||||
|
||||
@@ -1231,12 +1231,11 @@ suite('Stage', function() {
|
||||
image.src = url;
|
||||
});
|
||||
|
||||
test.only('show a warning if the stage has too many layers', function() {
|
||||
test('show a warning if the stage has too many layers', function() {
|
||||
var stage = addStage();
|
||||
var oldWarn = Konva.Util.warn;
|
||||
var called = false;
|
||||
Konva.Util.warn = function() {
|
||||
oldWarn.apply(null, arguments);
|
||||
called = true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user