Skip to content

Commit

Permalink
fix cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
fabi committed Jun 24, 2016
1 parent d39dfc3 commit 8417be9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Color.prototype = {

clone: function () {
var col = new Color();
col.values = clone(col.values);
col.values = clone(this.values);
return col;
}
};
Expand Down
2 changes: 2 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ it('Clone', function () {
});
notStrictEqual(clone, clone.clone());
deepEqual(clone.rgbaArray(), [10, 20, 30, 1]);
deepEqual(clone.clone().rgbaArray(), [10, 20, 30, 1]);
deepEqual(clone.clone().rgb(50, 40, 30).rgbaArray(), [50, 40, 30, 1]);
deepEqual(clone.rgbaArray(), [10, 20, 30, 1]);
});
Expand All @@ -710,6 +711,7 @@ it('Clone: default constructor', function () {
// same tests used in base case 'Clone'
notStrictEqual(defaultColor, clonedFromDefault);
deepEqual(defaultColor.rgbaArray(), [0, 0, 0, 1]);
deepEqual(defaultColor.clone().rgbaArray(), [0, 0, 0, 1]);
deepEqual(defaultColor.clone().rgb(0, 0, 0).rgbaArray(), [0, 0, 0, 1]);
deepEqual(defaultColor.rgbaArray(), [0, 0, 0, 1]);

Expand Down

0 comments on commit 8417be9

Please sign in to comment.