This repository was archived by the owner on Apr 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +28
-29
lines changed Expand file tree Collapse file tree 5 files changed +28
-29
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ function testResult(result) {
1818 var filter = getTestFilter ( result ) ;
1919 var alert = {
2020 message : result . msg ,
21- action : 'note ' ,
21+ action : 'NOTE ' ,
2222 } ;
2323 if ( filter === 'PASS' || filter === 'FAIL' ) {
2424 dispatch ( hint_1 . hintPositionSet ( 0 ) ) ;
@@ -27,7 +27,7 @@ function testResult(result) {
2727 duration : 1200 ,
2828 } ) ;
2929 }
30- else if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
30+ if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
3131 dispatch ( progress_1 . completePage ( false ) ) ;
3232 alert = Object . assign ( { } , alert , {
3333 action : filter ,
@@ -43,7 +43,7 @@ function getTestFilter(result) {
4343 switch ( true ) {
4444 case result . pass && result . change > 0 :
4545 return 'PASS' ;
46- case result . pass === false && result . change < 1 :
46+ case result . pass === false && result . change <= 0 :
4747 return 'FAIL' ;
4848 default :
4949 return 'NOTE' ;
Original file line number Diff line number Diff line change @@ -17,13 +17,11 @@ var colors = {
1717 NOTE : '#9DA5B4' ,
1818} ;
1919var 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 ) ;
2725}
2826function alertReducer ( alert , action ) {
2927 if ( alert === void 0 ) { alert = _alert ; }
@@ -35,7 +33,7 @@ function alertReducer(alert, action) {
3533 if ( ! a ) {
3634 return _alert ;
3735 }
38- return setAlert ( a , colors [ a . action ] || colors . NOTE ) ;
36+ return setAlert ( a ) ;
3937 default :
4038 return alert ;
4139 }
Original file line number Diff line number Diff line change @@ -20,15 +20,18 @@ export function testResult(result: Test.Result): ReduxThunk.ThunkInterface {
2020 const filter : string = getTestFilter ( result ) ;
2121 let alert : CR . Alert = {
2222 message : result . msg ,
23- action : 'note ' ,
23+ action : 'NOTE ' ,
2424 } ;
25+ // passes or fails
2526 if ( filter === 'PASS' || filter === 'FAIL' ) {
2627 dispatch ( hintPositionSet ( 0 ) ) ;
2728 alert = Object . assign ( { } , alert , {
2829 action : filter ,
2930 duration : 1200 ,
3031 } ) ;
31- } else if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
32+ }
33+ // previously passed, but now fails
34+ if ( filter === 'FAIL' && progress . pages [ pagePosition ] ) {
3235 dispatch ( completePage ( false ) ) ;
3336 alert = Object . assign ( { } , alert , {
3437 action : filter ,
@@ -44,7 +47,7 @@ function getTestFilter(result: Test.Result): string {
4447 switch ( true ) {
4548 case result . pass && result . change > 0 :
4649 return 'PASS' ;
47- case result . pass === false && result . change < 1 :
50+ case result . pass === false && result . change <= 0 :
4851 return 'FAIL' ;
4952 default :
5053 return 'NOTE' ;
Original file line number Diff line number Diff line change 11@import " ui-variables" ;
2- .cr-alert.pass button span {
2+ .cr-alert.PASS button span {
33 color : @background-color-success ;
44}
5- .cr-alert.fail button span {
5+ .cr-alert.FAIL button span {
66 color : @background-color-error ;
77}
8- .cr-alert.note button span {
8+ .cr-alert.NOTE button span {
99 color : @background-color-info ;
1010}
1111.cr-alert-replay {
Original file line number Diff line number Diff line change @@ -17,20 +17,19 @@ const open = {
1717} ;
1818
1919const colors = {
20- PASS : '#73C990' ,
21- FAIL : '#FF4081' ,
22- NOTE : '#9DA5B4' ,
20+ PASS : '#73C990' , // green
21+ FAIL : '#FF4081' , // red
22+ NOTE : '#9DA5B4' , // blue
2323} ;
2424
2525let current : CR . Alert = _alert ;
2626
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 ) ;
3433}
3534
3635export default function alertReducer (
@@ -48,8 +47,7 @@ export default function alertReducer(
4847 // close alert
4948 return _alert ;
5049 }
51-
52- return setAlert ( a , colors [ a . action ] || colors . NOTE ) ;
50+ return setAlert ( a ) ;
5351
5452 default :
5553 return alert ;
You can’t perform that action at this time.
0 commit comments