File tree 5 files changed +28
-29
lines changed
5 files changed +28
-29
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ function testResult(result) {
18
18
var filter = getTestFilter ( result ) ;
19
19
var alert = {
20
20
message : result . msg ,
21
- action : 'note ' ,
21
+ action : 'NOTE ' ,
22
22
} ;
23
23
if ( filter === 'PASS' || filter === 'FAIL' ) {
24
24
dispatch ( hint_1 . hintPositionSet ( 0 ) ) ;
@@ -27,7 +27,7 @@ function testResult(result) {
27
27
duration : 1200 ,
28
28
} ) ;
29
29
}
30
- else if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
30
+ if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
31
31
dispatch ( progress_1 . completePage ( false ) ) ;
32
32
alert = Object . assign ( { } , alert , {
33
33
action : filter ,
@@ -43,7 +43,7 @@ function getTestFilter(result) {
43
43
switch ( true ) {
44
44
case result . pass && result . change > 0 :
45
45
return 'PASS' ;
46
- case result . pass === false && result . change < 1 :
46
+ case result . pass === false && result . change <= 0 :
47
47
return 'FAIL' ;
48
48
default :
49
49
return 'NOTE' ;
Original file line number Diff line number Diff line change @@ -17,13 +17,11 @@ var colors = {
17
17
NOTE : '#9DA5B4' ,
18
18
} ;
19
19
var current = _alert ;
20
- function setAlert ( options , color ) {
21
- if ( color ) {
22
- var statusBarAlert = document . getElementsByClassName ( 'cr-alert-replay' ) [ 0 ] ;
23
- statusBarAlert . style . color = color ;
24
- }
25
- current = Object . assign ( { } , open , options ) ;
26
- return current ;
20
+ function setAlert ( a ) {
21
+ var color = colors [ a . action ] || colors . NOTE ;
22
+ var statusBarAlert = document . getElementsByClassName ( 'cr-alert-replay' ) [ 0 ] ;
23
+ statusBarAlert . style . color = color ;
24
+ return Object . assign ( { } , open , a ) ;
27
25
}
28
26
function alertReducer ( alert , action ) {
29
27
if ( alert === void 0 ) { alert = _alert ; }
@@ -35,7 +33,7 @@ function alertReducer(alert, action) {
35
33
if ( ! a ) {
36
34
return _alert ;
37
35
}
38
- return setAlert ( a , colors [ a . action ] || colors . NOTE ) ;
36
+ return setAlert ( a ) ;
39
37
default :
40
38
return alert ;
41
39
}
Original file line number Diff line number Diff line change @@ -20,15 +20,18 @@ export function testResult(result: Test.Result): ReduxThunk.ThunkInterface {
20
20
const filter : string = getTestFilter ( result ) ;
21
21
let alert : CR . Alert = {
22
22
message : result . msg ,
23
- action : 'note ' ,
23
+ action : 'NOTE ' ,
24
24
} ;
25
+ // passes or fails
25
26
if ( filter === 'PASS' || filter === 'FAIL' ) {
26
27
dispatch ( hintPositionSet ( 0 ) ) ;
27
28
alert = Object . assign ( { } , alert , {
28
29
action : filter ,
29
30
duration : 1200 ,
30
31
} ) ;
31
- } else if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
32
+ }
33
+ // previously passed, but now fails
34
+ if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
32
35
dispatch ( completePage ( false ) ) ;
33
36
alert = Object . assign ( { } , alert , {
34
37
action : filter ,
@@ -44,7 +47,7 @@ function getTestFilter(result: Test.Result): string {
44
47
switch ( true ) {
45
48
case result . pass && result . change > 0 :
46
49
return 'PASS' ;
47
- case result . pass === false && result . change < 1 :
50
+ case result . pass === false && result . change <= 0 :
48
51
return 'FAIL' ;
49
52
default :
50
53
return 'NOTE' ;
Original file line number Diff line number Diff line change 1
1
@import " ui-variables" ;
2
- .cr-alert.pass button span {
2
+ .cr-alert.PASS button span {
3
3
color : @background-color-success ;
4
4
}
5
- .cr-alert.fail button span {
5
+ .cr-alert.FAIL button span {
6
6
color : @background-color-error ;
7
7
}
8
- .cr-alert.note button span {
8
+ .cr-alert.NOTE button span {
9
9
color : @background-color-info ;
10
10
}
11
11
.cr-alert-replay {
Original file line number Diff line number Diff line change @@ -17,20 +17,19 @@ const open = {
17
17
} ;
18
18
19
19
const colors = {
20
- PASS : '#73C990' ,
21
- FAIL : '#FF4081' ,
22
- NOTE : '#9DA5B4' ,
20
+ PASS : '#73C990' , // green
21
+ FAIL : '#FF4081' , // red
22
+ NOTE : '#9DA5B4' , // blue
23
23
} ;
24
24
25
25
let current : CR . Alert = _alert ;
26
26
27
- function setAlert ( options : Object , color ?: string ) {
28
- if ( color ) {
29
- let statusBarAlert = < HTMLElement > document . getElementsByClassName ( 'cr-alert-replay' ) [ 0 ] ;
30
- statusBarAlert . style . color = color ;
31
- }
32
- current = Object . assign ( { } , open , options ) ;
33
- return current ;
27
+ function setAlert ( a : CR . Alert ) : CR . Alert {
28
+
29
+ const color = colors [ a . action ] || colors . NOTE ;
30
+ let statusBarAlert = < HTMLElement > document . getElementsByClassName ( 'cr-alert-replay' ) [ 0 ] ;
31
+ statusBarAlert . style . color = color ;
32
+ return Object . assign ( { } , open , a ) ;
34
33
}
35
34
36
35
export default function alertReducer (
@@ -48,8 +47,7 @@ export default function alertReducer(
48
47
// close alert
49
48
return _alert ;
50
49
}
51
-
52
- return setAlert ( a , colors [ a . action ] || colors . NOTE ) ;
50
+ return setAlert ( a ) ;
53
51
54
52
default :
55
53
return alert ;
You can’t perform that action at this time.
0 commit comments