From e5b0947fe741c9b56e96e39883d6b3623fdbac25 Mon Sep 17 00:00:00 2001 From: Alex Rosenfeld Date: Tue, 27 Aug 2019 16:29:19 +0000 Subject: [PATCH] Bug 1574053 - allow shift-click to disable column breakpoints. Allow user to disable column breakpoints with shift-click. Added mochitests to reinforce. r=jlast. Differential Revision: https://phabricator.services.mozilla.com/D43326 --HG-- extra : moz-landing-system : lando --- .../src/components/Editor/ColumnBreakpoint.js | 7 ++++ .../browser_dbg-breakpoints-columns.js | 36 +++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/devtools/client/debugger/src/components/Editor/ColumnBreakpoint.js b/devtools/client/debugger/src/components/Editor/ColumnBreakpoint.js index 32e9eea330b2..f39c391f7d20 100644 --- a/devtools/client/debugger/src/components/Editor/ColumnBreakpoint.js +++ b/devtools/client/debugger/src/components/Editor/ColumnBreakpoint.js @@ -89,6 +89,13 @@ export default class ColumnBreakpoint extends PureComponent { event.stopPropagation(); event.preventDefault(); const { cx, columnBreakpoint, breakpointActions } = this.props; + + // disable column breakpoint on shift-click. + if (event.shiftKey) { + const breakpoint: breakpoint = columnBreakpoint.breakpoint; + return breakpointActions.toggleDisabledBreakpoint(cx, breakpoint); + } + if (columnBreakpoint.breakpoint) { breakpointActions.removeBreakpoint(cx, columnBreakpoint.breakpoint); } else { diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js index f4543e90ce49..ebfffe125d7b 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-breakpoints-columns.js @@ -23,6 +23,24 @@ async function enableSecondBreakpoint(dbg) { await waitForAllElements(dbg, "breakpointItems", 2); } +// disable active column bp with shift-click. +async function shiftClickDisable(dbg) { + let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints"); + debugger; + shiftClickElement(dbg, "columnBreakpoints"); + bpMarkers = findAllElements(dbg, "columnBreakpoints"); + debugger; + assertClass(bpMarkers[0], "disabled"); +} + +// re-enable disabled column bp with shift-click. +async function shiftClickEnable(dbg) { + let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints"); + shiftClickElement(dbg, "columnBreakpoints"); + bpMarkers = findAllElements(dbg, "columnBreakpoints"); + assertClass(bpMarkers[0], "active"); +} + async function setConditionalBreakpoint(dbg, index, condition) { let bpMarkers = await waitForAllElements(dbg, "columnBreakpoints"); rightClickEl(dbg, bpMarkers[index]); @@ -84,21 +102,27 @@ add_task(async function() { info("2. Click on the second breakpoint on line 32"); await enableSecondBreakpoint(dbg); - info("3. Add a condition to the first breakpoint"); + info("3. Disable second breakpoint using shift-click"); + await shiftClickDisable(dbg); + + info("4. Re-enable second breakpoint using shift-click"); + await shiftClickEnable(dbg); + + info("5. Add a condition to the first breakpoint"); await setConditionalBreakpoint(dbg, 0, "foo"); - info("4. Add a log to the first breakpoint"); + info("6. Add a log to the first breakpoint"); await setLogPoint(dbg, 0, "bar"); - info("5. Disable the first breakpoint"); + info("7. Disable the first breakpoint"); await disableBreakpoint(dbg, 0); - info("6. Remove the first breakpoint"); + info("8. Remove the first breakpoint"); await removeFirstBreakpoint(dbg); - info("7. Add a condition to the second breakpoint"); + info("9. Add a condition to the second breakpoint"); await setConditionalBreakpoint(dbg, 1, "foo2"); - info("8. test removing the breakpoints by clicking in the gutter"); + info("10. Test removing the breakpoints by clicking in the gutter"); await removeAllBreakpoints(dbg, 32, 0); });