Commit d8191a7b authored by Eulyeon Ko's avatar Eulyeon Ko

Find an element by ref

parent a88cca1c
......@@ -28,7 +28,7 @@ export default {
</script>
<template>
<div v-if="isNoteableTypeEpic && isConfidential" class="issuable-note-warning">
<div v-if="isNoteableTypeEpic && isConfidential" ref="epicWarning" class="issuable-note-warning">
<gl-icon name="eye-slash" :size="16" class="icon" />
<span ref="confidential">
{{ __('This is a confidential epic.') }}
......
......@@ -8,6 +8,7 @@ describe('Epic Warning Component', () => {
const findIcon = () => wrapper.find(GlIcon);
const findConfidentialBlock = () => wrapper.find({ ref: 'confidential' });
const findEpicWarning = () => wrapper.find({ ref: 'epicWarning' });
const createComponent = (props, isNoteableEpic = true) => {
wrapper = shallowMount(EpicWarning, {
......@@ -60,9 +61,12 @@ describe('Epic Warning Component', () => {
});
describe('when noteable type is not epic', () => {
it('does not render itself', () => {
beforeEach(() => {
createComponent({ isConfidential: true }, false);
expect(wrapper.find('.issuable-note-warning').exists()).toBe(false);
});
it('does not render itself', () => {
expect(findEpicWarning().exists()).toBe(false);
});
});
});
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