Add named arguments tests for Group & Rectangle.

This commit is contained in:
Jonathan Puckey 2013-03-03 14:20:45 +01:00
parent 91dfc9b1ea
commit c6602d4fcf
2 changed files with 23 additions and 0 deletions

View file

@ -40,6 +40,19 @@ test('new Group([item])', function() {
}, true);
});
test('new Group({children:[item]})', function() {
var path = new Path();
var group = new Group({
children: [path]
});
equals(function() {
return paper.project.activeLayer.children.length;
}, 1);
equals(function() {
return group.children[0] == path;
}, true);
});
test('Group bounds', function() {
paper.project.currentStyle = {
strokeWidth: 5,

View file

@ -16,11 +16,21 @@ test('new Rectangle(new Point(10, 20), new Size(30, 40));', function() {
equals(rect.toString(), '{ x: 10, y: 20, width: 30, height: 40 }');
});
test('new Rectangle({ point: new Point(10, 20), size: new Size(30, 40)});', function() {
var rect = new Rectangle({ point: new Point(10, 20), size: new Size(30, 40)});
equals(rect.toString(), '{ x: 10, y: 20, width: 30, height: 40 }');
});
test('new Rectangle([10, 20], [30, 40]);', function() {
var rect = new Rectangle([10, 20], [30, 40]);
equals(rect.toString(), '{ x: 10, y: 20, width: 30, height: 40 }');
});
test('new Rectangle({from: [10, 20], to: [30, 40]});', function() {
var rect = new Rectangle({from: [10, 20], to: [30, 40]});
equals(rect.toString(), '{ x: 10, y: 20, width: 30, height: 40 }');
});
test('new Rectangle(new Point(10, 20), new Point(30, 40));', function() {
var rect = new Rectangle(new Point(10, 20), new Point(30, 40));
equals(rect.toString(), '{ x: 10, y: 20, width: 20, height: 20 }');