debian-mirror-gitlab/spec/frontend/issues/show/store_spec.js

40 lines
961 B
JavaScript
Raw Normal View History

2022-01-26 12:08:38 +05:30
import Store from '~/issues/show/stores';
import updateDescription from '~/issues/show/utils/update_description';
2019-12-21 20:55:43 +05:30
2022-01-26 12:08:38 +05:30
jest.mock('~/issues/show/utils/update_description');
2019-12-21 20:55:43 +05:30
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);
});
});
});