File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,10 @@ export const RestReferencePage = ({ restOperations }: StructuredContentT) => {
97
97
never render anything. It always just return null. */ }
98
98
{ loadClientsideRedirectExceptions && < ClientSideRedirectExceptions /> }
99
99
{ lazyLoadHighlightJS && < ClientSideHighlightJS /> }
100
- < div className = { cx ( styles . restOperation , 'px-3 px-md-6 my-4 container-xl' ) } >
100
+ < div
101
+ className = { cx ( styles . restOperation , 'px-3 px-md-6 my-4 container-xl' ) }
102
+ data-search = "article-body"
103
+ >
101
104
< h1 className = "mb-3" > { title } </ h1 >
102
105
{ intro && (
103
106
< Lead data-testid = "lead" data-search = "lead" className = "markdown-body" >
Original file line number Diff line number Diff line change 1
- import { jest } from '@jest/globals'
1
+ import { jest , test } from '@jest/globals'
2
2
import slugger from 'github-slugger'
3
3
4
4
import { getDOM } from '../helpers/e2etest.js'
@@ -63,6 +63,20 @@ describe('REST references docs', () => {
63
63
const errorMessage = formatErrors ( differences )
64
64
expect ( Object . keys ( differences ) . length , errorMessage ) . toBe ( 0 )
65
65
} )
66
+
67
+ test ( 'REST reference pages have DOM markers needed for extracting search content' , async ( ) => {
68
+ // Pick an arbitrary REST reference page that is build from React
69
+ const $ = await getDOM ( '/en/rest/actions/artifacts' )
70
+ const rootSelector = '[data-search=article-body]'
71
+ const $root = $ ( rootSelector )
72
+ expect ( $root . length ) . toBe ( 1 )
73
+ // Within that, should expect a "lead" text.
74
+ // Note! Not all REST references pages have a lead. The one in this
75
+ // test does.
76
+ const leadSelector = '[data-search=lead] p'
77
+ const $lead = $root . find ( leadSelector )
78
+ expect ( $lead . length ) . toBe ( 1 )
79
+ } )
66
80
} )
67
81
68
82
function formatErrors ( differences ) {
You can’t perform that action at this time.
0 commit comments