Move cloneAndCompare() to Item_Cloning.js test file.

This commit is contained in:
Jürg Lehni 2011-05-26 09:19:51 +01:00
parent 4fbc462a96
commit e273c54ad2
2 changed files with 18 additions and 18 deletions

View file

@ -103,24 +103,6 @@ function compareGradientColors(gradientColor, gradientColor2, checkIdentity) {
}, true);
}
function cloneAndCompare(item) {
var copy = item.clone();
equals(function() {
return item.parent == copy.parent;
}, true);
equals(function() {
return item.nextSibling == copy;
}, true);
if (item.name) {
equals(function() {
return copy.parent.children[copy.name] == copy;
}, true);
}
compareItems(item, copy, true);
// Remove the cloned item to restore the document:
copy.remove();
}
function comparePathStyles(style, style2, checkIdentity) {
if (checkIdentity) {
equals(function() {

View file

@ -1,3 +1,21 @@
function cloneAndCompare(item) {
var copy = item.clone();
equals(function() {
return item.parent == copy.parent;
}, true);
equals(function() {
return item.nextSibling == copy;
}, true);
if (item.name) {
equals(function() {
return copy.parent.children[copy.name] == copy;
}, true);
}
compareItems(item, copy, true);
// Remove the cloned item to restore the document:
copy.remove();
}
test('Path#clone()', function() {
var proj = paper.project;
var path = new Path([10, 20], [30, 40]);