debian-mirror-gitlab/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js

39 lines
1 KiB
JavaScript
Raw Normal View History

2021-04-29 21:17:54 +05:30
import { GlProgressBar } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
2021-03-11 19:13:27 +05:30
import LearnGitlabA from '~/pages/projects/learn_gitlab/components/learn_gitlab_a.vue';
2021-06-08 01:23:25 +05:30
import { testActions, testSections } from './mock_data';
2021-03-11 19:13:27 +05:30
describe('Learn GitLab Design A', () => {
let wrapper;
2021-04-29 21:17:54 +05:30
const createWrapper = () => {
2021-06-08 01:23:25 +05:30
wrapper = mount(LearnGitlabA, { propsData: { actions: testActions, sections: testSections } });
2021-04-29 21:17:54 +05:30
};
beforeEach(() => {
createWrapper();
});
2021-03-11 19:13:27 +05:30
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
2021-04-29 21:17:54 +05:30
it('renders correctly', () => {
expect(wrapper.element).toMatchSnapshot();
});
2021-03-11 19:13:27 +05:30
2021-04-29 21:17:54 +05:30
it('renders the progress percentage', () => {
const text = wrapper.find('[data-testid="completion-percentage"]').text();
2021-03-11 19:13:27 +05:30
2021-04-29 21:17:54 +05:30
expect(text).toBe('22% completed');
});
it('renders the progress bar with correct values', () => {
const progressBar = wrapper.findComponent(GlProgressBar);
expect(progressBar.attributes('value')).toBe('2');
expect(progressBar.attributes('max')).toBe('9');
2021-03-11 19:13:27 +05:30
});
});