Skip to content

Commit

Permalink
fix: git file diff showing as empty and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Jan 17, 2025
1 parent ae96d90 commit d6ace3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/extensions/default/Git/src/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ define(function (require, exports) {
} else {
Metrics.countEvent(Metrics.EVENT_TYPE.GIT, 'diffBtn', "success");
}
$dialog.find(".commit-diff").append(Utils.formatDiff(diffVal));
$dialog.find(".commit-diff").append(diffVal);
}).catch(function (err) {
Metrics.countEvent(Metrics.EVENT_TYPE.GIT, 'diffBtn', "error");
ErrorHandler.showError(err, Strings.ERROR_GIT_DIFF_FAILED);
Expand Down
19 changes: 19 additions & 0 deletions test/spec/Extn-Git-integ-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,25 @@ define(function (require, exports, module) {
await __PR.waitForModalDialogClosed("#git-commit-dialog");
});

it("Should be able to show individual file diff from panel", async function () {
$($(".btn-git-diff")[0]).click();

// check commit diff
await awaitsFor(()=>{
return $(".commit-diff").text().includes("gitignore");
}, "commit-diff to be shown", 10000);
expectTextToContain($(".commit-diff").text(), [
"node_modules"
]);
expectTextToContain($(".dialog-title").text(), [
".gitignore"
]);

// dismiss dialog
__PR.clickDialogButtonID("close");
await __PR.waitForModalDialogClosed("#git-diff-dialog");
});

it("Should be able to commit the files", async function () {
await commitAllBtnClick();
await commmitDlgWithMessage("first commit");
Expand Down

0 comments on commit d6ace3e

Please sign in to comment.