UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

37 lines (36 loc) 1.36 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; define(["require", "exports", './BaseStore'], function (require, exports, BaseStore_1) { "use strict"; var expect = chai.expect; var TestStore = (function (_super) { __extends(TestStore, _super); function TestStore() { _super.apply(this, arguments); } TestStore.prototype.doThings = function () { this.emitChange(); }; return TestStore; }(BaseStore_1.BaseStore)); describe('BaseStore', function () { it('can emit changes', function () { var test = new TestStore(); var hasChanged = false; test.subscribe(function () { return hasChanged = true; }); test.doThings(); expect(hasChanged).to.be.true; }); it('can unsubscribe', function () { var test = new TestStore(); var hasChanged = false; var disposable = test.subscribe(function () { return hasChanged = true; }); disposable.dispose(); test.doThings(); expect(hasChanged).to.be.false; }); }); });