@@ -95,8 +95,17 @@ define(function (require, exports, module) {
9595 }
9696 }
9797
98+ function validateNoColors ( editor , lineNumber ) {
99+ const gutterMarker = editor . getGutterMarker ( lineNumber , GUTTER_NAME ) ;
100+ if ( gutterMarker ) {
101+ __PR . validateEqual ( gutterMarker . classList . contains ( DUMMY_GUTTER_CLASS ) , true ) ;
102+ return ;
103+ }
104+ __PR . validateEqual ( ! ! gutterMarker , false ) ;
105+ }
106+
98107 function testFile ( baseFileName , fileName ) {
99- it ( `should color gutter appear as expected ${ fileName } ` , async function ( ) {
108+ async function init ( ) {
100109 const htmlText = await __PR . readTextFile ( baseFileName ) ;
101110 await __PR . writeTextFile ( fileName , htmlText , true ) ;
102111 await __PR . openFile ( fileName ) ;
@@ -105,6 +114,11 @@ define(function (require, exports, module) {
105114
106115 // the line with cursor if there is no color should have a dummy color gutter
107116 __PR . setCursors ( [ "1:1" ] ) ;
117+ return editor ;
118+ }
119+
120+ it ( `should color gutter appear as expected ${ fileName } ` , async function ( ) {
121+ const editor = await init ( ) ;
108122 let gutterMarker = editor . getGutterMarker ( 0 , GUTTER_NAME ) ;
109123 __PR . validateEqual ( gutterMarker . classList . contains ( DUMMY_GUTTER_CLASS ) , true ) ;
110124
@@ -131,14 +145,7 @@ define(function (require, exports, module) {
131145 } ) ;
132146
133147 it ( `should color gutter show correct colors in box ${ fileName } ` , async function ( ) {
134- const htmlText = await __PR . readTextFile ( baseFileName ) ;
135- await __PR . writeTextFile ( fileName , htmlText , true ) ;
136- await __PR . openFile ( fileName ) ;
137- const editor = EditorManager . getActiveEditor ( ) ;
138- __PR . validateEqual ( editor . isGutterActive ( GUTTER_NAME ) , true ) ;
139-
140- // the line with cursor if there is no color should have a dummy color gutter
141- __PR . setCursors ( [ "1:1" ] ) ;
148+ const editor = await init ( ) ;
142149 let gutterMarker = editor . getGutterMarker ( 8 , GUTTER_NAME ) ;
143150 __PR . validateEqual ( areColorsEqual ( $ ( gutterMarker ) , "blue" ) , true ) ;
144151 gutterMarker = editor . getGutterMarker ( 11 , GUTTER_NAME ) ;
@@ -152,7 +159,27 @@ define(function (require, exports, module) {
152159 await __PR . closeFile ( ) ;
153160 } ) ;
154161
155- // todo test beautify, block comment, line comment, comment at end of file, code changes, toggle color edit
162+ it ( `should block commenting remove color previews in ${ fileName } ` , async function ( ) {
163+ if ( fileName === "a.sass" ) {
164+ // block commenting in sass is not supported for the test file, so omitting that test
165+ return ;
166+ }
167+ const editor = await init ( ) ;
168+ __PR . setCursors ( [ "12:1-16:85" ] ) ;
169+ await __PR . execCommand ( __PR . Commands . EDIT_BLOCK_COMMENT ) ;
170+ let gutterMarker = editor . getGutterMarker ( 8 , GUTTER_NAME ) ;
171+ __PR . validateEqual ( areColorsEqual ( $ ( gutterMarker ) , "blue" ) , true ) ;
172+
173+ // multiple colors
174+ validateNoColors ( editor , 11 ) ;
175+ validateNoColors ( editor , 12 ) ;
176+ validateNoColors ( editor , 13 ) ;
177+ validateNoColors ( editor , 14 ) ;
178+ validateNoColors ( editor , 15 ) ;
179+ await __PR . closeFile ( ) ;
180+ } ) ;
181+
182+ // todo test beautify, code changes, code changes at end of file, toggle color edit
156183 }
157184
158185 const htmlFiles = [ "a.html" , "a.htm" , "a.xhtml" , "a.php" , "a.jsp" , "a.jsx" , "a.tsx" ] ;
0 commit comments