@@ -34,6 +34,8 @@ fixture.nodes = fixture.nodes.slice(0, 2)
3434fixture . edges = fixture . edges . slice ( 0 , 1 )
3535
3636const edgeId = fixture . edges [ 0 ] . id
37+ const midpointHandleSelector =
38+ ".edge-waypoint-handle--proposed + .edge-waypoint-hit-target"
3739
3840async function persistedPoints ( page : Page ) : Promise < unknown [ ] | null > {
3941 return page . evaluate ( ( id ) => {
@@ -94,13 +96,34 @@ test.beforeEach(async ({ page }) => {
9496 await selectEdgeOnPath ( page , edgeId )
9597} )
9698
99+ test ( "legacy straight-edge route caches do not become visible bends" , async ( {
100+ page,
101+ } ) => {
102+ const legacyFixture = structuredClone ( fixture )
103+ legacyFixture . version = "4.1.0"
104+ legacyFixture . edges [ 0 ] . data . points = [
105+ { x : 40 , y : 40 } ,
106+ { x : 180 , y : 220 } ,
107+ ]
108+
109+ await openFixtureInLocalEditor ( page , legacyFixture )
110+ await waitForCanvasReady ( page )
111+ await selectEdgeOnPath ( page , edgeId )
112+
113+ await expect . poll ( ( ) => persistedPoints ( page ) ) . toEqual ( [ ] )
114+ await expect . poll ( ( ) => pathExcessLength ( page ) ) . toBeLessThan ( 1 )
115+ await expect (
116+ page
117+ . locator ( `.react-flow__edge[data-id="${ edgeId } "]` )
118+ . getByRole ( "button" , { name : / ^ W a y p o i n t : / } )
119+ ) . toHaveCount ( 0 )
120+ } )
121+
97122test ( "straight and step bend handles share one opaque visual state" , async ( {
98123 page,
99124} ) => {
100125 const edge = page . locator ( `.react-flow__edge[data-id="${ edgeId } "]` )
101- const createTarget = edge
102- . getByRole ( "button" , { name : "Drag to add a waypoint" } )
103- . first ( )
126+ const createTarget = edge . locator ( midpointHandleSelector ) . first ( )
104127 const createCircle = edge . locator ( ".edge-waypoint-handle--proposed" ) . first ( )
105128
106129 // Selection clicks the route midpoint, so the newly-mounted midpoint handle
@@ -117,12 +140,6 @@ test("straight and step bend handles share one opaque visual state", async ({
117140 await page . mouse . move ( 280 , 680 )
118141 await expect ( createCircle ) . toHaveCSS ( "fill" , straightFill )
119142
120- // Keyboard users retain a clear darkened-circle focus state, but the browser
121- // must not draw a square/ring around the invisible hit rectangle.
122- await createTarget . focus ( )
123- await expect ( createTarget ) . toHaveCSS ( "outline-style" , "none" )
124- await expect ( createCircle ) . not . toHaveCSS ( "fill" , straightFill )
125-
126143 await openFixtureInLocalEditor ( page , structuredClone ( stepFixture ) )
127144 await waitForCanvasReady ( page )
128145 const stepEdgeId = "edge-bidirectional-dog-imovable"
@@ -139,9 +156,7 @@ test("straight waypoints feel editable and collapse live back to a line", async
139156 page,
140157} ) => {
141158 const edge = page . locator ( `.react-flow__edge[data-id="${ edgeId } "]` )
142- const createHandle = edge . getByRole ( "button" , {
143- name : "Drag to add a waypoint" ,
144- } )
159+ const createHandle = edge . locator ( midpointHandleSelector )
145160 await expect ( createHandle . first ( ) ) . toBeVisible ( )
146161 await dragBy ( page , createHandle . first ( ) , 70 , 70 )
147162
@@ -186,15 +201,13 @@ test("a focused waypoint can be removed with the keyboard", async ({
186201 page,
187202} ) => {
188203 const edge = page . locator ( `.react-flow__edge[data-id="${ edgeId } "]` )
189- await dragBy (
190- page ,
191- edge . getByRole ( "button" , { name : "Drag to add a waypoint" } ) . first ( ) ,
192- 70 ,
193- 70
194- )
204+ await dragBy ( page , edge . locator ( midpointHandleSelector ) . first ( ) , 70 , 70 )
195205
196206 const waypoint = edge . getByRole ( "button" , { name : / ^ W a y p o i n t : / } )
197207 await waypoint . focus ( )
208+ // Authored points are keyboard actions. Their circle provides the focus
209+ // feedback; the invisible SVG hit rectangle must never acquire a square ring.
210+ await expect ( waypoint ) . toHaveCSS ( "outline-style" , "none" )
198211 await page . keyboard . press ( "Delete" )
199212
200213 await expect ( waypoint ) . toHaveCount ( 0 )
@@ -209,12 +222,7 @@ test("the edge toolbar never traps a waypoint underneath it", async ({
209222 await selectEdgeOnPath ( page , edgeId )
210223
211224 const edge = page . locator ( `.react-flow__edge[data-id="${ edgeId } "]` )
212- await dragBy (
213- page ,
214- edge . getByRole ( "button" , { name : "Drag to add a waypoint" } ) . first ( ) ,
215- - 70 ,
216- - 70
217- )
225+ await dragBy ( page , edge . locator ( midpointHandleSelector ) . first ( ) , - 70 , - 70 )
218226
219227 const waypoint = edge . getByRole ( "button" , { name : / ^ W a y p o i n t : / } )
220228 await expect ( waypoint ) . toHaveCount ( 1 )
0 commit comments