Konva.Text will interpret undefined width and height as AUTO

This commit is contained in:
Anton Lavrenov
2016-07-08 10:44:15 +07:00
parent d466c01deb
commit 885a390277
3 changed files with 38 additions and 12 deletions

View File

@@ -168,6 +168,26 @@ suite('Text', function(){
});
// ======================================================
test('reset text auto width', function() {
var stage = addStage();
var layer = new Konva.Layer();
var text = new Konva.Text({
text: 'Hello World!',
fontSize: 50,
draggable: true,
width: 10
});
assert.equal(text.width(), 10);
text.setAttr('width', undefined);
assert.equal(text.width() > 100, true);
layer.add(text);
stage.add(layer);
});
// ======================================================
test('text multi line', function() {
var stage = addStage();
@@ -424,4 +444,4 @@ suite('Text', function(){
});
});
});