mirror of
https://github.com/konvajs/konva.git
synced 2025-09-21 04:27:56 +08:00
repair tests
This commit is contained in:
12
konva.min.js
vendored
12
konva.min.js
vendored
File diff suppressed because one or more lines are too long
11
src/Node.js
11
src/Node.js
@@ -1123,17 +1123,19 @@
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
toObject: function() {
|
toObject: function() {
|
||||||
var type = Konva.Util,
|
var obj = {},
|
||||||
obj = {},
|
|
||||||
attrs = this.getAttrs(),
|
attrs = this.getAttrs(),
|
||||||
key, val, getter, defaultValue;
|
key, val, getter, defaultValue;
|
||||||
|
|
||||||
obj.attrs = {};
|
obj.attrs = {};
|
||||||
|
|
||||||
// serialize only attributes that are not function, image, DOM, or objects with methods
|
|
||||||
for(key in attrs) {
|
for(key in attrs) {
|
||||||
val = attrs[key];
|
val = attrs[key];
|
||||||
if (!type._isFunction(val) && !type._isElement(val) && !(type._isObject(val) && type._hasMethods(val))) {
|
// serialize only attributes that are not function, image, DOM, or objects with methods
|
||||||
|
if (Konva.Util._isFunction(val) || Konva.Util._isElement(val) ||
|
||||||
|
(Konva.Util._isObject(val) || Konva.Util._hasMethods(val))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
getter = this[key];
|
getter = this[key];
|
||||||
// remove attr value so that we can extract the default value from the getter
|
// remove attr value so that we can extract the default value from the getter
|
||||||
delete attrs[key];
|
delete attrs[key];
|
||||||
@@ -1144,7 +1146,6 @@
|
|||||||
obj.attrs[key] = val;
|
obj.attrs[key] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
obj.className = this.getClassName();
|
obj.className = this.getClassName();
|
||||||
return obj;
|
return obj;
|
||||||
|
@@ -739,7 +739,7 @@ suite('MouseEvents', function() {
|
|||||||
groupMousedowns++;
|
groupMousedowns++;
|
||||||
});
|
});
|
||||||
|
|
||||||
layer.add(circle);
|
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
layer.draw();
|
layer.draw();
|
||||||
|
|
||||||
|
@@ -444,7 +444,7 @@ suite('Node', function() {
|
|||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
assert.equal(line.points() === clone.points(), false);
|
assert.equal(line.points() === clone.points(), false);
|
||||||
assert.equal(clone.points().toString(), '0,0,10,10');
|
assert.equal(JSON.stringify(clone.points()), '[0,0,10,10]');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ======================================================
|
// ======================================================
|
||||||
@@ -986,7 +986,7 @@ suite('Node', function() {
|
|||||||
test('add shape with custom attr pointing to self', function() {
|
test('add shape with custom attr pointing to self', function() {
|
||||||
var stage = addStage();
|
var stage = addStage();
|
||||||
var layer = new Konva.Layer();
|
var layer = new Konva.Layer();
|
||||||
circle = new Konva.Circle({
|
var circle = new Konva.Circle({
|
||||||
x: stage.getWidth() / 2,
|
x: stage.getWidth() / 2,
|
||||||
y: stage.getHeight() / 2,
|
y: stage.getHeight() / 2,
|
||||||
radius: 70,
|
radius: 70,
|
||||||
|
Reference in New Issue
Block a user