diff options
Diffstat (limited to 'spec/frontend/issues/show/store_spec.js')
-rw-r--r-- | spec/frontend/issues/show/store_spec.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/frontend/issues/show/store_spec.js b/spec/frontend/issues/show/store_spec.js new file mode 100644 index 00000000000..20d3a6cdaae --- /dev/null +++ b/spec/frontend/issues/show/store_spec.js @@ -0,0 +1,39 @@ +import Store from '~/issues/show/stores'; +import updateDescription from '~/issues/show/utils/update_description'; + +jest.mock('~/issues/show/utils/update_description'); + +describe('Store', () => { + let store; + + beforeEach(() => { + store = new Store({ + descriptionHtml: '<p>This is a description</p>', + }); + }); + + describe('updateState', () => { + beforeEach(() => { + document.body.innerHTML = ` + <div class="detail-page-description content-block"> + <details open> + <summary>One</summary> + </details> + <details> + <summary>Two</summary> + </details> + </div> + `; + }); + + afterEach(() => { + document.getElementsByTagName('html')[0].innerHTML = ''; + }); + + it('calls updateDetailsState', () => { + store.updateState({ description: '' }); + + expect(updateDescription).toHaveBeenCalledTimes(1); + }); + }); +}); |