This repository was archived by the owner on Dec 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed
app/components/window-top Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -464,5 +464,10 @@ describe('bterm launch', function() {
464464 } ) ;
465465 }
466466
467- } )
467+ it ( 'should inject a style element into head' , ( ) => {
468+ return this . app . client . waitUntilWindowLoaded ( )
469+ . then ( ( ) => this . app . client . elements ( 'head style' ) )
470+ . then ( result => expect ( result . value . length ) . to . equal ( 1 ) ) ;
471+ } ) ;
468472
473+ } ) ;
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ export class WindowTopComponent implements OnInit {
145145 return ( [ mm . screenX - startX , mm . screenY - startY ] ) ;
146146 }
147147 )
148- . filter ( x => x [ 0 ] != 0 || x [ 1 ] != 0 )
148+ . filter ( x => x [ 0 ] !== 0 || x [ 1 ] != = 0 )
149149 . takeUntil ( mouseUp$ )
150150 }
151151 )
Original file line number Diff line number Diff line change @@ -87,14 +87,16 @@ export class CssBuilder {
8787 return this . css ;
8888 }
8989
90- inject ( ) : void {
90+ inject ( seamless : boolean = true ) : void {
9191 this . build ( ) ;
92- if ( this . styleEl ) { this . styleEl . remove ( ) ; }
92+ if ( ! seamless && this . styleEl ) { this . styleEl . remove ( ) ; }
9393
94- this . styleEl = document . createElement ( 'style' ) as HTMLStyleElement ;
95- this . styleEl . setAttribute ( 'type' , 'text/css' ) ;
96- this . styleEl . innerHTML = this . css ;
94+ let newStyle : HTMLStyleElement = document . createElement ( 'style' ) as HTMLStyleElement ;
95+ newStyle . setAttribute ( 'type' , 'text/css' ) ;
96+ newStyle . innerHTML = this . css ;
9797
98- setTimeout ( ( ) => document . querySelector ( 'head' ) . appendChild ( this . styleEl ) ) ;
98+ document . querySelector ( 'head' ) . appendChild ( newStyle ) ;
99+ if ( this . styleEl ) { this . styleEl . remove ( ) ; }
100+ this . styleEl = newStyle ;
99101 }
100102}
You can’t perform that action at this time.
0 commit comments