Merge "blame: Add base url to _getBlameForBaseLine" into stable-3.2
This commit is contained in:
@@ -54,6 +54,7 @@ import './gr-diff-builder.js';
|
|||||||
import '../../shared/gr-rest-api-interface/gr-rest-api-interface.js';
|
import '../../shared/gr-rest-api-interface/gr-rest-api-interface.js';
|
||||||
import {getMockDiffResponse} from '../../../test/mock-diff-response.js';
|
import {getMockDiffResponse} from '../../../test/mock-diff-response.js';
|
||||||
import './gr-diff-builder-element.js';
|
import './gr-diff-builder-element.js';
|
||||||
|
import {BaseUrlBehavior} from '../../../behaviors/base-url-behavior/base-url-behavior.js';
|
||||||
import {dom, flush} from '@polymer/polymer/lib/legacy/polymer.dom.js';
|
import {dom, flush} from '@polymer/polymer/lib/legacy/polymer.dom.js';
|
||||||
import {GrAnnotation} from '../gr-diff-highlight/gr-annotation.js';
|
import {GrAnnotation} from '../gr-diff-highlight/gr-annotation.js';
|
||||||
import {GrDiffLine} from '../gr-diff/gr-diff-line.js';
|
import {GrDiffLine} from '../gr-diff/gr-diff-line.js';
|
||||||
@@ -79,6 +80,7 @@ suite('gr-diff-builder tests', () => {
|
|||||||
getLoggedIn() { return Promise.resolve(false); },
|
getLoggedIn() { return Promise.resolve(false); },
|
||||||
getProjectConfig() { return Promise.resolve({}); },
|
getProjectConfig() { return Promise.resolve({}); },
|
||||||
});
|
});
|
||||||
|
sandbox.stub(BaseUrlBehavior, 'getBaseUrl').returns('/r');
|
||||||
prefs = {
|
prefs = {
|
||||||
line_length: 10,
|
line_length: 10,
|
||||||
show_tabs: true,
|
show_tabs: true,
|
||||||
@@ -1222,6 +1224,9 @@ suite('gr-diff-builder tests', () => {
|
|||||||
`Commit 1234567890<br>Author: Clark Kent<br>Date: ${date}`
|
`Commit 1234567890<br>Author: Clark Kent<br>Date: ${date}`
|
||||||
+ '<br><br>Testing Commit'
|
+ '<br><br>Testing Commit'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const url = blameNode.getElementsByClassName('blameDate');
|
||||||
|
assert.equal(url[0].getAttribute('href'), '/r/q/1234567890');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import {BaseUrlBehavior} from '../../../behaviors/base-url-behavior/base-url-behavior.js';
|
||||||
import {GrDiffLine} from '../gr-diff/gr-diff-line.js';
|
import {GrDiffLine} from '../gr-diff/gr-diff-line.js';
|
||||||
import {GrDiffGroup} from '../gr-diff/gr-diff-group.js';
|
import {GrDiffGroup} from '../gr-diff/gr-diff-group.js';
|
||||||
|
|
||||||
@@ -579,7 +580,8 @@ GrDiffBuilder.prototype._getBlameForBaseLine = function(lineNum, opt_commit) {
|
|||||||
|
|
||||||
const shaNode = this._createElement('a', 'blameDate');
|
const shaNode = this._createElement('a', 'blameDate');
|
||||||
shaNode.innerText = `${date}`;
|
shaNode.innerText = `${date}`;
|
||||||
shaNode.setAttribute('href', `/q/${commit.id}`);
|
shaNode.setAttribute('href',
|
||||||
|
`${BaseUrlBehavior.getBaseUrl()}/q/${commit.id}`);
|
||||||
blameNode.appendChild(shaNode);
|
blameNode.appendChild(shaNode);
|
||||||
|
|
||||||
const shortName = commit.author.split(' ')[0];
|
const shortName = commit.author.split(' ')[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user