mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-12 13:48:58 +02:00
fix: select the PR diff tab after content loads
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"core.min.js": "core.6332b3c288.min.js",
|
||||
"vendor.min.js": "vendor.5e3fc5ef98.min.js",
|
||||
"vendor.min.js": "vendor.914204e0bc.min.js",
|
||||
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
||||
"all.min.css": "all.99ce8f3e14.min.css"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="pr-page" ng-init="tabState = { active: (details && details.diff) ? 'diff' : 'comments' }">
|
||||
<div class="pr-page">
|
||||
<div class="container paper-page pr-page-inner">
|
||||
<div class="paper-crumbs">
|
||||
<a href="/dashboard">Reviewer</a> /
|
||||
|
||||
@@ -3264,6 +3264,7 @@ angular
|
||||
$http.get(`/api/pr/${$scope.pullRequestId}/content`).then(
|
||||
(res) => {
|
||||
$scope.details = res.data;
|
||||
$scope.tabState = { active: res.data.diff ? "diff" : "comments" };
|
||||
if (callback) {
|
||||
callback(res.data);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -110,6 +110,14 @@ describe("frontend production regressions", function () {
|
||||
request.resolve({ data: { contents: ["title", "MASK", "MASK comment"] } }); await h.flush();
|
||||
expect(h.scope.anonymizePrContent("Alice")).to.equal("MASK");
|
||||
});
|
||||
it("selects the diff tab after asynchronous PR loading", async function () {
|
||||
const h = harness(); h.defs.pullRequestController.at(-1)(h.scope, h.http, {}, { pullRequestId: "pr" }, {});
|
||||
h.requests[0].resolve({ data: {} }); await h.flush();
|
||||
h.requests[1].resolve({ data: { diff: "patch" } }); await h.flush();
|
||||
expect(h.scope.tabState.active).to.equal("diff");
|
||||
const template = fs.readFileSync(path.join(__dirname, "../public/partials/pullRequest.htm"), "utf8");
|
||||
expect(template).not.to.include('ng-init="tabState');
|
||||
});
|
||||
it("finishes failed searches without letting canceled requests reset the next search", async function () {
|
||||
const h = explorer(); h.scope.fileSearchQuery = "old"; h.scope.onFileSearchChange(); const old = h.requests.at(-1);
|
||||
h.scope.fileSearchQuery = "new"; h.scope.onFileSearchChange(); const current = h.requests.at(-1);
|
||||
|
||||
Reference in New Issue
Block a user