diff options
Diffstat (limited to 'spec/frontend/tracing/components/tracing_table_list_spec.js')
-rw-r--r-- | spec/frontend/tracing/components/tracing_table_list_spec.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/frontend/tracing/components/tracing_table_list_spec.js b/spec/frontend/tracing/components/tracing_table_list_spec.js index 773b3eb8ed2..aa96b9b370f 100644 --- a/spec/frontend/tracing/components/tracing_table_list_spec.js +++ b/spec/frontend/tracing/components/tracing_table_list_spec.js @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import TracingTableList from '~/tracing/components/tracing_table_list.vue'; @@ -27,13 +28,18 @@ describe('TracingTableList', () => { }; const getRows = () => wrapper.findComponent({ name: 'GlTable' }).find('tbody').findAll('tr'); - + const getRow = (idx) => getRows().at(idx); const getCells = (trIdx) => getRows().at(trIdx).findAll('td'); const getCell = (trIdx, tdIdx) => { return getCells(trIdx).at(tdIdx); }; + const selectRow = async (idx) => { + getRow(idx).trigger('click'); + await nextTick(); + }; + it('renders traces as table', () => { mountComponent(); @@ -50,6 +56,14 @@ describe('TracingTableList', () => { }); }); + it('emits trace-selected on row selection', async () => { + mountComponent(); + + await selectRow(0); + expect(wrapper.emitted('trace-selected')).toHaveLength(1); + expect(wrapper.emitted('trace-selected')[0][0]).toBe(mockTraces[0]); + }); + it('renders the empty state when no traces are provided', () => { mountComponent({ traces: [] }); |