Skip to content

Commit 4363ed3

Browse files
Copilotchiaramooney
andcommitted
Address review feedback: remove legacy tests, fix focus/blur API usage, clean up isFocused tests
Co-authored-by: chiaramooney <[email protected]>
1 parent e06b6db commit 4363ed3

File tree

2 files changed

+4
-49
lines changed

2 files changed

+4
-49
lines changed

packages/e2e-test-app-fabric/test/LegacyTextInputTest.test.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -98,38 +98,6 @@ describe('LegacyTextInputTest', () => {
9898
]);
9999
*/
100100
});
101-
102-
// Additional functional tests for event handlers
103-
test('TextInput should trigger action upon onBlur', async () => {
104-
const textInput = await textInputField();
105-
await textInput.click(); // Focus
106-
107-
const multiLineTextInput = await multiLineTextInputField();
108-
await multiLineTextInput.click(); // This should trigger onBlur on the first TextInput
109-
110-
await assertLogContains('onBlur');
111-
});
112-
113-
test('TextInput should trigger action upon onFocus', async () => {
114-
const textInput = await textInputField();
115-
await textInput.click(); // This should trigger onFocus
116-
117-
await assertLogContains('onFocus');
118-
});
119-
120-
test('TextInput should trigger action upon onChange', async () => {
121-
const textInput = await textInputField();
122-
await textInput.setValue('test');
123-
124-
await assertLogContains('onChange text: test');
125-
});
126-
127-
test('TextInput should trigger action upon onSelectionChange', async () => {
128-
const textInput = await textInputField();
129-
await textInput.setValue('test');
130-
131-
await assertLogContains('onSelectionChange range: 4,4');
132-
});
133101
});
134102

135103
async function textInputField() {

packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,6 @@ describe('TextInput Tests', () => {
954954
expect(dump).toMatchSnapshot();
955955
});
956956

957-
// Additional functional tests for specific task requirements
958957
test('TextInput should not be editable when editable set to false', async () => {
959958
const component = await app.findElementByTestID('textinput-not-editable2');
960959
await component.waitForDisplayed({timeout: 5000});
@@ -1160,8 +1159,8 @@ describe('TextInput Tests', () => {
11601159
let dump = await dumpVisualTree('uncontrolled-textinput');
11611160
expect(dump).toMatchSnapshot();
11621161

1163-
// Simulate focus by clicking
1164-
await component.click();
1162+
// Call focus() method directly
1163+
await (component as any).focus();
11651164

11661165
// After focus, the style should change (component has onFocus handler)
11671166
dump = await dumpVisualTree('uncontrolled-textinput');
@@ -1176,16 +1175,12 @@ describe('TextInput Tests', () => {
11761175
// Focus first
11771176
await component.click();
11781177

1179-
// Then blur by clicking somewhere else
1180-
const search = await app.findElementByTestID('example_search');
1181-
await search.click();
1178+
// Call blur() method directly
1179+
await (component as any).blur();
11821180

11831181
// After blur, the style should revert (component has onBlur handler)
11841182
const dump = await dumpVisualTree('uncontrolled-textinput');
11851183
expect(dump).toMatchSnapshot();
1186-
1187-
// Reset search
1188-
await search.setValue('');
11891184
});
11901185

11911186
test('TextInput isFocused() should return true when the TextInput is focused', async () => {
@@ -1196,10 +1191,6 @@ describe('TextInput Tests', () => {
11961191
// Focus the component
11971192
await component.click();
11981193

1199-
// Check if the component shows focused state (style change indicates focus)
1200-
const dump = await dumpVisualTree('uncontrolled-textinput');
1201-
expect(dump).toMatchSnapshot();
1202-
12031194
// The component should be in focused state (we can't directly test isFocused()
12041195
// but we can verify the visual state that indicates focus)
12051196
expect(await component.isFocused()).toBe(true);
@@ -1214,10 +1205,6 @@ describe('TextInput Tests', () => {
12141205
const search = await app.findElementByTestID('example_search');
12151206
await search.click();
12161207

1217-
// Check if the component shows unfocused state
1218-
const dump = await dumpVisualTree('uncontrolled-textinput');
1219-
expect(dump).toMatchSnapshot();
1220-
12211208
// The component should not be in focused state
12221209
expect(await component.isFocused()).toBe(false);
12231210

0 commit comments

Comments
 (0)