From e80e80558f01e537fc8a7e8dff9790fde9b8f970 Mon Sep 17 00:00:00 2001 From: smhg Date: Thu, 22 Jun 2017 08:45:58 +0200 Subject: [PATCH] add failing test case for #111 --- test/cortex_test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/cortex_test.js b/test/cortex_test.js index 99b45b2..aeeb475 100644 --- a/test/cortex_test.js +++ b/test/cortex_test.js @@ -365,6 +365,20 @@ describe("Cortex", function() { expect(updated.c.getValue()).toEqual(this.value.c); }) }); + + describe("when changing a changed value back to the original within the same tick", function() { + it("sets the last value", function() { + var updated; + var cortex = new Cortex(this.value, function(updatedCortex) { + updated = updatedCortex; + }); + cortex.a.set(100); + cortex.a.set(1); // set back to original within the same tick + jasmine.clock().tick(); + + expect(updated.a.getValue()).toEqual(1); + }); + }); }); });