Skip to content

Commit 1613edf

Browse files
committed
test: HACK: Ignore .pf-v6-screen-reader sub-elements for ph_text()
Don't consider `.pf-v6-screen-reader` sub-elements of ph_text() elements. Current PF6 version forces some extra screen-reader only junk: patternfly/patternfly-react#11678 We will fix this properly (via PF), but it breaks a number of tests.
1 parent 1d852ff commit 1613edf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/common/test-functions.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,15 @@ window.ph_text = function(sel) {
110110
const el = window.ph_find(sel);
111111
if (el.textContent === undefined)
112112
throw new Error(sel + " can not have text");
113+
114+
// HACK: https://github.com/patternfly/patternfly-react/issues/11678
115+
const el_copy = el.cloneNode(true);
116+
// find and clear .pf-v6-screen-reader subelements
117+
el_copy.querySelectorAll('.pf-v6-screen-reader').forEach(el => { el.textContent = '' });
118+
113119
// 0xa0 is a non-breakable space, which is a rendering detail of Chromium
114120
// and awkward to handle in tests; turn it into normal spaces
115-
return el.textContent.replaceAll("\xa0", " ");
121+
return el_copy.textContent.replaceAll("\xa0", " ");
116122
};
117123

118124
window.ph_attr = function(sel, attr) {

0 commit comments

Comments
 (0)