Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should be emitted when the map changes state', () => {
let called = false;
const value = new ObservableValue();
value.changed.connect(() => {
called = true;
});
value.set('set');
expect(called).to.equal(true);
});
it('should get the value of the object', () => {
const value = new ObservableValue('value');
expect(value.get()).to.equal('value');
const value2 = new ObservableValue({ one: 'one', two: 2 });
expect(
JSONExt.deepEqual(value2.get(), { one: 'one', two: 2 })
).to.equal(true);
});
});
it('should accept no arguments', () => {
const value = new ObservableValue();
expect(value instanceof ObservableValue).to.equal(true);
expect(value.get()).to.be.null;
});
it('should test whether the value is disposed', () => {
const value = new ObservableValue();
expect(value.isDisposed).to.equal(false);
value.dispose();
expect(value.isDisposed).to.equal(true);
});
});
it('should accept an initial JSON value', () => {
const value = new ObservableValue('value');
expect(value instanceof ObservableValue).to.equal(true);
const value2 = new ObservableValue({ one: 'one', two: 2 });
expect(value2 instanceof ObservableValue).to.equal(true);
});
});
it('should have value changed args', () => {
let called = false;
const value = new ObservableValue();
value.changed.connect((sender, args) => {
expect(sender).to.equal(value);
expect(args.newValue).to.equal('set');
expect(args.oldValue).to.be.null;
called = true;
});
value.set('set');
expect(called).to.equal(true);
});
});
it('should get the value of the object', () => {
const value = new ObservableValue('value');
expect(value.get()).to.equal('value');
const value2 = new ObservableValue({ one: 'one', two: 2 });
expect(
JSONExt.deepEqual(value2.get(), { one: 'one', two: 2 })
).to.equal(true);
});
});
it('should accept an initial JSON value', () => {
const value = new ObservableValue('value');
expect(value instanceof ObservableValue).to.equal(true);
const value2 = new ObservableValue({ one: 'one', two: 2 });
expect(value2 instanceof ObservableValue).to.equal(true);
});
});
it('should return `Value`', () => {
const value = new ObservableValue();
expect(value.type).to.equal('Value');
});
});
it('should set the value of the object', () => {
const value = new ObservableValue();
value.set('value');
expect(value.get()).to.equal('value');
});
});