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

store_spec.js « show « issues « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 20d3a6cdaaed3dc7df18b1a9c6ed5f99ce307ab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);
    });
  });
});