fix display hook error message

This commit is contained in:
basyura 2016-11-25 23:09:50 +09:00
parent 024ca242b4
commit 3ce2ba1afb
3 changed files with 17 additions and 1 deletions

View file

@ -101,7 +101,7 @@
urlSuffix = deleteSourceBranch ? '?deleted_source_branch=true' : '';
return window.location.href = window.location.pathname + urlSuffix;
} else if (data.merge_error) {
return this.$widgetBody.html("<h4>" + data.merge_error + "</h4>");
return _this.$widgetBody.html("<h4>" + data.merge_error + "</h4>");
} else {
callback = function() {
return merge_request_widget.mergeInProgress(deleteSourceBranch);

View file

@ -0,0 +1,4 @@
---
title: "fix display hook error message"
merge_request: 7775
author: basyura

View file

@ -106,6 +106,18 @@
});
});
describe('mergeInProgress', function() {
it('should display error with h4 tag', function() {
spyOn(this.class.$widgetBody, 'html').and.callFake(function(html) {
expect(html).toBe('<h4>Sorry, something went wrong.</h4>');
});
spyOn($, 'ajax').and.callFake(function(e) {
e.success({ merge_error: 'Sorry, something went wrong.' });
});
this.class.mergeInProgress(null);
});
});
return describe('getCIStatus', function() {
beforeEach(function() {
this.ciStatusData = {