summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMurat Dogan <muratdogan@yahoo.com>2018-06-12 13:04:01 +0000
committerPhil Hughes <me@iamphill.com>2018-06-12 13:04:01 +0000
commit423fcb476e64c96d7945af8d9fca65aa6db20314 (patch)
treed91864ba51fc74d8a306c870552e253eee66d3ac /spec
parentd94b162129ed7d3131efe7822a4f0c6b4991fb8e (diff)
downloadgitlab-ce-423fcb476e64c96d7945af8d9fca65aa6db20314.tar.gz
mergeError message has been binded using v-html directive
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
index a0a74648328..8de99fd3c96 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
@@ -6,6 +6,7 @@ import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe('MRWidgetFailedToMerge', () => {
const dummyIntervalId = 1337;
let Component;
+ let mr;
let vm;
beforeEach(() => {
@@ -13,10 +14,11 @@ describe('MRWidgetFailedToMerge', () => {
spyOn(eventHub, '$emit');
spyOn(window, 'setInterval').and.returnValue(dummyIntervalId);
spyOn(window, 'clearInterval').and.stub();
+ mr = {
+ mergeError: 'Merge error happened',
+ };
vm = mountComponent(Component, {
- mr: {
- mergeError: 'Merge error happened.',
- },
+ mr,
});
});
@@ -44,6 +46,19 @@ describe('MRWidgetFailedToMerge', () => {
expect(vm.timerText).toEqual('Refreshing in a second to show the updated status...');
});
});
+
+ describe('mergeError', () => {
+ it('removes forced line breaks', done => {
+ mr.mergeError = 'contains<br />line breaks<br />';
+
+ Vue.nextTick()
+ .then(() => {
+ expect(vm.mergeError).toBe('contains line breaks');
+ })
+ .then(done)
+ .catch(done.fail);
+ });
+ });
});
describe('created', () => {
@@ -103,7 +118,7 @@ describe('MRWidgetFailedToMerge', () => {
it('renders given error', () => {
expect(vm.$el.querySelector('.has-error-message').textContent.trim()).toEqual(
- 'Merge error happened..',
+ 'Merge error happened.',
);
});