Skip to content

Commit

Permalink
Port fix for Open with Encoding quickpick
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <[email protected]>
  • Loading branch information
t1m0thyj committed Dec 27, 2024
1 parent cf55928 commit 6fa6955
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed an issue where clicking on a file in the Unix System Services tree caused the tree to abruptly change focus to the selected item. [#2486](https://github.com/zowe/zowe-explorer-vscode/issues/2486)
- Fixed an issue where binary USS files were not fetched using the "Pull from Mainframe" context menu option. [#3355](https://github.com/zowe/zowe-explorer-vscode/issues/3355)
- Fixed an issue with Auto Save where a failed UNIX file or data set save operation caused an infinite loop of save requests. [#2406](https://github.com/zowe/zowe-explorer-vscode/issues/2406), [#2627](https://github.com/zowe/zowe-explorer-vscode/issues/2627)
- Fixed an issue where "Open with Encoding" menu failed when tagged encoding was selected for a binary USS file. [#3377](https://github.com/zowe/zowe-explorer-vscode/pull/3377)

## `2.18.0`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,23 @@ describe("Shared utils unit tests - function promptForEncoding", () => {
expect(blockMocks.showQuickPick.mock.calls[0][1]).toEqual(expect.objectContaining({ placeHolder: "Current encoding is Binary" }));
});

it("prompts for encoding for tagged USS binary file", async () => {
const blockMocks = createBlockMocks();
const node = new ZoweUSSNode({
label: "testFile",
collapsibleState: vscode.TreeItemCollapsibleState.None,
session: blockMocks.session,
profile: blockMocks.profile,
parentPath: "/root",
});
node.setEncoding(binaryEncoding);
blockMocks.showQuickPick.mockImplementationOnce(async (items) => items[0]);
const encoding = await sharedUtils.promptForEncoding(node, "binary");
expect(blockMocks.showQuickPick).toHaveBeenCalled();
expect(await blockMocks.showQuickPick.mock.calls[0][0][0]).toEqual({ label: "binary", description: "USS file tag" });
expect(encoding).toEqual({ kind: "binary" });
});

it("prompts for encoding for USS file when profile contains encoding", async () => {
const blockMocks = createBlockMocks();
(blockMocks.profile.profile as any).encoding = "IBM-1047";
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ export async function promptForEncoding(node: IZoweDatasetTreeNode | IZoweUSSTre
break;
default:
if (response != null) {
encoding = { kind: "other", codepage: response };
encoding = response === "binary" ? { kind: "binary" } : { kind: "other", codepage: response };
}
break;
}
Expand Down

0 comments on commit 6fa6955

Please sign in to comment.