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) => {
9797 never render anything. It always just return null. */ }
9898 { loadClientsideRedirectExceptions && < ClientSideRedirectExceptions /> }
9999 { 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+ >
101104 < h1 className = "mb-3" > { title } </ h1 >
102105 { intro && (
103106 < 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'
22import slugger from 'github-slugger'
33
44import { getDOM } from '../helpers/e2etest.js'
@@ -63,6 +63,20 @@ describe('REST references docs', () => {
6363 const errorMessage = formatErrors ( differences )
6464 expect ( Object . keys ( differences ) . length , errorMessage ) . toBe ( 0 )
6565 } )
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+ } )
6680} )
6781
6882function formatErrors ( differences ) {
You can’t perform that action at this time.
0 commit comments