removed Options
This commit is contained in:
parent
6a158218c1
commit
a9677fca55
@ -1,37 +0,0 @@
|
||||
describe('Options', function() {
|
||||
var Klass;
|
||||
|
||||
beforeEach(function() {
|
||||
Klass = L.Class.extend({
|
||||
options: {
|
||||
foo1: 1,
|
||||
foo2: 2
|
||||
},
|
||||
|
||||
includes: [L.Mixin.Options]
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setOptions', function() {
|
||||
it('should set the given options, overwriting the default ones', function() {
|
||||
var a = new Klass();
|
||||
|
||||
expect(a.options).toEqual({foo1: 1, foo2: 2});
|
||||
|
||||
a.setOptions({foo2: 3, foo3: 4});
|
||||
|
||||
expect(a.options).toEqual({foo1: 1, foo2: 3, foo3: 4});
|
||||
});
|
||||
|
||||
it('should fire optionschange event if Options module is availalbe', function() {
|
||||
Klass.include(L.Mixin.Events);
|
||||
var a = new Klass(),
|
||||
spy = jasmine.createSpy('optionschange handler');
|
||||
|
||||
a.on('optionschange', spy);
|
||||
a.setOptions({foo1: 3});
|
||||
|
||||
expect(spy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* L.Mixin.Options adds a small shortcut for options handling
|
||||
*/
|
||||
|
||||
L.Mixin.Options = {
|
||||
setOptions: function(/*Object*/ options) {
|
||||
this.options = L.Util.extend(this.options || {}, options);
|
||||
|
||||
if (this.fireEvent) {
|
||||
this.fireEvent('optionschange');
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user