Commit add58701 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Andrew Fontaine

Add DevopsAdoptionTableCellFlag component

This component is needed in order to display
the adoption status of an item, i.e.
true or false
parent b379a7cb
<script>
export default {
name: 'DevopsAdoptionTableCellFlag',
props: {
enabled: {
type: Boolean,
required: true,
},
},
};
</script>
<template>
<span class="circle" :class="{ 'circle-enabled': enabled }"></span>
</template>
@import '../../../../../app/assets/stylesheets/page_bundles/dev_ops_report';
.circle {
width: $gl-spacing-scale-3;
height: $gl-spacing-scale-3;
border: 1px solid var(--gray-300, $gray-300);
border-radius: $avatar-radius;
@include gl-display-inline-block;
&-enabled {
border: 1px solid var(--indigo-800, $indigo-800);
background-color: var(--indigo-600, $indigo-600);
}
}
import { shallowMount } from '@vue/test-utils';
import DevopsAdoptionTableCellFlag from 'ee/admin/dev_ops_report/components/devops_adoption_table_cell_flag.vue';
describe('DevopsAdoptionTableCellFlag', () => {
let wrapper;
const createComponent = props => {
wrapper = shallowMount(DevopsAdoptionTableCellFlag, {
propsData: {
enabled: true,
...props,
},
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
it('contains the circle-enabled class when enabled', () => {
createComponent();
expect(wrapper.classes()).toContain('circle');
expect(wrapper.classes()).toContain('circle-enabled');
});
it('does not contain the circle-enabled class when disabled', () => {
createComponent({ enabled: false });
expect(wrapper.classes()).toContain('circle');
expect(wrapper.classes()).not.toContain('circle-enabled');
});
});
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