Commit 795f8835 authored by pburdette's avatar pburdette

Clean up specs

Check for content after
clearing content. Find
component by component.
parent cc9d7f64
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
<div class="js-file-title file-title clearfix"> <div class="js-file-title file-title clearfix">
{{ __('Contents of .gitlab-ci.yml') }} {{ __('Contents of .gitlab-ci.yml') }}
</div> </div>
<editor-lite v-model="content" file-name="*.yml" data-testid="ci-lint-editor-lite" /> <editor-lite v-model="content" file-name="*.yml" />
</div> </div>
</div> </div>
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import EditorLite from '~/vue_shared/components/editor_lite.vue';
import CiLint from '~/ci_lint/components/ci_lint.vue'; import CiLint from '~/ci_lint/components/ci_lint.vue';
import lintCIMutation from '~/ci_lint/graphql/mutations/lint_ci.mutation.graphql'; import lintCIMutation from '~/ci_lint/graphql/mutations/lint_ci.mutation.graphql';
...@@ -28,7 +29,7 @@ describe('CI Lint', () => { ...@@ -28,7 +29,7 @@ describe('CI Lint', () => {
}); });
}; };
const findEditor = () => wrapper.find('[data-testid="ci-lint-editor-lite"]'); const findEditor = () => wrapper.find(EditorLite);
const findValidateBtn = () => wrapper.find('[data-testid="ci-lint-validate"]'); const findValidateBtn = () => wrapper.find('[data-testid="ci-lint-validate"]');
const findClearBtn = () => wrapper.find('[data-testid="ci-lint-clear"]'); const findClearBtn = () => wrapper.find('[data-testid="ci-lint-clear"]');
...@@ -67,6 +68,8 @@ describe('CI Lint', () => { ...@@ -67,6 +68,8 @@ describe('CI Lint', () => {
}); });
it('content is cleared on clear action', async () => { it('content is cleared on clear action', async () => {
expect(findEditor().props('value')).toBe(content);
await findClearBtn().vm.$emit('click'); await findClearBtn().vm.$emit('click');
expect(findEditor().props('value')).toBe(''); expect(findEditor().props('value')).toBe('');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment