Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit38d82a7

Browse files
invalid transition with extended state
fix#71
1 parentdbebfba commit38d82a7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎src/withStateMachine.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ const withStateMachine = (statechart, options = {}) => Component => {
115115
}
116116

117117
handleComponentDidUpdate(prevProps,prevState){
118-
if(prevState.machineState!==this.state.machineState){
119-
this.isTransitioning=false
118+
this.isTransitioning=false
120119

120+
if(prevState.machineState!==this.state.machineState){
121121
this.runActions()
122122

123123
if(idx(this,_=>_.instance.current.componentDidTransition)){

‎test/withStateMachine.spec.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ test('render', () => {
5252
expect(spy).toHaveBeenCalled()
5353
})
5454

55+
test('invalid transition with extended state',()=>{
56+
constComponent=()=><div/>
57+
constStateMachine=withStateMachine(statechart)(Component)
58+
constinstance=TestRenderer.create(<StateMachine/>).getInstance()
59+
60+
instance.handleTransition('FOO',{foo:'bar'})
61+
62+
expect(()=>{
63+
instance.handleTransition('FOO')
64+
}).not.toThrow()
65+
})
66+
5567
test('props',()=>{
5668
constComponent=()=><div/>
5769
constStateMachine=withStateMachine(statechart)(Component)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp