@@ -10,7 +10,7 @@ import * as Protocol from '../../generated/protocol.js';
1010import * as Bindings from '../../models/bindings/bindings.js' ;
1111import * as Workspace from '../../models/workspace/workspace.js' ;
1212import { renderElementIntoDOM } from '../../testing/DOMHelpers.js' ;
13- import { createTarget , updateHostConfig } from '../../testing/EnvironmentHelpers.js' ;
13+ import { createTarget } from '../../testing/EnvironmentHelpers.js' ;
1414import { spyCall } from '../../testing/ExpectStubCall.js' ;
1515import { describeWithMockConnection , setMockConnectionResponseHandler } from '../../testing/MockConnection.js' ;
1616import {
@@ -112,9 +112,11 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
112112
113113 function getTreeElement ( name : string , value : string , longhandProperties : Protocol . CSS . CSSProperty [ ] = [ ] ) {
114114 const property = addProperty ( name , value , longhandProperties ) ;
115+ const section = new Elements . StylePropertiesSection . StylePropertiesSection (
116+ stylesSidebarPane , matchedStyles , property . ownerStyle , 0 , null , null ) ;
115117 return new Elements . StylePropertyTreeElement . StylePropertyTreeElement ( {
116118 stylesPane : stylesSidebarPane ,
117- section : sinon . createStubInstance ( Elements . StylePropertiesSection . StylePropertiesSection ) ,
119+ section,
118120 matchedStyles,
119121 property,
120122 isShorthand : longhandProperties . length > 0 ,
@@ -252,8 +254,8 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
252254 assert . exists ( colorMixSwatch ) ;
253255 renderElementIntoDOM ( stylePropertyTreeElement . valueElement as HTMLElement ) ;
254256
255- const tooltip : Tooltips . Tooltip . Tooltip | null | undefined =
256- stylePropertyTreeElement . valueElement ?. querySelector ( 'devtools-tooltip' ) ;
257+ const tooltip : Tooltips . Tooltip . Tooltip | null | undefined = stylePropertyTreeElement . valueElement ?. querySelector (
258+ 'devtools-tooltip:not([jslogcontext="elements.css-value-trace"]) ' ) ;
257259 assert . exists ( tooltip ) ;
258260 tooltip . showPopover ( ) ;
259261 assert . strictEqual ( tooltip . textContent , '#ff8000' ) ;
@@ -267,7 +269,9 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
267269 assert . exists ( colorMixSwatch ) ;
268270 renderElementIntoDOM ( stylePropertyTreeElement . valueElement as HTMLElement ) ;
269271
270- const tooltip = stylePropertyTreeElement . valueElement ?. querySelector ( 'devtools-tooltip' ) ;
272+ const tooltip = stylePropertyTreeElement . valueElement ?. querySelector (
273+ 'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])' ) as HTMLElement |
274+ null | undefined ;
271275 tooltip ?. showPopover ( ) ;
272276 assert . strictEqual ( tooltip ?. textContent , 'color(srgb 1 0.24 0.17)' ) ;
273277 } ) ;
@@ -330,7 +334,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
330334 } ) ;
331335
332336 it ( 'shows a value tracing tooltip on the var function' , async ( ) => {
333- updateHostConfig ( { devToolsCssValueTracing : { enabled : true } } ) ;
334337 const stylePropertyTreeElement = getTreeElement ( 'color' , 'color-mix(in srgb, yellow, green)' ) ;
335338 stylePropertyTreeElement . updateTitle ( ) ;
336339 assert . exists ( stylePropertyTreeElement . valueElement ) ;
@@ -803,7 +806,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
803806 } ) ;
804807
805808 it ( 'shows a value tracing tooltip on the var function' , async ( ) => {
806- updateHostConfig ( { devToolsCssValueTracing : { enabled : true } } ) ;
807809 const stylePropertyTreeElement = getTreeElement ( 'color' , 'var(--blue)' ) ;
808810 stylePropertyTreeElement . updateTitle ( ) ;
809811 assert . exists ( stylePropertyTreeElement . valueElement ) ;
@@ -904,7 +906,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
904906 } ) ;
905907
906908 it ( 'shows a value tracing tooltip on color functions' , async ( ) => {
907- updateHostConfig ( { devToolsCssValueTracing : { enabled : true } } ) ;
908909 for ( const property of [ 'rgb(255 0 0)' , 'color(srgb 0.5 0.5 0.5)' , 'oklch(from purple calc(l * 2) c h)' ] ) {
909910 const stylePropertyTreeElement = getTreeElement ( 'color' , property ) ;
910911 stylePropertyTreeElement . updateTitle ( ) ;
@@ -924,14 +925,14 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
924925 const stylePropertyTreeElement = getTreeElement ( 'color' , 'rgb(from #ff0c0c calc(r / 2) g b)' ) ;
925926 stylePropertyTreeElement . updateTitle ( ) ;
926927
927- const tooltips = stylePropertyTreeElement . valueElement ?. querySelectorAll ( 'devtools-tooltip' ) ;
928+ const tooltips = stylePropertyTreeElement . valueElement ?. querySelectorAll (
929+ 'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])' ) ;
928930 assert . exists ( tooltips ) ;
929931 assert . lengthOf ( tooltips , 3 ) ;
930932 assert . deepEqual ( Array . from ( tooltips ) . map ( tooltip => tooltip . textContent ) , [ '1.000' , '0.047' , '0.047' ] ) ;
931933 } ) ;
932934
933935 it ( 'evaluates relative color channels during tracing' , async ( ) => {
934- updateHostConfig ( { devToolsCssValueTracing : { enabled : true } } ) ;
935936 setMockConnectionResponseHandler (
936937 'CSS.resolveValues' ,
937938 ( request : Protocol . CSS . ResolveValuesRequest ) =>
@@ -1927,7 +1928,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
19271928 } ) ;
19281929
19291930 it ( 'uses the right longhand name in length shorthands inside of substitutions during tracing' , async ( ) => {
1930- updateHostConfig ( { devToolsCssValueTracing : { enabled : true } } ) ;
19311931 const cssModel = stylesSidebarPane . cssModel ( ) ;
19321932 assert . exists ( cssModel ) ;
19331933 const resolveValuesStub = sinon . stub ( cssModel , 'resolveValues' ) . callsFake ( ( name , nodeId , ...values ) => {
@@ -1971,15 +1971,14 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
19711971
19721972 sinon . assert . calledOnce ( strikeOutSpy ) ;
19731973 await strikeOutSpy . returnValues [ 0 ] ;
1974- const args = stylePropertyTreeElement . valueElement ?. querySelectorAll ( ':scope > span > span' ) as
1975- NodeListOf < HTMLSpanElement > ;
1974+ const args = stylePropertyTreeElement . valueElement ?. querySelectorAll (
1975+ ':scope > span > span:not(.tracing-anchor)' ) as NodeListOf < HTMLSpanElement > ;
19761976 assert . lengthOf ( args , 3 ) ;
19771977 assert . deepEqual (
19781978 Array . from ( args . values ( ) ) . map ( arg => arg . classList . contains ( 'inactive-value' ) ) , [ true , false , true ] ) ;
19791979 } ) ;
19801980
19811981 it ( 'shows a value tracing tooltip on the calc function' , async ( ) => {
1982- updateHostConfig ( { devToolsCssValueTracing : { enabled : true } } ) ;
19831982 for ( const property of [ 'calc(1px + 2px)' , 'min(1px, 2px)' , 'max(3px, 1px)' ] ) {
19841983 const stylePropertyTreeElement = getTreeElement ( 'width' , property ) ;
19851984 stylePropertyTreeElement . updateTitle ( ) ;
@@ -1994,7 +1993,6 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
19941993 } ) ;
19951994
19961995 it ( 'shows the original text during tracing when evaluation fails' , async ( ) => {
1997- updateHostConfig ( { devToolsCssValueTracing : { enabled : true } } ) ;
19981996 setMockConnectionResponseHandler (
19991997 'CSS.resolveValues' ,
20001998 ( request : Protocol . CSS . ResolveValuesRequest ) => ( { results : request . values . map ( ( ) => '' ) } ) ) ;
@@ -2134,7 +2132,9 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
21342132 const openTooltipPromise1 = new Promise < void > ( r => openTooltipStub . callsFake ( r ) ) ;
21352133 const stylePropertyTreeElement = getTreeElement ( 'color' , 'color-mix(in srgb, red, blue)' ) ;
21362134 stylePropertyTreeElement . updateTitle ( ) ;
2137- const tooltip = stylePropertyTreeElement . valueElement ?. querySelector ( 'devtools-tooltip' ) ;
2135+ const tooltip = stylePropertyTreeElement . valueElement ?. querySelector (
2136+ 'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])' ) as Tooltips . Tooltip . Tooltip |
2137+ null | undefined ;
21382138 assert . exists ( tooltip ) ;
21392139 renderElementIntoDOM ( tooltip ) ;
21402140 tooltip . showTooltip ( ) ;
@@ -2143,7 +2143,10 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
21432143
21442144 const openTooltipPromise2 = new Promise < void > ( r => openTooltipStub . callsFake ( r ) ) ;
21452145 stylePropertyTreeElement . updateTitle ( ) ;
2146- const tooltip2 = stylePropertyTreeElement . valueElement ?. querySelector ( 'devtools-tooltip' ) ;
2146+ const tooltip2 =
2147+ stylePropertyTreeElement . valueElement ?. querySelector (
2148+ 'devtools-tooltip:not([jslogcontext="elements.css-value-trace"])' ) as Tooltips . Tooltip . Tooltip |
2149+ null | undefined ;
21472150 assert . exists ( tooltip2 ) ;
21482151 renderElementIntoDOM ( tooltip2 ) ;
21492152 await openTooltipPromise2 ;
0 commit comments