@@ -95,6 +95,11 @@ define(function (require, exports, module) {
9595 }
9696 }
9797
98+ function validateSingleColor ( editor , lineNumber , color ) {
99+ let gutterMarker = editor . getGutterMarker ( lineNumber , GUTTER_NAME ) ;
100+ __PR . validateEqual ( areColorsEqual ( $ ( gutterMarker ) , color ) , true ) ;
101+ }
102+
98103 function validateNoColors ( editor , lineNumber ) {
99104 const gutterMarker = editor . getGutterMarker ( lineNumber , GUTTER_NAME ) ;
100105 if ( gutterMarker ) {
@@ -146,10 +151,8 @@ define(function (require, exports, module) {
146151
147152 it ( `should color gutter show correct colors in box ${ fileName } ` , async function ( ) {
148153 const editor = await init ( ) ;
149- let gutterMarker = editor . getGutterMarker ( 8 , GUTTER_NAME ) ;
150- __PR . validateEqual ( areColorsEqual ( $ ( gutterMarker ) , "blue" ) , true ) ;
151- gutterMarker = editor . getGutterMarker ( 11 , GUTTER_NAME ) ;
152- __PR . validateEqual ( areColorsEqual ( $ ( gutterMarker ) , "#00ff8c" ) , true ) ;
154+ validateSingleColor ( editor , 8 , "blue" ) ;
155+ validateSingleColor ( editor , 11 , "#00ff8c" ) ;
153156
154157 // multiple colors
155158 validateMultipleColors ( editor , 12 , [ "#00ff8c" , "red" ] ) ;
@@ -246,7 +249,36 @@ define(function (require, exports, module) {
246249 await __PR . closeFile ( ) ;
247250 } ) ;
248251
249- // todo test code changes, code changes at end of file
252+ it ( `should update colors on typing ${ fileName } ` , async function ( ) {
253+ const editor = await init ( ) ;
254+ validateSingleColor ( editor , 8 , "blue" ) ;
255+
256+ if ( baseFileName === "base.css" ) {
257+ __PR . setCursors ( [ "9:16" ] ) ;
258+ } else {
259+ __PR . setCursors ( [ "9:23" ] ) ;
260+ }
261+ __PR . typeAtCursor ( " red" ) ;
262+ validateMultipleColors ( editor , 8 , [ "blue" , "red" ] ) ;
263+ await __PR . undo ( ) ;
264+ validateSingleColor ( editor , 8 , "blue" ) ;
265+ __PR . typeAtCursor ( "x" ) ;
266+ validateNoColors ( editor , 8 ) ;
267+ await __PR . closeFile ( ) ;
268+ } ) ;
269+
270+ it ( `should deleting at end of file and appending should bring back color ${ fileName } ` , async function ( ) {
271+ const editor = await init ( ) ;
272+
273+ __PR . setCursors ( [ "12:1-19:1" ] ) ;
274+ __PR . keydown ( [ "BACK_SPACE" ] ) ; // this will delete the colors at end of file
275+ __PR . validateEqual ( editor . lineCount ( ) , 12 ) ;
276+ await __PR . undo ( ) ;
277+ _verifyExpectedColors ( editor , [ 8 , 11 , 12 , 13 , 14 , 15 ] ) ;
278+ await __PR . closeFile ( ) ;
279+ } ) ;
280+
281+ // todo test preference change, multi pane tests
250282 }
251283
252284 const htmlFiles = [ "a.html" , "a.htm" , "a.xhtml" , "a.php" , "a.jsp" , "a.jsx" , "a.tsx" ] ;
0 commit comments