handle multi-line triggers description, fix #485
This commit is contained in:
@@ -54,6 +54,7 @@ describe('Triggers Panel schema migration', () => {
|
||||
statusField: false,
|
||||
severityField: false,
|
||||
descriptionField: true,
|
||||
descriptionAtNewLine: false,
|
||||
hostsInMaintenance: true,
|
||||
showTriggers: 'all triggers',
|
||||
sortTriggersBy: { text: 'last change', value: 'lastchange' },
|
||||
@@ -88,6 +89,7 @@ describe('Triggers Panel schema migration', () => {
|
||||
statusField: true,
|
||||
severityField: true,
|
||||
descriptionField: true,
|
||||
descriptionAtNewLine: false,
|
||||
hostsInMaintenance: true,
|
||||
showTriggers: 'all triggers',
|
||||
sortTriggersBy: { text: 'last change', value: 'lastchange' },
|
||||
|
||||
@@ -77,6 +77,19 @@ describe('TriggerPanelCtrl', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('When formatting triggers', () => {
|
||||
beforeEach(() => {
|
||||
ctx.panelCtrl = createPanelCtrl();
|
||||
});
|
||||
|
||||
it('should handle new lines in trigger description', () => {
|
||||
ctx.panelCtrl.setTriggerSeverity = jest.fn((trigger) => trigger);
|
||||
let trigger = {comments: "this is\ndescription"};
|
||||
const formattedTrigger = ctx.panelCtrl.formatTrigger(trigger);
|
||||
expect(formattedTrigger.comments).toBe("this is<br>description");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const defaultTrigger = {
|
||||
|
||||
Reference in New Issue
Block a user