diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 18:06:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 18:06:16 +0300 |
commit | b1d7b01241da7f7f5d42c5ef46c7788fac0ab6d3 (patch) | |
tree | b53def1340801c2b7706e9f68f6b17a36efad4dd /spec/frontend/issue_show/utils | |
parent | aabf412bc1f30cb12d97a077458d002c57cad8e9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/issue_show/utils')
-rw-r--r-- | spec/frontend/issue_show/utils/update_description_spec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/frontend/issue_show/utils/update_description_spec.js b/spec/frontend/issue_show/utils/update_description_spec.js new file mode 100644 index 00000000000..b2c6bd3c302 --- /dev/null +++ b/spec/frontend/issue_show/utils/update_description_spec.js @@ -0,0 +1,24 @@ +import updateDescription from '~/issue_show/utils/update_description'; + +describe('updateDescription', () => { + it('returns the correct value to be set as descriptionHtml', () => { + const actual = updateDescription( + '<details><summary>One</summary></details><details><summary>Two</summary></details>', + [{ open: true }, { open: false }], // mocking NodeList from the dom. + ); + + expect(actual).toEqual( + '<details open="true"><summary>One</summary></details><details><summary>Two</summary></details>', + ); + }); + + describe('when description details returned from api is different then whats currently on the dom', () => { + it('returns the description from the api', () => { + const dataDescription = '<details><summary>One</summary></details>'; + + const actual = updateDescription(dataDescription, []); + + expect(actual).toEqual(dataDescription); + }); + }); +}); |