Commit 93f8b75c authored by chujun's avatar chujun
Browse files

Bug 1548390 Double click logpoint in secondary pane opens logpoint panel r=davidwalsh

Add an `if` statement to handle logpoint when double click.
Add Mochitest for both conditional breakpoint and logpoint

Differential Revision: https://phabricator.services.mozilla.com/D30291

--HG--
extra : moz-landing-system : lando
parent c97597a8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ class Breakpoint extends PureComponent<Props> {
    const { breakpoint, openConditionalPanel } = this.props;
    if (breakpoint.options.condition) {
      openConditionalPanel(this.selectedLocation);
    } else if (breakpoint.options.logValue) {
      openConditionalPanel(this.selectedLocation, true);
    }
  };

+26 −0
Original line number Diff line number Diff line
@@ -123,6 +123,19 @@ add_task(async function() {
  is(bp.options.condition, "1", "breakpoint is created with the condition");
  await assertEditorBreakpoint(dbg, 5, { hasCondition: true });

  info("Double click the conditional breakpoint in secondary pane");
  dblClickElement(dbg, "conditionalBreakpointInSecPane");
  is(
    dbg.win.document.activeElement.tagName,
    "TEXTAREA",
    "The textarea of conditional breakpoint panel is focused"
  );
  
  info("Click the conditional breakpoint in secondary pane");
  await clickElement(dbg, "conditionalBreakpointInSecPane");
  let conditonalPanel = findElement(dbg, "conditionalPanel");
  is(conditonalPanel, null, "The conditional breakpoint panel is closed");

  rightClickElement(dbg, "breakpointItem", 2);
  info('select "remove condition"');
  selectContextMenuItem(dbg, selectors.breakpointContextMenu.removeCondition);
@@ -141,4 +154,17 @@ add_task(async function() {
  await altClickElement(dbg, "gutter", 6);
  bp = await waitForBreakpoint(dbg, "simple2", 6);
  is(bp.options.logValue, "displayName", "logPoint has default value");

  info("Double click the logpoint in secondary pane");
  dblClickElement(dbg, "logPointInSecPane");
  is(
    dbg.win.document.activeElement.tagName,
    "TEXTAREA",
    "The textarea of logpoint panel is focused"
  );
  
  info("Click the logpoint in secondary pane");
  await clickElement(dbg, "logPointInSecPane");
  let logPointPanel = findElement(dbg, "logPointPanel");
  is(logPointPanel, null, "The logpoint panel is closed");
});
+4 −0
Original line number Diff line number Diff line
@@ -1257,7 +1257,11 @@ const selectors = {
  outlineItem: i =>
    `.outline-list__element:nth-child(${i}) .function-signature`,
  outlineItems: ".outline-list__element",
  conditionalPanel: ".conditional-breakpoint-panel",
  conditionalPanelInput: ".conditional-breakpoint-panel textarea",
  conditionalBreakpointInSecPane: ".breakpoint.is-conditional",
  logPointPanel: ".conditional-breakpoint-panel.log-point",
  logPointInSecPane: ".breakpoint.is-log",
  searchField: ".search-field",
  blackbox: ".action.black-box",
  projectSearchCollapsed: ".project-text-search .arrow:not(.expanded)",