2
2
var _types_1 = require ( './_types' ) ;
3
3
var hint_1 = require ( './hint' ) ;
4
4
var progress_1 = require ( './progress' ) ;
5
+ var alert_1 = require ( './alert' ) ;
5
6
function testRun ( ) {
6
7
return function ( dispatch , getState ) {
7
8
var _a = getState ( ) , taskTests = _a . taskTests , dir = _a . dir , tutorial = _a . tutorial , taskPosition = _a . taskPosition ;
@@ -15,13 +16,26 @@ function testResult(result) {
15
16
return function ( dispatch , getState ) {
16
17
var _a = getState ( ) , taskActions = _a . taskActions , progress = _a . progress , pagePosition = _a . pagePosition ;
17
18
var filter = getTestFilter ( result ) ;
19
+ var alert = {
20
+ message : result . msg ,
21
+ action : 'note' ,
22
+ } ;
18
23
if ( filter === 'PASS' || filter === 'FAIL' ) {
19
24
dispatch ( hint_1 . hintPositionSet ( 0 ) ) ;
25
+ alert = Object . assign ( { } , alert , {
26
+ action : filter ,
27
+ duration : 1200 ,
28
+ } ) ;
20
29
}
21
- if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
30
+ else if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
22
31
dispatch ( progress_1 . completePage ( false ) ) ;
32
+ alert = Object . assign ( { } , alert , {
33
+ action : filter ,
34
+ duration : 2200 ,
35
+ } ) ;
23
36
}
24
- dispatch ( { type : _types_1 . TEST_RESULT , payload : { result : result , taskActions : taskActions } , filter : filter } ) ;
37
+ dispatch ( { type : _types_1 . TEST_RESULT , payload : { result : result , taskActions : taskActions } } ) ;
38
+ dispatch ( alert_1 . alertToggle ( alert ) ) ;
25
39
} ;
26
40
}
27
41
exports . testResult = testResult ;
0 commit comments