diff --git a/src/ol/control/Control.js b/src/ol/control/Control.js
index de188a5e94..12dc1c50a9 100644
--- a/src/ol/control/Control.js
+++ b/src/ol/control/Control.js
@@ -75,7 +75,7 @@ ol.control.Control.prototype.activate = function() {
*/
ol.control.Control.prototype.deactivate = function() {
var returnValue = this.active_;
- this.active_ = true;
+ this.active_ = false;
return returnValue;
};
diff --git a/test/ol.html b/test/ol.html
index 2eada8abd2..b06b645fdf 100644
--- a/test/ol.html
+++ b/test/ol.html
@@ -78,6 +78,7 @@
+
diff --git a/test/spec/ol/control/Control.test.js b/test/spec/ol/control/Control.test.js
new file mode 100644
index 0000000000..cb193e2ac2
--- /dev/null
+++ b/test/spec/ol/control/Control.test.js
@@ -0,0 +1,34 @@
+describe('ol.control.Control', function() {
+
+ it('should be easy to create and destroy a control', function() {
+ var control = new ol.control.Control();
+ expect(control).toBeA(ol.control.Control);
+ expect(control.autoActivate_).toBe(false);
+
+ control.destroy();
+ expect(control.autoActivate_).toBeUndefined();
+ });
+
+ it('can be activated and deactivated', function() {
+ var control = new ol.control.Control();
+ expect(control.active_).toBe(false);
+ expect(control.activate()).toBe(true);
+ expect(control.active_).toBe(true);
+ expect(control.activate()).toBe(false);
+ expect(control.deactivate()).toBe(true);
+ expect(control.active_).toBe(false);
+ expect(control.deactivate()).toBe(false);
+ control.destroy();
+ });
+
+ it('auto-activates itself and can be added to a map', function() {
+ control = new ol.control.Control();
+ control.setMap('foo');
+ expect(control.map_).toBe('foo');
+ expect(control.active_).toBe(false);
+ control.autoActivate_ = true;
+ control.setMap('bar');
+ expect(control.map_).toBe('bar');
+ expect(control.active_).toBe(true);
+ });
+});
\ No newline at end of file