repair tests

This commit is contained in:
lavrton
2015-04-13 07:17:32 +07:00
parent dfecf5377f
commit 44f7d17847
5 changed files with 1688 additions and 1659 deletions

3302
konva.js

File diff suppressed because it is too large Load Diff

12
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1123,26 +1123,27 @@
* @returns {Object}
*/
toObject: function() {
var type = Konva.Util,
obj = {},
var obj = {},
attrs = this.getAttrs(),
key, val, getter, defaultValue;
obj.attrs = {};
// serialize only attributes that are not function, image, DOM, or objects with methods
for(key in attrs) {
val = attrs[key];
if (!type._isFunction(val) && !type._isElement(val) && !(type._isObject(val) && type._hasMethods(val))) {
getter = this[key];
// remove attr value so that we can extract the default value from the getter
delete attrs[key];
defaultValue = getter ? getter.call(this) : null;
// restore attr value
attrs[key] = val;
if (defaultValue !== val) {
obj.attrs[key] = 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];
// remove attr value so that we can extract the default value from the getter
delete attrs[key];
defaultValue = getter ? getter.call(this) : null;
// restore attr value
attrs[key] = val;
if (defaultValue !== val) {
obj.attrs[key] = val;
}
}

View File

@@ -739,7 +739,7 @@ suite('MouseEvents', function() {
groupMousedowns++;
});
layer.add(circle);
stage.add(layer);
layer.draw();

View File

@@ -444,7 +444,7 @@ suite('Node', function() {
stage.add(layer);
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() {
var stage = addStage();
var layer = new Konva.Layer();
circle = new Konva.Circle({
var circle = new Konva.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 70,