Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/issues/show/utils/update_description_spec.js')
-rw-r--r--spec/frontend/issues/show/utils/update_description_spec.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/frontend/issues/show/utils/update_description_spec.js b/spec/frontend/issues/show/utils/update_description_spec.js
new file mode 100644
index 00000000000..f4afef8af12
--- /dev/null
+++ b/spec/frontend/issues/show/utils/update_description_spec.js
@@ -0,0 +1,24 @@
+import updateDescription from '~/issues/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);
+ });
+ });
+});