@@ -1853,4 +1853,34 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
1853
1853
await openTooltipPromise2 ;
1854
1854
assert . notStrictEqual ( tooltip , tooltip2 ) ;
1855
1855
} ) ;
1856
+
1857
+ it ( 'shows a property docs tooltip' , async ( ) => {
1858
+ const webCustomDataStub = sinon . createStubInstance ( Elements . WebCustomData . WebCustomData ) ;
1859
+ webCustomDataStub . findCssProperty . returns ( { name : 'color' , description : 'test color' } ) ;
1860
+ sinon . stub ( stylesSidebarPane , 'webCustomData' ) . get ( ( ) => webCustomDataStub ) ;
1861
+ Common . Settings . Settings . instance ( ) . moduleSetting ( 'show-css-property-documentation-on-hover' ) . set ( false ) ;
1862
+ const treeElementWithoutTooltip = getTreeElement ( 'color' , 'blue' ) ;
1863
+ treeElementWithoutTooltip . treeOutline = new LegacyUI . TreeOutline . TreeOutline ( ) ;
1864
+ treeElementWithoutTooltip . updateTitle ( ) ;
1865
+ assert . notExists ( treeElementWithoutTooltip . listItemElement . querySelector (
1866
+ 'devtools-tooltip[jslogcontext="elements.css-property-doc"]' ) ) ;
1867
+
1868
+ Common . Settings . Settings . instance ( ) . moduleSetting ( 'show-css-property-documentation-on-hover' ) . set ( true ) ;
1869
+ const treeElementWithTooltip = getTreeElement ( 'color' , 'blue' ) ;
1870
+ treeElementWithTooltip . treeOutline = new LegacyUI . TreeOutline . TreeOutline ( ) ;
1871
+ treeElementWithTooltip . updateTitle ( ) ;
1872
+ renderElementIntoDOM ( treeElementWithTooltip . listItemElement ) ;
1873
+ const tooltip = treeElementWithTooltip . listItemElement . querySelector (
1874
+ 'devtools-tooltip[jslogcontext="elements.css-property-doc"]' ) ;
1875
+ assert . instanceOf ( tooltip , Tooltips . Tooltip . Tooltip ) ;
1876
+
1877
+ tooltip . showPopover ( ) ;
1878
+ assert . isTrue ( tooltip . open ) ;
1879
+ tooltip . hidePopover ( ) ;
1880
+ assert . isFalse ( tooltip . open ) ;
1881
+
1882
+ Common . Settings . Settings . instance ( ) . moduleSetting ( 'show-css-property-documentation-on-hover' ) . set ( false ) ;
1883
+ tooltip . showPopover ( ) ;
1884
+ assert . isFalse ( tooltip . open ) ;
1885
+ } ) ;
1856
1886
} ) ;
0 commit comments