mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Move cloneAndCompare() to Item_Cloning.js test file.
This commit is contained in:
parent
4fbc462a96
commit
e273c54ad2
2 changed files with 18 additions and 18 deletions
|
@ -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() {
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue