Skip to content

Commit e8a232b

Browse files
authored
fix: global jump does not switch tabs (#139)
This PR fixes the issue on global mark. Jumping to a global mark did not switch tabs.
1 parent 6730894 commit e8a232b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/background/usecases/MarkJumpUseCase.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default class MarkJumpUseCase {
4343
const smooth = (await this.propertySettings.getProperty(
4444
"smoothscroll"
4545
)) as boolean;
46+
4647
try {
4748
await this.contentMessageClient.scrollTo(
4849
mark.tabId,
@@ -51,7 +52,7 @@ export default class MarkJumpUseCase {
5152
mark.y,
5253
smooth
5354
);
54-
await chrome.tabs.update(tabId, { active: true });
55+
await chrome.tabs.update(mark.tabId, { active: true });
5556
return;
5657
} catch (e) {
5758
const tab = await chrome.tabs.create({ url: mark.url });

test/background/usecases/MarkJumpUseCase.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("MarkJumpUseCase", () => {
3838
const mockGetGlobalMark = jest
3939
.spyOn(markRepository, "getGlobalMark")
4040
.mockResolvedValue({
41-
tabId: 100,
41+
tabId: 101,
4242
url: "https://example.com/",
4343
x: 10,
4444
y: 20,
@@ -53,8 +53,8 @@ describe("MarkJumpUseCase", () => {
5353
await sut.jumpToMark("A");
5454

5555
expect(mockGetGlobalMark).toHaveBeenCalledWith("A");
56-
expect(mockScrollTo).toHaveBeenCalledWith(100, 0, 10, 20, true);
57-
expect(mockTabsUpdate).toHaveBeenCalledWith(100, { active: true });
56+
expect(mockScrollTo).toHaveBeenCalledWith(101, 0, 10, 20, true);
57+
expect(mockTabsUpdate).toHaveBeenCalledWith(101, { active: true });
5858
});
5959

6060
it("reopens tabs when the tab of the global mark is gone", async () => {

0 commit comments

Comments
 (0)