Commit 5e8bae25 authored by Filipa Lacerda's avatar Filipa Lacerda

Follow up after review

parent d0ade1af
...@@ -18,9 +18,14 @@ export default { ...@@ -18,9 +18,14 @@ export default {
required: true, required: true,
}, },
}, },
computed: {
badgeDuration() {
return this.section.line && this.section.line.section_duration;
},
},
methods: { methods: {
handleOnClickCollapsibleLine(section) { handleOnClickCollapsibleLine(section) {
this.$emit('handleOnClickCollapsibleLine', section); this.$emit('onClickCollapsibleLine', section);
}, },
}, },
}; };
...@@ -29,7 +34,7 @@ export default { ...@@ -29,7 +34,7 @@ export default {
<div> <div>
<log-line-header <log-line-header
:line="section.line" :line="section.line"
:duration="section.line.section_duration" :duration="badgeDuration"
:path="traceEndpoint" :path="traceEndpoint"
:is-closed="section.isClosed" :is-closed="section.isClosed"
@toggleLine="handleOnClickCollapsibleLine(section)" @toggleLine="handleOnClickCollapsibleLine(section)"
...@@ -41,7 +46,7 @@ export default { ...@@ -41,7 +46,7 @@ export default {
:key="`collapsible-nested-${line.offset}`" :key="`collapsible-nested-${line.offset}`"
:section="line" :section="line"
:trace-endpoint="traceEndpoint" :trace-endpoint="traceEndpoint"
@handleOnClickCollapsibleLine="handleOnClickCollapsibleLine" @toggleLine="handleOnClickCollapsibleLine"
/> />
<log-line v-else :key="line.offset" :line="line" :path="traceEndpoint" /> <log-line v-else :key="line.offset" :line="line" :path="traceEndpoint" />
</template> </template>
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
:key="`collapsible-${index}`" :key="`collapsible-${index}`"
:section="section" :section="section"
:trace-endpoint="traceEndpoint" :trace-endpoint="traceEndpoint"
@handleOnClickCollapsibleLine="handleOnClickCollapsibleLine" @onClickCollapsibleLine="handleOnClickCollapsibleLine"
/> />
<log-line v-else :key="section.offset" :line="section" :path="traceEndpoint" /> <log-line v-else :key="section.offset" :line="section" :path="traceEndpoint" />
</template> </template>
......
...@@ -7,6 +7,8 @@ describe('Job Log Collapsible Section', () => { ...@@ -7,6 +7,8 @@ describe('Job Log Collapsible Section', () => {
const traceEndpoint = 'jobs/335'; const traceEndpoint = 'jobs/335';
const findCollapsibleLine = () => wrapper.find('.collapsible-line');
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
wrapper = mount(CollpasibleSection, { wrapper = mount(CollpasibleSection, {
sync: true, sync: true,
...@@ -16,8 +18,6 @@ describe('Job Log Collapsible Section', () => { ...@@ -16,8 +18,6 @@ describe('Job Log Collapsible Section', () => {
}); });
}; };
beforeEach(() => {});
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
}); });
...@@ -31,7 +31,7 @@ describe('Job Log Collapsible Section', () => { ...@@ -31,7 +31,7 @@ describe('Job Log Collapsible Section', () => {
}); });
it('renders clickable header line', () => { it('renders clickable header line', () => {
expect(wrapper.find('.collapsible-line').attributes('role')).toBe('button'); expect(findCollapsibleLine().attributes('role')).toBe('button');
}); });
}); });
...@@ -48,13 +48,13 @@ describe('Job Log Collapsible Section', () => { ...@@ -48,13 +48,13 @@ describe('Job Log Collapsible Section', () => {
}); });
}); });
it('emits handleOnClickCollapsibleLine on click', () => { it('emits onClickCollapsibleLine on click', () => {
createComponent({ createComponent({
section: nestedSectionOpened, section: nestedSectionOpened,
traceEndpoint, traceEndpoint,
}); });
wrapper.find('.collapsible-line').trigger('click'); findCollapsibleLine().trigger('click');
expect(wrapper.emitted('handleOnClickCollapsibleLine').length).toBe(1); expect(wrapper.emitted('onClickCollapsibleLine').length).toBe(1);
}); });
}); });
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