mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Add named arguments tests for Group & Rectangle.
This commit is contained in:
parent
91dfc9b1ea
commit
c6602d4fcf
2 changed files with 23 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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 }');
|
||||
|
|
Loading…
Reference in a new issue