Skip to content

Commit

Permalink
should call superclass's initialize for aralejs/base#6
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed May 22, 2013
1 parent b63f9b5 commit f0a55bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ define(function(require, exports, module) {

// 初始化 attrs
var dataAttrsConfig = this._parseDataAttrsConfig(config)
this.initAttrs(config ? $.extend(dataAttrsConfig, config) : dataAttrsConfig)
Widget.superclass.initialize.call(this, config ? $.extend(dataAttrsConfig, config) : dataAttrsConfig)

// 初始化 props
this.parseElement()
Expand Down
14 changes: 14 additions & 0 deletions tests/widget-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,20 @@ define(function(require) {

dom.remove()
})

it('attr change callback', function() {
var spy = sinon.spy();
var Test = Widget.extend({
attrs: {
a: 1
},
_onChangeA: spy
})

var test = new Test();
test.set('a', 2)
expect(spy.calledOnce).to.be.ok()
})
})


Expand Down

0 comments on commit f0a55bf

Please sign in to comment.