mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Bug 1585407 - setPendingSelectedLocation loses line/column r=jlast
Differential Revision: https://phabricator.services.mozilla.com/D47802 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
48ca0e736f
commit
db64512ef6
@ -58,12 +58,13 @@ export const setSelectedLocation = (
|
||||
export const setPendingSelectedLocation = (
|
||||
cx: Context,
|
||||
url: string,
|
||||
options: Object
|
||||
options?: PartialPosition
|
||||
) => ({
|
||||
type: "SET_PENDING_SELECTED_LOCATION",
|
||||
cx,
|
||||
url: url,
|
||||
line: options.location ? options.location.line : null,
|
||||
url,
|
||||
line: options ? options.line : null,
|
||||
column: options ? options.column : null,
|
||||
});
|
||||
|
||||
export const clearSelectedLocation = (cx: Context) => ({
|
||||
@ -85,7 +86,7 @@ export const clearSelectedLocation = (cx: Context) => ({
|
||||
export function selectSourceURL(
|
||||
cx: Context,
|
||||
url: string,
|
||||
options: PartialPosition = {}
|
||||
options?: PartialPosition
|
||||
) {
|
||||
return async ({ dispatch, getState, sourceMaps }: ThunkArgs) => {
|
||||
const source = getSourceByURL(getState(), url);
|
||||
|
@ -190,14 +190,15 @@ describe("sources", () => {
|
||||
it("sets and clears pending selected location correctly", () => {
|
||||
const { dispatch, getState, cx } = createStore(mockCommandClient);
|
||||
const url = "testURL";
|
||||
const options = { location: { line: "testLine" } };
|
||||
const options = { line: "testLine", column: "testColumn" };
|
||||
|
||||
// set value
|
||||
dispatch(actions.setPendingSelectedLocation(cx, url, options));
|
||||
const setResult = getState().sources.pendingSelectedLocation;
|
||||
expect(setResult).toEqual({
|
||||
url,
|
||||
line: options.location.line,
|
||||
line: options.line,
|
||||
column: options.column,
|
||||
});
|
||||
|
||||
// clear value
|
||||
|
@ -203,6 +203,7 @@ function update(
|
||||
location = {
|
||||
url: action.url,
|
||||
line: action.line,
|
||||
column: action.column,
|
||||
};
|
||||
|
||||
prefs.pendingSelectedLocation = location;
|
||||
|
Loading…
x
Reference in New Issue
Block a user