Skip to content

Commit 439fd46

Browse files
committed
upgrade mobx3 to mobx5
1 parent 6e5c85b commit 439fd46

File tree

12 files changed

+59
-28
lines changed

12 files changed

+59
-28
lines changed

packages/selenium-ide/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"fuse.js": "^3.3.0",
5555
"google-closure-library": "^20170521.0.0",
5656
"js-beautify": "^1.7.5",
57-
"mobx": "^3.3.1",
58-
"mobx-react": "^4.3.3",
57+
"mobx": "^5.9.0",
58+
"mobx-react": "^5.4.3",
5959
"modifier-keys": "^1.2.1",
6060
"project-name-generator": "^2.1.4",
6161
"prop-types": "^15.5.10",

packages/selenium-ide/src/neo/__test__/IO/legacy/migrate.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import fs from 'fs'
1919
import path from 'path'
20-
import { useStrict } from 'mobx'
20+
import { configure } from 'mobx'
2121
import {
2222
verifyFile,
2323
FileTypes,
@@ -27,7 +27,9 @@ import {
2727
migrateUrls,
2828
} from '../../../IO/legacy/migrate'
2929

30-
useStrict(true)
30+
configure({
31+
enforceActions: 'observed',
32+
})
3133

3234
describe('file classifier', () => {
3335
it('should recognize suite', () => {

packages/selenium-ide/src/neo/__test__/models/Suite.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
import { useStrict } from 'mobx'
18+
import { configure } from 'mobx'
1919
import ProjectStore from '../../stores/domain/ProjectStore'
2020
import Suite from '../../models/Suite'
2121
import TestCase from '../../models/TestCase'
2222

23-
useStrict(true)
23+
configure({
24+
enforceActions: 'observed',
25+
})
2426

2527
describe('Suite model', () => {
2628
it("new suite should be named 'Utitled Suite'", () => {

packages/selenium-ide/src/neo/__test__/models/TestCase.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
import { useStrict } from 'mobx'
18+
import { configure } from 'mobx'
1919
import TestCase from '../../models/TestCase'
2020
import Command from '../../models/Command'
2121

22-
useStrict(true)
22+
configure({
23+
enforceActions: 'observed',
24+
})
2325

2426
describe('TestCase model', () => {
2527
it("new test should be named 'Untitled Test'", () => {

packages/selenium-ide/src/neo/__test__/stores/domain/ProjectStore.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
import { useStrict } from 'mobx'
18+
import { configure } from 'mobx'
1919
import ProjectStore from '../../../stores/domain/ProjectStore'
2020
import Suite from '../../../models/Suite'
2121
import TestCase from '../../../models/TestCase'
2222

23-
useStrict(true)
23+
configure({
24+
enforceActions: 'observed',
25+
})
2426

2527
describe('Project Store', () => {
2628
it('should have an id', () => {

packages/selenium-ide/src/neo/__test__/stores/view/Variables.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
import { useStrict } from 'mobx'
18+
import { configure } from 'mobx'
1919
import Variables from '../../../stores/view/Variables'
2020

21-
useStrict(true)
21+
configure({
22+
enforceActions: 'observed',
23+
})
2224

2325
describe('variables', () => {
2426
let variables

packages/selenium-ide/src/neo/components/CommandInput/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class CommandInput extends React.Component {
3939
items={
4040
this.props.value
4141
? Commands.search(this.props.value)
42-
: Commands.list.values()
42+
: Array.from(Commands.list.values())
4343
}
4444
renderDefaultStyledItem={item => (
4545
<span key={item.name}>{item.name}</span>

packages/selenium-ide/src/neo/containers/Root/index.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
import React from 'react'
1919
import ReactDOM from 'react-dom'
2020
import { AppContainer } from 'react-hot-loader'
21-
import { useStrict } from 'mobx'
21+
import { configure } from 'mobx'
2222
import Panel from '../Panel'
2323

24-
useStrict(true)
24+
configure({
25+
enforceActions: 'observed',
26+
})
2527

2628
const render = Component => {
2729
ReactDOM.render(

packages/selenium-ide/src/neo/models/Command/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class CommandList {
200200

201201
@computed
202202
get array() {
203-
return this.list.keys()
203+
return Array.from(this.list.keys())
204204
}
205205

206206
@computed
@@ -213,7 +213,7 @@ class CommandList {
213213

214214
@computed
215215
get fuse() {
216-
return new Fuse(this.list.values(), {
216+
return new Fuse(Array.from(this.list.values()), {
217217
shouldSort: true,
218218
threshold: 0.4,
219219
location: 0,

packages/selenium-ide/src/neo/models/Suite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default class Suite {
5353
@computed
5454
get tests() {
5555
return this.isParallel
56-
? this._tests.sort((t1, t2) => naturalCompare(t1.name, t2.name))
56+
? this._tests.slice().sort((t1, t2) => naturalCompare(t1.name, t2.name))
5757
: this._tests
5858
}
5959

0 commit comments

Comments
 (0)