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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/vue_mr_widget/components/extensions/child_content_spec.js')
-rw-r--r--spec/frontend/vue_mr_widget/components/extensions/child_content_spec.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/frontend/vue_mr_widget/components/extensions/child_content_spec.js b/spec/frontend/vue_mr_widget/components/extensions/child_content_spec.js
new file mode 100644
index 00000000000..198a4c2823a
--- /dev/null
+++ b/spec/frontend/vue_mr_widget/components/extensions/child_content_spec.js
@@ -0,0 +1,40 @@
+import { shallowMount } from '@vue/test-utils';
+import ChildContent from '~/vue_merge_request_widget/components/extensions/child_content.vue';
+
+let wrapper;
+const mockData = () => ({
+ header: 'Test header',
+ text: 'Test content',
+ icon: {
+ name: 'error',
+ },
+});
+
+function factory(propsData) {
+ wrapper = shallowMount(ChildContent, {
+ propsData: {
+ ...propsData,
+ widgetLabel: 'Test',
+ },
+ });
+}
+
+describe('MR widget extension child content', () => {
+ afterEach(() => {
+ wrapper.destroy();
+ wrapper = null;
+ });
+
+ it('renders child components', () => {
+ factory({
+ data: {
+ ...mockData(),
+ children: [mockData()],
+ },
+ level: 2,
+ });
+
+ expect(wrapper.find('[data-testid="child-content"]').exists()).toBe(true);
+ expect(wrapper.find('[data-testid="child-content"]').props('level')).toBe(3);
+ });
+});