Skip to content

Commit

Permalink
Introduced isBoxedObservable, fixes #804
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Mar 1, 2017
1 parent fd5658b commit a4e2b0e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
# 3.1.1

* Introduced `isBoxedObservable(value)`, fixes #804

# 3.1.0

### Improved strict mode
Expand Down
2 changes: 1 addition & 1 deletion src/mobx.ts
Expand Up @@ -33,7 +33,7 @@ export { IInterceptable, IInterceptor } from "./types/in
export { IListenable } from "./types/listen-utils";
export { IObjectWillChange, IObjectChange, IObservableObject, isObservableObject } from "./types/observableobject";

export { IValueDidChange, IValueWillChange, IObservableValue } from "./types/observablevalue";
export { IValueDidChange, IValueWillChange, IObservableValue, isObservableValue as isBoxedObservable } from "./types/observablevalue";
export { IObservableArray, IArrayWillChange, IArrayWillSplice, IArrayChange, IArraySplice, isObservableArray } from "./types/observablearray";
export { IKeyValueMap, ObservableMap, IMapEntries, IMapEntry, IMapWillChange, IMapChange, isObservableMap, map, IObservableMapInitialValues, IMap } from "./types/observablemap";

Expand Down
1 change: 1 addition & 0 deletions test/api.js
Expand Up @@ -25,6 +25,7 @@ test('correct api should be exposed', function(t) {
'intercept',
'isAction',
'isArrayLike',
'isBoxedObservable',
'isComputed',
'isModifierDescriptor',
'isObservable',
Expand Down
10 changes: 10 additions & 0 deletions test/makereactive.js
Expand Up @@ -67,6 +67,16 @@ test('isObservable', function(t) {
t.end();
})

test('isBoxedObservable', function(t) {
t.equal(m.isBoxedObservable(m.observable({})), false);
t.equal(m.isBoxedObservable(m.computed(() => 3)), false);
t.equal(m.isBoxedObservable(m.observable(3)), true);
t.equal(m.isBoxedObservable(m.observable.box(3)), true);
t.equal(m.isBoxedObservable(m.observable.box({})), true);
t.equal(m.isBoxedObservable(m.observable.shallowBox({})), true);
t.end()
})

test('observable1', function(t) {
m.extras.resetGlobalState();

Expand Down

0 comments on commit a4e2b0e

Please sign in to comment.