debian-mirror-gitlab/spec/frontend/batch_comments/components/review_bar_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-11-11 11:23:49 +05:30
import { shallowMount } from '@vue/test-utils';
import ReviewBar from '~/batch_comments/components/review_bar.vue';
import { REVIEW_BAR_VISIBLE_CLASS_NAME } from '~/batch_comments/constants';
import createStore from '../create_batch_comments_store';
describe('Batch comments review bar component', () => {
let store;
let wrapper;
const createComponent = (propsData = {}) => {
store = createStore();
wrapper = shallowMount(ReviewBar, {
store,
propsData,
});
};
beforeEach(() => {
document.body.className = '';
});
2023-06-20 00:43:36 +05:30
it('adds review-bar-visible class to body when review bar is mounted', () => {
2022-10-02 17:18:49 +05:30
expect(document.body.classList.contains(REVIEW_BAR_VISIBLE_CLASS_NAME)).toBe(false);
2021-11-11 11:23:49 +05:30
2022-10-02 17:18:49 +05:30
createComponent();
2021-11-11 11:23:49 +05:30
2022-10-02 17:18:49 +05:30
expect(document.body.classList.contains(REVIEW_BAR_VISIBLE_CLASS_NAME)).toBe(true);
2021-11-11 11:23:49 +05:30
});
2023-06-20 00:43:36 +05:30
it('removes review-bar-visible class to body when review bar is destroyed', () => {
2022-10-02 17:18:49 +05:30
createComponent();
2021-11-11 11:23:49 +05:30
2022-10-02 17:18:49 +05:30
wrapper.destroy();
2022-08-27 11:52:29 +05:30
2022-10-02 17:18:49 +05:30
expect(document.body.classList.contains(REVIEW_BAR_VISIBLE_CLASS_NAME)).toBe(false);
2021-11-11 11:23:49 +05:30
});
});