Commit 367c4bf1 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Ezekiel Kigbo

DevOps Adoption tooltip shows incorrect data

parent ec2587c6
...@@ -17,10 +17,10 @@ export default { ...@@ -17,10 +17,10 @@ export default {
required: true, required: true,
}, },
}, },
data() { computed: {
return { tooltipText() {
tooltipText: this.enabled ? trueText : falseText, return this.enabled ? trueText : falseText;
}; },
}, },
}; };
</script> </script>
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DevopsAdoptionTableCellFlag disabled matches the snapshot 1`] = `
<span
class="circle"
/>
`;
exports[`DevopsAdoptionTableCellFlag disabled when the enabled flag is changed to true matches the snapshot 1`] = `
<span
class="circle circle-enabled"
/>
`;
exports[`DevopsAdoptionTableCellFlag enabled matches the snapshot 1`] = `
<span
class="circle circle-enabled"
/>
`;
exports[`DevopsAdoptionTableCellFlag enabled when the enabled flag is changed to false matches the snapshot 1`] = `
<span
class="circle"
/>
`;
...@@ -25,9 +25,8 @@ describe('DevopsAdoptionTableCellFlag', () => { ...@@ -25,9 +25,8 @@ describe('DevopsAdoptionTableCellFlag', () => {
describe('enabled', () => { describe('enabled', () => {
beforeEach(() => createComponent()); beforeEach(() => createComponent());
it('contains the circle-enabled class', () => { it('matches the snapshot', () => {
expect(wrapper.classes()).toContain('circle'); expect(wrapper.element).toMatchSnapshot();
expect(wrapper.classes()).toContain('circle-enabled');
}); });
it('contains a tooltip', () => { it('contains a tooltip', () => {
...@@ -36,14 +35,32 @@ describe('DevopsAdoptionTableCellFlag', () => { ...@@ -36,14 +35,32 @@ describe('DevopsAdoptionTableCellFlag', () => {
expect(tooltip).toBeDefined(); expect(tooltip).toBeDefined();
expect(tooltip.value).toBe('Adopted'); expect(tooltip.value).toBe('Adopted');
}); });
describe('when the enabled flag is changed to false', () => {
beforeEach(async () => {
wrapper.setProps({ enabled: false });
await wrapper.vm.$nextTick();
});
it('matches the snapshot', () => {
expect(wrapper.element).toMatchSnapshot();
});
it('displays the correct tooltip', () => {
const tooltip = getBinding(wrapper.element, 'gl-tooltip');
expect(tooltip).toBeDefined();
expect(tooltip.value).toBe('Not adopted');
});
});
}); });
describe('disabled', () => { describe('disabled', () => {
beforeEach(() => createComponent({ enabled: false })); beforeEach(() => createComponent({ enabled: false }));
it('does not contain the circle-enabled class', () => { it('matches the snapshot', () => {
expect(wrapper.classes()).toContain('circle'); expect(wrapper.element).toMatchSnapshot();
expect(wrapper.classes()).not.toContain('circle-enabled');
}); });
it('contains a tooltip', () => { it('contains a tooltip', () => {
...@@ -52,5 +69,24 @@ describe('DevopsAdoptionTableCellFlag', () => { ...@@ -52,5 +69,24 @@ describe('DevopsAdoptionTableCellFlag', () => {
expect(tooltip).toBeDefined(); expect(tooltip).toBeDefined();
expect(tooltip.value).toBe('Not adopted'); expect(tooltip.value).toBe('Not adopted');
}); });
describe('when the enabled flag is changed to true', () => {
beforeEach(async () => {
wrapper.setProps({ enabled: true });
await wrapper.vm.$nextTick();
});
it('matches the snapshot', () => {
expect(wrapper.element).toMatchSnapshot();
});
it('displays the correct tooltip', () => {
const tooltip = getBinding(wrapper.element, 'gl-tooltip');
expect(tooltip).toBeDefined();
expect(tooltip.value).toBe('Adopted');
});
});
}); });
}); });
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