@@ -86,9 +86,15 @@ define(function (require, exports, module) {
8686 return QuickView . _queryPreviewProviders ( editor , pos , token ) ;
8787 }
8888
89- async function expectNoPreviewAtPos ( line , ch ) {
89+ async function expectNoColorOrImagePreviewAtPos ( line , ch ) {
9090 var popoverInfo = await getPopoverAtPos ( line , ch ) ;
91- expect ( popoverInfo ) . toBeFalsy ( ) ;
91+ if ( popoverInfo ) {
92+ let quickViews = popoverInfo . content . find ( ".quick-view-item" ) . length ;
93+ if ( popoverInfo . content . find ( ".code-inspection-item" ) . length ) {
94+ quickViews -= popoverInfo . content . find ( ".code-inspection-item" ) . length ;
95+ }
96+ expect ( quickViews ) . toBe ( 0 ) ;
97+ }
9298 }
9399
94100 async function checkColorAtPos ( expectedColor , line , ch ) {
@@ -128,8 +134,8 @@ define(function (require, exports, module) {
128134 } ) ;
129135
130136 it ( "should NOT show preview of color on words start with #" , async function ( ) {
131- await expectNoPreviewAtPos ( 7 , 7 ) ; // cursor on #invalid_hex
132- await expectNoPreviewAtPos ( 8 , 15 ) ; // cursor on #web
137+ await expectNoColorOrImagePreviewAtPos ( 7 , 7 ) ; // cursor on #invalid_hex
138+ await expectNoColorOrImagePreviewAtPos ( 8 , 15 ) ; // cursor on #web
133139 } ) ;
134140
135141 it ( "should show preview of valid rgb/rgba colors" , async function ( ) {
@@ -149,9 +155,9 @@ define(function (require, exports, module) {
149155 } ) ;
150156
151157 it ( "should NOT show preview of unsupported rgb/rgba colors" , async function ( ) {
152- await expectNoPreviewAtPos ( 25 , 14 ) ; // cursor on rgb(300, 0, 0)
153- await expectNoPreviewAtPos ( 26 , 15 ) ; // cursor on rgb(0, 95.5, 0)
154- await expectNoPreviewAtPos ( 27 , 15 ) ; // cursor on rgba(-0, 0, 0, 0.5)
158+ await expectNoColorOrImagePreviewAtPos ( 25 , 14 ) ; // cursor on rgb(300, 0, 0)
159+ await expectNoColorOrImagePreviewAtPos ( 26 , 15 ) ; // cursor on rgb(0, 95.5, 0)
160+ await expectNoColorOrImagePreviewAtPos ( 27 , 15 ) ; // cursor on rgba(-0, 0, 0, 0.5)
155161 } ) ;
156162
157163 it ( "should show preview of valid hsl/hsla colors" , async function ( ) {
@@ -162,9 +168,9 @@ define(function (require, exports, module) {
162168 } ) ;
163169
164170 it ( "should NOT show preview of unsupported hsl/hsla colors" , async function ( ) {
165- await expectNoPreviewAtPos ( 38 , 14 ) ; // cursor on hsla(90, 100%, 50%, 2)
166- await expectNoPreviewAtPos ( 39 , 14 ) ; // cursor on hsla(0, 200%, 50%, 0.5)
167- await expectNoPreviewAtPos ( 40 , 14 ) ; // cursor on hsla(0.0, 100%, 50%, .5)
171+ await expectNoColorOrImagePreviewAtPos ( 38 , 14 ) ; // cursor on hsla(90, 100%, 50%, 2)
172+ await expectNoColorOrImagePreviewAtPos ( 39 , 14 ) ; // cursor on hsla(0, 200%, 50%, 0.5)
173+ await expectNoColorOrImagePreviewAtPos ( 40 , 14 ) ; // cursor on hsla(0.0, 100%, 50%, .5)
168174 } ) ;
169175
170176 it ( "should show preview of colors with valid names" , async function ( ) {
@@ -179,10 +185,10 @@ define(function (require, exports, module) {
179185 } ) ;
180186
181187 it ( "should NOT show preview of colors with invalid names" , async function ( ) {
182- await expectNoPreviewAtPos ( 72 , 15 ) ; // cursor on redsox
183- await expectNoPreviewAtPos ( 73 , 16 ) ; // cursor on pinky
184- await expectNoPreviewAtPos ( 74 , 16 ) ; // cursor on blue in hyphenated word blue-cheese
185- await expectNoPreviewAtPos ( 75 , 18 ) ; // cursor on white in hyphenated word @bc -bg-highlight
188+ await expectNoColorOrImagePreviewAtPos ( 72 , 15 ) ; // cursor on redsox
189+ await expectNoColorOrImagePreviewAtPos ( 73 , 16 ) ; // cursor on pinky
190+ await expectNoColorOrImagePreviewAtPos ( 74 , 16 ) ; // cursor on blue in hyphenated word blue-cheese
191+ await expectNoColorOrImagePreviewAtPos ( 75 , 18 ) ; // cursor on white in hyphenated word @bc -bg-highlight
186192 } ) ;
187193
188194 it ( "should open quick edit if clicked on colorview" , async function ( ) {
@@ -198,16 +204,16 @@ define(function (require, exports, module) {
198204 testFile = "test.js" ;
199205
200206 it ( "should NOT show preview of color-named functions and object/array keys" , async function ( ) {
201- await expectNoPreviewAtPos ( 2 , 12 ) ; // cursor on green()
202- await expectNoPreviewAtPos ( 4 , 22 ) ; // cursor on Math.tan
203- await expectNoPreviewAtPos ( 5 , 14 ) ; // cursor on tan()
204- await expectNoPreviewAtPos ( 5 , 38 ) ; // cursor on array[red]
207+ await expectNoColorOrImagePreviewAtPos ( 2 , 12 ) ; // cursor on green()
208+ await expectNoColorOrImagePreviewAtPos ( 4 , 22 ) ; // cursor on Math.tan
209+ await expectNoColorOrImagePreviewAtPos ( 5 , 14 ) ; // cursor on tan()
210+ await expectNoColorOrImagePreviewAtPos ( 5 , 38 ) ; // cursor on array[red]
205211 } ) ;
206212 it ( "should not show preview of literal color names" , async function ( ) {
207- await expectNoPreviewAtPos ( 2 , 36 ) ; // green
208- await expectNoPreviewAtPos ( 3 , 21 ) ; // green
209- await expectNoPreviewAtPos ( 5 , 25 ) ; // red
210- await expectNoPreviewAtPos ( 7 , 1 ) ; // darkgray
213+ await expectNoColorOrImagePreviewAtPos ( 2 , 36 ) ; // green
214+ await expectNoColorOrImagePreviewAtPos ( 3 , 21 ) ; // green
215+ await expectNoColorOrImagePreviewAtPos ( 5 , 25 ) ; // red
216+ await expectNoColorOrImagePreviewAtPos ( 7 , 1 ) ; // darkgray
211217 } ) ;
212218 } ) ;
213219 } ) ;
@@ -313,8 +319,8 @@ define(function (require, exports, module) {
313319
314320 it ( "Should not go into infinite loop on unbalanced parens" , async function ( ) {
315321 // no preview, and no infinite loop
316- await expectNoPreviewAtPos ( 189 , 30 ) ;
317- await expectNoPreviewAtPos ( 190 , 40 ) ;
322+ await expectNoColorOrImagePreviewAtPos ( 189 , 30 ) ;
323+ await expectNoColorOrImagePreviewAtPos ( 190 , 40 ) ;
318324 } ) ;
319325 } ) ;
320326
@@ -417,19 +423,19 @@ define(function (require, exports, module) {
417423 } ) ;
418424
419425 it ( "Should ignore URLs for common non-image extensions" , async function ( ) {
420- await expectNoPreviewAtPos ( 209 , 20 ) ; // .html
421- await expectNoPreviewAtPos ( 210 , 20 ) ; // .css
422- await expectNoPreviewAtPos ( 211 , 20 ) ; // .js
423- await expectNoPreviewAtPos ( 212 , 20 ) ; // .json
424- await expectNoPreviewAtPos ( 213 , 20 ) ; // .md
425- await expectNoPreviewAtPos ( 214 , 20 ) ; // .xml
426- await expectNoPreviewAtPos ( 215 , 20 ) ; // .mp3
427- await expectNoPreviewAtPos ( 216 , 20 ) ; // .ogv
428- await expectNoPreviewAtPos ( 217 , 20 ) ; // .mp4
429- await expectNoPreviewAtPos ( 218 , 20 ) ; // .mpeg
430- await expectNoPreviewAtPos ( 219 , 20 ) ; // .webm
431- await expectNoPreviewAtPos ( 220 , 20 ) ; // .zip
432- await expectNoPreviewAtPos ( 221 , 20 ) ; // .tgz
426+ await expectNoColorOrImagePreviewAtPos ( 209 , 20 ) ; // .html
427+ await expectNoColorOrImagePreviewAtPos ( 210 , 20 ) ; // .css
428+ await expectNoColorOrImagePreviewAtPos ( 211 , 20 ) ; // .js
429+ await expectNoColorOrImagePreviewAtPos ( 212 , 20 ) ; // .json
430+ await expectNoColorOrImagePreviewAtPos ( 213 , 20 ) ; // .md
431+ await expectNoColorOrImagePreviewAtPos ( 214 , 20 ) ; // .xml
432+ await expectNoColorOrImagePreviewAtPos ( 215 , 20 ) ; // .mp3
433+ await expectNoColorOrImagePreviewAtPos ( 216 , 20 ) ; // .ogv
434+ await expectNoColorOrImagePreviewAtPos ( 217 , 20 ) ; // .mp4
435+ await expectNoColorOrImagePreviewAtPos ( 218 , 20 ) ; // .mpeg
436+ await expectNoColorOrImagePreviewAtPos ( 219 , 20 ) ; // .webm
437+ await expectNoColorOrImagePreviewAtPos ( 220 , 20 ) ; // .zip
438+ await expectNoColorOrImagePreviewAtPos ( 221 , 20 ) ; // .tgz
433439 } ) ;
434440
435441 it ( "Should show image preview for a data URI inside url()" , async function ( ) {
0 commit comments