-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Symfony version(s) affected
6.4.3
Description
When using Turbo-Stream, we can want to test it directly:
- GET on the path that give us a Turbo-Stram response
- Check attributes: action, method
- If it's a form, test to submit it
But in tests, methods like submitForm('Save')
, selectButton('Save')->form()
, should give us the ability to deal with, but the method exclude all fields inside <template>
.
In the file src/Symfony/Component/DomCrawler/Form.php
(line 421), it exclude all in <template>
, by the way, it appear impossible to use the Form
methods for testing easily forms inside streams.
How to reproduce
- Create a form inside a Turbo-Stream
- Call the path that return us that
Possible Solution
- Remove the part:
[not(ancestor::template)]
- Replace it by
[( not(ancestor::template) or ancestor::turbo-stream )]
- Replace it to respect the order, in test we want to avoid catch of
<template>
inside a<form>
, no<form>
inside a<template>
:[not(ancestor::template/ancestor::form)]
Additional Context
No response