Skip to content

Commit fea8cb6

Browse files
authored
[test] Move test selectors as close to the actual value as possible (vercel#78931)
React will start outlining boundaries if they add too many bytes to the next completion. This doesn't have any perceivable effect but some of our tests use Cheerio to parse the flushed HTML without any JS applied so the expected values might end up in a template that's not within the element you're targetting with CSS selectors. The real fix is using `next.browser` instead but that's slower so we just make sure React can't separate targetted elements and the expected values.
1 parent 0abe697 commit fea8cb6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/e2e/app-dir/dynamic-io/app/headers/exercise/components.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function Get({
104104
return (
105105
<section>
106106
<h2>{expression}.get('...')</h2>
107-
<div id={'get-x-sentinel'}>
108-
<pre>{headers.get('x-sentinel')}</pre>
107+
<div>
108+
<pre id={'get-x-sentinel'}>{headers.get('x-sentinel')}</pre>
109109
</div>
110110
</section>
111111
)
@@ -194,8 +194,8 @@ function ForEach({
194194
headers.forEach((value, header) => {
195195
if (header.startsWith('x-sentinel')) {
196196
output.push(
197-
<div key={header} id={'for-each-' + header}>
198-
<pre>{value}</pre>
197+
<div key={header}>
198+
<pre id={'for-each-' + header}>{value}</pre>
199199
</div>
200200
)
201201
}
@@ -300,8 +300,8 @@ function ForOf({
300300
for (let [headerName, value] of headers) {
301301
if (headerName.startsWith('x-sentinel')) {
302302
output.push(
303-
<div key={headerName} id={'for-of-' + headerName}>
304-
<pre>{value}</pre>
303+
<div key={headerName}>
304+
<pre id={'for-of-' + headerName}>{value}</pre>
305305
</div>
306306
)
307307
}
@@ -326,8 +326,8 @@ function Spread({
326326
.filter(([headerName]) => headerName.startsWith('x-sentinel'))
327327
.map((v) => {
328328
return (
329-
<div key={v[0]} id={'spread-' + v[0]}>
330-
<pre>{v[1]}</pre>
329+
<div key={v[0]}>
330+
<pre id={'spread-' + v[0]}>{v[1]}</pre>
331331
</div>
332332
)
333333
})

0 commit comments

Comments
 (0)