blob: 0c9bdc1848d1f1c4cc731f22d3f780961309bd43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import { rgbFromHex } from '@gitlab/ui/dist/utils/utils';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import ColorItem from '~/vue_shared/components/color_select_dropdown/color_item.vue';
import { color } from './mock_data';
describe('ColorItem', () => {
let wrapper;
const propsData = color;
const createComponent = () => {
wrapper = shallowMountExtended(ColorItem, {
propsData,
});
};
const findColorItem = () => wrapper.findByTestId('color-item');
beforeEach(() => {
createComponent();
});
it('renders the correct title', () => {
expect(wrapper.text()).toBe(propsData.title);
});
it('renders the correct background color for the color item', () => {
const colorAsRGB = rgbFromHex(propsData.color);
expect(findColorItem().attributes('style')).toBe(
`background-color: rgb(${colorAsRGB.join(', ')});`,
);
});
});
|