Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 75c59b5

Browse files
committed
Port ComputedLoaderMsg to mobx 4
1 parent a8ac719 commit 75c59b5

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/computed/loader-msg.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
* @fileOverview computed values that are used in loader UI components.
33
*/
44

5-
import { computed, extendObservable } from 'mobx';
5+
import { extendObservable } from 'mobx';
66

77
const ComputedLoaderMsg = store => {
88
extendObservable(store, {
9-
loadingMsg: computed(() => {
9+
get loadingMsg() {
1010
const { percentSynced: percent } = store;
1111
return getLoadingMsg(percent);
12-
}),
12+
},
1313
});
1414
};
1515

test/unit/computed/loader-msg.spec.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,31 @@ describe('Computed Loader Msg Unit Tests', () => {
2323
expect(store.loadingMsg, 'to equal', LOADING_COPY_START);
2424
});
2525

26-
it('should work for < 0 and > 1 percentages', () => {
26+
it('should work for < 0 percentages', () => {
2727
store.percentSynced = -1;
2828
ComputedLoaderMsg(store);
2929
expect(store.loadingMsg, 'to equal', LOADING_COPY_START);
30+
});
31+
32+
it('should work for > 1 percentages', () => {
3033
store.percentSynced = 1.01;
3134
ComputedLoaderMsg(store);
3235
expect(store.loadingMsg, 'to equal', LOADING_COPY_END);
3336
});
3437

35-
it('should work for each milestone percentage', () => {
38+
it('should work for 1st milestone percentage', () => {
3639
store.percentSynced = 0.1;
3740
ComputedLoaderMsg(store);
3841
expect(store.loadingMsg, 'to equal', LOADING_COPY_START);
42+
});
43+
44+
it('should work for 2nd milestone percentage', () => {
3945
store.percentSynced = LOADING_PERCENT_MID;
4046
ComputedLoaderMsg(store);
4147
expect(store.loadingMsg, 'to equal', LOADING_COPY_MID);
48+
});
49+
50+
it('should work for 3rd milestone percentage', () => {
4251
store.percentSynced = LOADING_PERCENT_END;
4352
ComputedLoaderMsg(store);
4453
expect(store.loadingMsg, 'to equal', LOADING_COPY_END);

0 commit comments

Comments
 (0)