alamid-junction
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -57,3 +57,3 @@ "use strict"; | ||
* @param {String|Object} key or an object with key/value-pairs | ||
* @param {*} value | ||
* @param {*=} value | ||
* @returns {Junction} | ||
@@ -82,6 +82,4 @@ */ | ||
* | ||
* @private | ||
* @param {String} key | ||
* @param {*} value | ||
* @private | ||
*/ | ||
@@ -128,3 +126,2 @@ Junction.prototype.setter = function (key, value) { | ||
* @returns {*} | ||
* @private | ||
*/ | ||
@@ -156,3 +153,2 @@ Junction.prototype.getter = function (key) { | ||
/** | ||
@@ -186,2 +182,5 @@ * Removes the given key from the internal value store and sets the signal on undefined. | ||
if (!signal) { | ||
if (typeof this.Signal !== "function") { | ||
throw new Error("Cannot create signal: You need to configure a Signal-class."); | ||
} | ||
signal = new this.Signal(); | ||
@@ -188,0 +187,0 @@ signal(this.getter(key)); |
{ | ||
"name": "alamid-junction", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "Provides convenient methods for setting and retrieving multiple signals", | ||
@@ -5,0 +5,0 @@ "main": "./lib/Junction.js", |
@@ -235,2 +235,8 @@ "use strict"; | ||
it("should throw no error if the key is unknown", function () { | ||
expect(function () { | ||
junction.remove("some unknown key"); | ||
}).to.not.throw; | ||
}); | ||
it("should be chainable", function () { | ||
@@ -266,28 +272,34 @@ expect(junction.remove("greeting")).to.equal(junction); | ||
}); | ||
it("should throw an error if the Signal-class is missing", function () { | ||
Junction.prototype.Signal = null; | ||
expect(function () { | ||
junction.signal("greeting"); | ||
}).to.throw("You need to configure a Signal-class"); | ||
Junction.prototype.Signal = Signal; | ||
}); | ||
describe(".signal(key) with alamid-signal", function () { | ||
describe("with alamid-signal", function () { | ||
before(function () { | ||
Junction.prototype.Signal = AlamidSignal; | ||
}); | ||
before(function () { | ||
Junction.prototype.Signal = AlamidSignal; | ||
}); | ||
after(function () { | ||
Junction.prototype.Signal = Signal; | ||
}); | ||
after(function () { | ||
Junction.prototype.Signal = Signal; | ||
}); | ||
it("should return the same signal instance multiple times", function () { | ||
var instance; | ||
it("should return the same signal instance multiple times", function () { | ||
var instance; | ||
instance = junction.signal("greeting"); | ||
expect(junction.signal("greeting")).to.equal(instance); | ||
}); | ||
instance = junction.signal("greeting"); | ||
expect(junction.signal("greeting")).to.equal(instance); | ||
}); | ||
it("should return a signal representing the value specified by key", function () { | ||
var greeting = junction.signal("greeting"); | ||
it("should return a signal representing the value specified by key", function () { | ||
var greeting = junction.signal("greeting"); | ||
expect(greeting()).to.equal(undefined); | ||
junction.set("greeting", "Ahoy!"); | ||
expect(greeting()).to.equal("Ahoy!"); | ||
expect(junction.get("greeting")).to.equal("Ahoy!"); | ||
expect(greeting()).to.equal(undefined); | ||
junction.set("greeting", "Ahoy!"); | ||
expect(greeting()).to.equal("Ahoy!"); | ||
expect(junction.get("greeting")).to.equal("Ahoy!"); | ||
}); | ||
}); | ||
@@ -294,0 +306,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18456
444