tied className into toJSON and create. deprecated shapeType property and getShapeType method

This commit is contained in:
Eric Rowell
2013-05-19 21:48:48 -07:00
parent 7069bf9e0c
commit 35b1f61bda
32 changed files with 43 additions and 65 deletions

View File

@@ -111,9 +111,9 @@ Test.Modules.CONTAINER = {
var node;
node = stage.get('#myCircle')[0];
test(node.shapeType === 'Circle', 'shape type should be Circle');
test(node.className === 'Circle', 'className should be Circle');
node = layer.get('.myRect')[0];
test(node.shapeType === 'Rect', 'shape type should be rect');
test(node.className === 'Rect', 'className should be rect');
node = layer.get('#myLayer')[0];
test(node === undefined, 'node should be undefined');
node = stage.get('#myLayer')[0];

View File

@@ -46,7 +46,7 @@ Test.Modules.PATH = {
path.setData('M200,100h100v50z');
test(path.getShapeType() === 'Path', 'shape type should be Path');
test(path.getClassName() === 'Path', 'getClassName should be Path');
},
'add path with line cap and line join': function(containerId) {

View File

@@ -25,7 +25,7 @@ Test.Modules.REGULAR_POLYGON = {
layer.add(poly);
stage.add(layer);
test(poly.getShapeType() === 'RegularPolygon', 'shape type should be RegularPolygon');
test(poly.getClassName() === 'RegularPolygon', 'sgetClassName should be RegularPolygon');
},
'add regular polygon square': function(containerId) {

View File

@@ -30,7 +30,7 @@ Test.Modules.STAR = {
layer.add(star);
stage.add(layer);
test(star.getShapeType() === 'Star', 'shape type should be Star');
test(star.getClassName() === 'Star', 'getClassName should be Star');
},
'add five point star with line join and shadow': function(containerId) {
var stage = new Kinetic.Stage({

View File

@@ -34,7 +34,7 @@ Test.Modules['TEXT PATH'] = {
layer.add(textpath);
stage.add(layer);
test(textpath.getShapeType() === 'TextPath', 'shape type should be TextPath');
test(textpath.getClassName() === 'TextPath', 'getClassName should be TextPath');
},
'Render Text Along two connected Bezier': function(containerId) {
var stage = new Kinetic.Stage({

View File

@@ -60,7 +60,7 @@ Test.Modules.BLOB = {
test(blob1.getTension() === 0.8, 'blob1 tension should be 0.8');
test(blob2.getTension() === 1.2, 'blob2 tension should be 1.2');
test(blob1.getShapeType() === 'Blob', 'shape type should be Blob');
test(blob1.getClassName() === 'Blob', 'getClassName should be Blob');
}

View File

@@ -33,7 +33,7 @@ Test.Modules.CIRCLE = {
test(attrs.strokeWidth === 4, 'strokeWidth attr should be strokeWidth');
test(attrs.name === 'myCircle', 'name attr should be myCircle');
test(attrs.draggable === true, 'draggable attr should be true');
test(circle.getShapeType() === 'Circle', 'shape type should be Circle');
test(circle.getClassName() === 'Circle', 'getClassName should be Circle');
},
'add circle with pattern fill': function(containerId) {
var imageObj = new Image();

View File

@@ -118,7 +118,7 @@ Test.Modules.IMAGE = {
//document.body.appendChild(layer.bufferCanvas.element)
test(darth.getShapeType() === 'Image', 'shape type should be Image');
test(darth.getClassName() === 'Image', 'getClassName should be Image');
};
imageObj.src = '../assets/darth-vader.jpg';

View File

@@ -47,7 +47,7 @@ Test.Modules.LINE = {
line.setPoints([73, 160, 340, 23]);
test(line.getPoints()[0].x === 73, 'first point x should be 73');
test(line.getShapeType() === 'Line', 'shape type should be Line');
test(line.getClassName() === 'Line', 'getClassName should be Line');
},
'test default ponts array for two lines': function(containerId) {
var stage = new Kinetic.Stage({

View File

@@ -37,7 +37,7 @@ Test.Modules.POLYGON - {
layer.add(poly);
stage.add(layer);
test(poly.getShapeType() === 'Polygon', 'shape type should be Polygon');
test(poly.getClassName() === 'Polygon', 'getClassName should be Polygon');
}
};

View File

@@ -25,7 +25,7 @@ Test.Modules.RECT = {
layer.add(rect);
stage.add(layer);
test(rect.getShapeType() === 'Rect', 'shape type should be Rect');
test(rect.getClassName() === 'Rect', 'className should be Rect');
},
'add stroke rect': function(containerId) {
var stage = new Kinetic.Stage({

View File

@@ -79,7 +79,7 @@ Test.Modules.SPLINE = {
//console.log(layer.toDataURL());
testDataUrl(layer.toDataURL(), 'curvy lines', 'problem with curvy lines');
test(line1.getShapeType() === 'Spline', 'shape type should be Spline');
test(line1.getClassName() === 'Spline', 'getClassName should be Spline');
},
'create from points represented as a flat array': function(containerId) {

View File

@@ -112,7 +112,7 @@ Test.Modules.SPRITE = {
}, 3000);
//document.body.appendChild(layer.bufferCanvas.element)
test(sprite.getShapeType() === 'Sprite', 'shape type should be Sprite');
test(sprite.getClassName() === 'Sprite', 'getClassName should be Sprite');
test(sprite.getIndex() === 0, 'sprite index should default to 0');
};

View File

@@ -55,7 +55,7 @@ Test.Modules.Text = {
layer.add(group);
stage.add(layer);
test(text.getShapeType() === 'Text', 'shape type should be Text');
test(text.getClassName() === 'Text', 'getClassName should be Text');
},
'text getters and setters': function(containerId) {
var stage = new Kinetic.Stage({

View File

@@ -24,7 +24,7 @@ Test.Modules.Wedge = {
//console.log(layer.toDataURL());
testDataUrl(layer.toDataURL(), 'wedge', 'problem rendering wedge');
test(wedge.getShapeType() === 'Wedge', 'shape type should be Wedge');
test(wedge.getClassName() === 'Wedge', 'getClassName should be Wedge');
},
'set wedge angle using degrees': function(containerId) {
var stage = new Kinetic.Stage({