mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
text is black by default
This commit is contained in:
parent
cf76a06884
commit
a5b8c486ce
@ -65,7 +65,8 @@
|
||||
|
||||
Kinetic.Text.prototype = {
|
||||
___init: function(config) {
|
||||
var that = this;
|
||||
config = config || {};
|
||||
config.fill = config.fill || 'black';
|
||||
|
||||
if (config.width === undefined) {
|
||||
config.width = AUTO;
|
||||
@ -83,7 +84,7 @@
|
||||
|
||||
// update text data for certain attr changes
|
||||
for(var n = 0; n < attrChangeListLen; n++) {
|
||||
this.on(ATTR_CHANGE_LIST[n] + CHANGE_KINETIC, that._setTextData);
|
||||
this.on(ATTR_CHANGE_LIST[n] + CHANGE_KINETIC, this._setTextData);
|
||||
}
|
||||
|
||||
this._setTextData();
|
||||
|
@ -7,7 +7,7 @@ suite('Image', function(){
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
darth = new Kinetic.Image({
|
||||
var darth = new Kinetic.Image({
|
||||
x: 200,
|
||||
y: 60,
|
||||
image: imageObj,
|
||||
|
@ -1,5 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
suite('Text', function(){
|
||||
// ======================================================
|
||||
test('text with empty config is allowed', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
stage.add(layer);
|
||||
var text = new Kinetic.Text();
|
||||
|
||||
layer.add(text);
|
||||
layer.draw();
|
||||
});
|
||||
|
||||
test('add text with shadows', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
@ -294,4 +307,9 @@ suite('Text', function(){
|
||||
assert.equal(text.getTextWidth() > 0 && text.getTextWidth() < 100, true);
|
||||
|
||||
});
|
||||
|
||||
test('default text color should be black', function() {
|
||||
var text = new Kinetic.Text();
|
||||
assert.equal(text.fill(), 'black');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user