S.freeze.spec.js 465 B

1234567891011121314151617181920212223242526
  1. describe("S.freeze", function () {
  2. it("batches changes until end", function () {
  3. var d = S.data(1);
  4. S.freeze(function () {
  5. d(2);
  6. expect(d()).toBe(1);
  7. });
  8. expect(d()).toBe(2);
  9. });
  10. it("halts propagation within its scope", function () {
  11. S.root(function () {
  12. var d = S.data(1),
  13. f = S(function() { return d(); });
  14. S.freeze(function () {
  15. d(2);
  16. expect(f()).toBe(1);
  17. });
  18. expect(f()).toBe(2);
  19. });
  20. });
  21. });