[Security Solution][Investigations] Fixes rendering issue of last element of a task list when empty (#122242) (#122266)

* fix: fixes the issue where the last element of a task list would not render properly

* test: update test

Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
This commit is contained in:
Kibana Machine 2022-01-04 17:49:13 -05:00 committed by GitHub
parent f882402f84
commit 338e15e5a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,22 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { createNote } from './helpers';
describe('createNote', () => {
it(`does not trim the note's text content`, () => {
// A note with two empty todo items.
// Notice the required trailing whitespace which is required otherwise
// markdown renderers will not render the list correctly
const note = '- [ ] \n\n- [ ] ';
expect(createNote({ newNote: note })).toEqual(
expect.objectContaining({
note,
})
);
});
});

View file

@ -79,7 +79,7 @@ export const createNote = ({ newNote }: { newNote: string }): Note => ({
created: moment.utc().toDate(),
id: uuid.v4(),
lastEdit: null,
note: newNote.trim(),
note: newNote,
saveObjectId: null,
user: 'elastic', // TODO: get the logged-in Kibana user
version: null,