text is black by default

This commit is contained in:
lavrton 2015-01-20 17:05:56 +07:00
parent cf76a06884
commit a5b8c486ce
3 changed files with 22 additions and 3 deletions

View File

@ -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();

View File

@ -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,

View File

@ -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');
});
});