Skip to content

Commit 6b32859

Browse files
CopilotdmitrivMS
andcommitted
Improve test robustness by using FindInput internal API
Co-authored-by: dmitrivMS <[email protected]>
1 parent 2d64a86 commit 6b32859

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/vs/base/test/browser/ui/findinput/findInput.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,22 +101,22 @@ suite('FindInput Toggle Focus', () => {
101101
document.body.appendChild(container);
102102
store.add({ dispose: () => container.remove() });
103103

104-
store.add(new FindInput(container, undefined, {
104+
const findInput = store.add(new FindInput(container, undefined, {
105105
label: 'test',
106106
inputBoxStyles: unthemedInboxStyles,
107107
toggleStyles: unthemedToggleStyles,
108108
showCommonFindToggles: true
109109
// No additionalToggles provided
110110
}));
111111

112-
// Get the common toggles
113-
const caseSensitive = container.querySelector('[role="checkbox"][aria-label*="Match Case"]') as HTMLElement;
114-
const wholeWords = container.querySelector('[role="checkbox"][aria-label*="Match Whole Word"]') as HTMLElement;
115-
const regex = container.querySelector('[role="checkbox"][aria-label*="Use Regular Expression"]') as HTMLElement;
112+
// Get the common toggles from the findInput instance
113+
const caseSensitive = (findInput as any).caseSensitive;
114+
const wholeWords = (findInput as any).wholeWords;
115+
const regex = (findInput as any).regex;
116116

117117
// Verify that only the first toggle is tabbable
118-
assert.strictEqual(caseSensitive?.tabIndex, 0, 'Case sensitive toggle should have tabIndex 0');
119-
assert.strictEqual(wholeWords?.tabIndex, -1, 'Whole words toggle should have tabIndex -1');
120-
assert.strictEqual(regex?.tabIndex, -1, 'Regex toggle should have tabIndex -1');
118+
assert.strictEqual(caseSensitive.domNode.tabIndex, 0, 'Case sensitive toggle should have tabIndex 0');
119+
assert.strictEqual(wholeWords.domNode.tabIndex, -1, 'Whole words toggle should have tabIndex -1');
120+
assert.strictEqual(regex.domNode.tabIndex, -1, 'Regex toggle should have tabIndex -1');
121121
});
122122
});

0 commit comments

Comments
 (0)