fix undefined name bug

This commit is contained in:
lavrton
2015-02-08 07:39:43 +07:00
parent 5df69badbf
commit 264a4bab1c
4 changed files with 19 additions and 12 deletions

View File

@@ -1103,17 +1103,22 @@ suite('Node', function() {
radius: 70,
fill: 'green',
stroke: 'black',
strokeWidth: 4,
name: 'myCircle foo'
strokeWidth: 4
});
layer.add(circle);
stage.add(layer);
assert.equal(circle.getName(),'myCircle foo');
assert.equal(circle.getName(), undefined);
circle.addName('foo');
assert.equal(circle.getName(),'foo');
circle.addName('myCircle');
assert.equal(circle.getName(),'foo myCircle');
// add existing name
circle.addName('foo');
assert.equal(circle.getName(),'myCircle foo');
assert.equal(circle.getName(),'foo myCircle');
// check hasName
assert.equal(circle.hasName('myCircle'), true);