diff options
Diffstat (limited to 'spec/frontend/ml/model_registry/components/candidate_detail_row_spec.js')
-rw-r--r-- | spec/frontend/ml/model_registry/components/candidate_detail_row_spec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/frontend/ml/model_registry/components/candidate_detail_row_spec.js b/spec/frontend/ml/model_registry/components/candidate_detail_row_spec.js new file mode 100644 index 00000000000..24b18b6b42d --- /dev/null +++ b/spec/frontend/ml/model_registry/components/candidate_detail_row_spec.js @@ -0,0 +1,36 @@ +import { shallowMount } from '@vue/test-utils'; +import DetailRow from '~/ml/model_registry/components/candidate_detail_row.vue'; + +describe('CandidateDetailRow', () => { + const ROW_LABEL_CELL = 0; + const ROW_VALUE_CELL = 1; + + let wrapper; + + const createWrapper = ({ slots = {} } = {}) => { + wrapper = shallowMount(DetailRow, { + propsData: { label: 'Item' }, + slots, + }); + }; + + const findCellAt = (index) => wrapper.findAll('td').at(index); + + beforeEach(() => createWrapper()); + + it('renders row label', () => { + expect(findCellAt(ROW_LABEL_CELL).text()).toBe('Item'); + }); + + it('renders nothing on item cell', () => { + expect(findCellAt(ROW_VALUE_CELL).text()).toBe(''); + }); + + describe('With slot', () => { + beforeEach(() => createWrapper({ slots: { default: 'Some content' } })); + + it('Renders slot', () => { + expect(findCellAt(ROW_VALUE_CELL).text()).toBe('Some content'); + }); + }); +}); |