@@ -1938,244 +1938,5 @@ define(function (require, exports, module) {
19381938 testWindow . $ ( "#pinURLButton" ) . click ( ) ;
19391939 await endPreviewSession ( ) ;
19401940 } , 30000 ) ;
1941-
1942- describe ( "Edit Mode Tests" , function ( ) {
1943-
1944- async function waitsForLiveDevelopmentToOpenWithEditMode ( elemHighlights = 'hover' ) {
1945- // Enable edit mode before opening live preview
1946- if ( LiveDevMultiBrowser && LiveDevMultiBrowser . config ) {
1947- LiveDevMultiBrowser . config . elemHighlights = elemHighlights ;
1948- // Update the remote browser configuration
1949- if ( LiveDevMultiBrowser . updateConfig ) {
1950- LiveDevMultiBrowser . updateConfig ( JSON . stringify ( LiveDevMultiBrowser . config ) ) ;
1951- }
1952- }
1953- LiveDevMultiBrowser . open ( ) ;
1954- await waitsForLiveDevelopmentFileSwitch ( ) ;
1955- }
1956-
1957- async function endEditModePreviewSession ( ) {
1958- await _setLivePreviewMode ( CONSTANTS . LIVE_HIGHLIGHT_MODE ) ;
1959- LiveDevMultiBrowser . close ( ) ;
1960- // Disable edit mode after session
1961- if ( LiveDevMultiBrowser && LiveDevMultiBrowser . config ) {
1962- LiveDevMultiBrowser . config . elemHighlights = 'hover' ;
1963- }
1964- await awaitsForDone ( CommandManager . execute ( Commands . FILE_CLOSE_ALL , { _forceClose : true } ) ,
1965- "closing all file" ) ;
1966- }
1967-
1968- async function waitForInfoBox ( shouldBeVisible = true , timeout = 5000 ) {
1969- await forRemoteExec ( `
1970- const shadowHosts = Array.from(document.body.children).filter(el => el.shadowRoot);
1971- let hasInfoBox = false;
1972- shadowHosts.forEach(host => {
1973- if (host.shadowRoot && host.shadowRoot.innerHTML.includes('phoenix-node-info-box')) {
1974- hasInfoBox = true;
1975- }
1976- });
1977- hasInfoBox;
1978- ` , ( result ) => {
1979- return result === shouldBeVisible ;
1980- } ) ;
1981- }
1982-
1983- async function waitForMoreOptionsBox ( shouldBeVisible = true , timeout = 5000 ) {
1984- await forRemoteExec ( `
1985- const shadowHosts = Array.from(document.body.children).filter(el => el.shadowRoot);
1986- let hasMoreOptionsBox = false;
1987- shadowHosts.forEach(host => {
1988- if (host.shadowRoot && host.shadowRoot.innerHTML.includes('phoenix-more-options-box')) {
1989- hasMoreOptionsBox = true;
1990- }
1991- });
1992- hasMoreOptionsBox;
1993- ` , ( result ) => {
1994- return result === shouldBeVisible ;
1995- } ) ;
1996- }
1997-
1998- async function waitForClickedElement ( shouldBeVisible = true , timeout = 5000 ) {
1999- await forRemoteExec ( `
2000- const highlightedElements = document.getElementsByClassName("__brackets-ld-highlight");
2001- Array.from(highlightedElements).some(el =>
2002- el.style.backgroundColor && el.style.backgroundColor.includes('rgba(0, 162, 255')
2003- );
2004- ` , ( result ) => {
2005- return result === shouldBeVisible ;
2006- } ) ;
2007- }
2008-
2009- async function waitForNoEditBoxes ( ) {
2010- // Wait for no shadow DOM boxes and no clicked element highlighting
2011- await forRemoteExec ( `
2012- const shadowHosts = Array.from(document.body.children).filter(el => el.shadowRoot);
2013- shadowHosts.length;
2014- ` , ( result ) => {
2015- return result === 0 ;
2016- } ) ;
2017-
2018- await waitForClickedElement ( false ) ;
2019- }
2020-
2021- it ( "should show info box on hover when elemHighlights is 'hover'" , async function ( ) {
2022- await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple1.html" ] ) ,
2023- "SpecRunnerUtils.openProjectFiles simple1.html" ) ;
2024-
2025- await waitsForLiveDevelopmentToOpenWithEditMode ( 'hover' ) ;
2026-
2027- // Initially no boxes should be visible
2028- await waitForNoEditBoxes ( ) ;
2029-
2030- // Hover over testId element
2031- await forRemoteExec ( `
2032- const event = new MouseEvent('mouseover', { bubbles: true, cancelable: true });
2033- document.getElementById('testId').dispatchEvent(event);
2034- ` ) ;
2035-
2036- // Info box should appear on hover
2037- await waitForInfoBox ( true ) ;
2038- await waitForMoreOptionsBox ( false ) ;
2039-
2040- // Mouse out should hide the info box
2041- await forRemoteExec ( `
2042- const event = new MouseEvent('mouseout', { bubbles: true, cancelable: true });
2043- document.getElementById('testId').dispatchEvent(event);
2044- ` ) ;
2045-
2046- await waitForInfoBox ( false ) ;
2047- await waitForNoEditBoxes ( ) ;
2048-
2049- await endEditModePreviewSession ( ) ;
2050- } , 30000 ) ;
2051-
2052- it ( "should show more options box on click when elemHighlights is 'hover'" , async function ( ) {
2053- await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple1.html" ] ) ,
2054- "SpecRunnerUtils.openProjectFiles simple1.html" ) ;
2055-
2056- await waitsForLiveDevelopmentToOpenWithEditMode ( 'hover' ) ;
2057-
2058- // Click on testId element
2059- await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2060-
2061- // More options box should appear on click
2062- await waitForMoreOptionsBox ( true ) ;
2063- await waitForClickedElement ( true ) ;
2064-
2065- // Clicking on a different element should move the box
2066- await forRemoteExec ( `document.getElementById('testId2').click()` ) ;
2067-
2068- await waitForMoreOptionsBox ( true ) ;
2069- await waitForClickedElement ( true ) ;
2070-
2071- await endEditModePreviewSession ( ) ;
2072- } , 30000 ) ;
2073-
2074- it ( "should show more options box on click when elemHighlights is 'click'" , async function ( ) {
2075- await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple1.html" ] ) ,
2076- "SpecRunnerUtils.openProjectFiles simple1.html" ) ;
2077-
2078- await waitsForLiveDevelopmentToOpenWithEditMode ( 'click' ) ;
2079-
2080- // Initially no boxes should be visible
2081- await waitForNoEditBoxes ( ) ;
2082-
2083- // In click mode, hover should not show info box
2084- await forRemoteExec ( `
2085- const event = new MouseEvent('mouseover', { bubbles: true, cancelable: true });
2086- document.getElementById('testId').dispatchEvent(event);
2087- ` ) ;
2088-
2089- // Should still be no boxes visible
2090- await waitForInfoBox ( false ) ;
2091- await waitForMoreOptionsBox ( false ) ;
2092-
2093- // Click should show more options box
2094- await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2095-
2096- await waitForMoreOptionsBox ( true ) ;
2097- await waitForClickedElement ( true ) ;
2098-
2099- await endEditModePreviewSession ( ) ;
2100- } , 30000 ) ;
2101-
2102- it ( "should handle multiple element interactions in hover mode" , async function ( ) {
2103- await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple2.html" ] ) ,
2104- "SpecRunnerUtils.openProjectFiles simple2.html" ) ;
2105-
2106- await waitsForLiveDevelopmentToOpenWithEditMode ( 'hover' ) ;
2107-
2108- // Test hovering over multiple elements
2109- const elementIds = [ 'simpId' , 'simpId2' , 'simpId3' ] ;
2110-
2111- for ( let elementId of elementIds ) {
2112- // Hover over element
2113- await forRemoteExec ( `
2114- const event = new MouseEvent('mouseover', { bubbles: true, cancelable: true });
2115- document.getElementById('${ elementId } ').dispatchEvent(event);
2116- ` ) ;
2117-
2118- // Info box should appear
2119- await waitForInfoBox ( true ) ;
2120-
2121- // Mouse out
2122- await forRemoteExec ( `
2123- const event = new MouseEvent('mouseout', { bubbles: true, cancelable: true });
2124- document.getElementById('${ elementId } ').dispatchEvent(event);
2125- ` ) ;
2126-
2127- // Box should disappear
2128- await waitForInfoBox ( false ) ;
2129- }
2130-
2131- await endEditModePreviewSession ( ) ;
2132- } , 30000 ) ;
2133-
2134- it ( "should handle multiple element clicks and box movement" , async function ( ) {
2135- await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple2.html" ] ) ,
2136- "SpecRunnerUtils.openProjectFiles simple2.html" ) ;
2137-
2138- await waitsForLiveDevelopmentToOpenWithEditMode ( 'hover' ) ;
2139-
2140- const elementIds = [ 'simpId' , 'simpId2' , 'simpId3' ] ;
2141-
2142- // Click on first element
2143- await forRemoteExec ( `document.getElementById('${ elementIds [ 0 ] } ').click()` ) ;
2144-
2145- await waitForMoreOptionsBox ( true ) ;
2146- await waitForClickedElement ( true ) ;
2147-
2148- // Click on subsequent elements - box should move
2149- for ( let i = 1 ; i < elementIds . length ; i ++ ) {
2150- await forRemoteExec ( `document.getElementById('${ elementIds [ i ] } ').click()` ) ;
2151-
2152- await waitForMoreOptionsBox ( true ) ;
2153- await waitForClickedElement ( true ) ;
2154- }
2155-
2156- await endEditModePreviewSession ( ) ;
2157- } , 30000 ) ;
2158-
2159- it ( "should dismiss boxes when clicking outside elements" , async function ( ) {
2160- await awaitsForDone ( SpecRunnerUtils . openProjectFiles ( [ "simple1.html" ] ) ,
2161- "SpecRunnerUtils.openProjectFiles simple1.html" ) ;
2162-
2163- await waitsForLiveDevelopmentToOpenWithEditMode ( 'hover' ) ;
2164-
2165- // Click on element to show more options box
2166- await forRemoteExec ( `document.getElementById('testId').click()` ) ;
2167-
2168- await waitForMoreOptionsBox ( true ) ;
2169-
2170- // Click on body (outside any specific element)
2171- await forRemoteExec ( `document.body.click()` ) ;
2172-
2173- // Boxes should be dismissed
2174- await waitForMoreOptionsBox ( false ) ;
2175- await waitForClickedElement ( false ) ;
2176-
2177- await endEditModePreviewSession ( ) ;
2178- } , 30000 ) ;
2179- } ) ;
21801941 } ) ;
21811942} ) ;
0 commit comments