mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
Konva.Text
will interpret undefined width
and height
as AUTO
This commit is contained in:
@@ -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(){
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user