Skip to content

Commit d6ace3e

Browse files
committed
fix: git file diff showing as empty and tests
1 parent ae96d90 commit d6ace3e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/extensions/default/Git/src/Panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ define(function (require, exports) {
460460
} else {
461461
Metrics.countEvent(Metrics.EVENT_TYPE.GIT, 'diffBtn', "success");
462462
}
463-
$dialog.find(".commit-diff").append(Utils.formatDiff(diffVal));
463+
$dialog.find(".commit-diff").append(diffVal);
464464
}).catch(function (err) {
465465
Metrics.countEvent(Metrics.EVENT_TYPE.GIT, 'diffBtn', "error");
466466
ErrorHandler.showError(err, Strings.ERROR_GIT_DIFF_FAILED);

test/spec/Extn-Git-integ-test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,25 @@ define(function (require, exports, module) {
230230
await __PR.waitForModalDialogClosed("#git-commit-dialog");
231231
});
232232

233+
it("Should be able to show individual file diff from panel", async function () {
234+
$($(".btn-git-diff")[0]).click();
235+
236+
// check commit diff
237+
await awaitsFor(()=>{
238+
return $(".commit-diff").text().includes("gitignore");
239+
}, "commit-diff to be shown", 10000);
240+
expectTextToContain($(".commit-diff").text(), [
241+
"node_modules"
242+
]);
243+
expectTextToContain($(".dialog-title").text(), [
244+
".gitignore"
245+
]);
246+
247+
// dismiss dialog
248+
__PR.clickDialogButtonID("close");
249+
await __PR.waitForModalDialogClosed("#git-diff-dialog");
250+
});
251+
233252
it("Should be able to commit the files", async function () {
234253
await commitAllBtnClick();
235254
await commmitDlgWithMessage("first commit");

0 commit comments

Comments
 (0)