Skip to content

Commit 7e8d6f8

Browse files
mmcotedarkwing
authored andcommitted
Re-added changes from firefox-devtools#5409, and added waitFor changes to test suggested by nchevobbe. (firefox-devtools#5508)
1 parent 305dc23 commit 7e8d6f8

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/components/Editor/ConditionalPanel.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export class ConditionalPanel extends PureComponent<Props> {
9696
return this.clearConditionalPanel();
9797
}
9898

99+
componentDidUpdate(prevProps: Props) {
100+
this.keepFocusOnInput();
101+
}
102+
99103
componentWillUnmount() {
100104
// This is called if CodeMirror is re-initializing itself before the
101105
// user closes the conditional panel. Clear the widget, and re-render it
@@ -140,8 +144,6 @@ export class ConditionalPanel extends PureComponent<Props> {
140144
this.scrollParent.addEventListener("scroll", this.repositionOnScroll);
141145
this.repositionOnScroll();
142146
}
143-
144-
this.input.focus();
145147
}
146148
}
147149

src/test/mochitest/browser_dbg-breakpoints-cond.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,23 @@ function assertEditorBreakpoint(dbg, line, shouldExist) {
2424
);
2525
}
2626

27+
async function assertConditionalBreakpointIsFocused(dbg) {
28+
const conditionalBreakpointInput = findElementWithSelector(
29+
dbg,
30+
".conditional-breakpoint-panel input"
31+
);
32+
33+
const breakpointFocused = await waitFor(() => dbg.win.document.activeElement == conditionalBreakpointInput &&
34+
dbg.win.document.hasFocus());
35+
36+
ok(breakpointFocused, "Conditional Breakpoint Input is focused.");
37+
}
38+
2739
async function setConditionalBreakpoint(dbg, index, condition) {
2840
rightClickElement(dbg, "gutter", index);
2941
selectMenuItem(dbg, 2);
3042
await waitForElementWithSelector(dbg, ".conditional-breakpoint-panel input");
31-
findElementWithSelector(dbg, ".conditional-breakpoint-panel input").focus();
43+
await assertConditionalBreakpointIsFocused(dbg);
3244
// Position cursor reliably at the end of the text.
3345
pressKey(dbg, "End");
3446
type(dbg, condition);

0 commit comments

Comments
 (0)