From 9cb362d3892899975fc24648d9b8de143ba491c0 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Fri, 3 Jun 2011 22:27:18 +0200 Subject: [PATCH] Add tests for Symbol#place --- test/tests/PlacedSymbol.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/test/tests/PlacedSymbol.js b/test/tests/PlacedSymbol.js index fd840c03..d066c24e 100644 --- a/test/tests/PlacedSymbol.js +++ b/test/tests/PlacedSymbol.js @@ -37,4 +37,30 @@ test('Symbol definition selection', function() { equals(function() { return paper.project.selectedItems.length == 0; }, true); -}); \ No newline at end of file +}); + +test('Symbol#place()', function() { + var path = new Path.Circle([50, 50], 50); + var symbol = new Symbol(path); + var placedSymbol = symbol.place(); + equals(function() { + return placedSymbol.parent == paper.project.activeLayer; + }, true); + + equals(function() { + return placedSymbol.symbol == symbol; + }, true); + + equals(function() { + return placedSymbol.position.toString(); + }, '{ x: 0, y: 0 }'); +}); + +test('Symbol#place(position)', function() { + var path = new Path.Circle([50, 50], 50); + var symbol = new Symbol(path); + var placedSymbol = symbol.place(new Point(100, 100)); + equals(function() { + return placedSymbol.position.toString(); + }, '{ x: 100, y: 100 }'); +});