Commit 7993ea08 authored by Justin Ho's avatar Justin Ho

Use it.each in item_caret_spec.js

parent b46db83c
...@@ -26,25 +26,23 @@ describe('ItemCaret', () => { ...@@ -26,25 +26,23 @@ describe('ItemCaret', () => {
const findGlIcon = () => wrapper.find(GlIcon); const findGlIcon = () => wrapper.find(GlIcon);
describe('template', () => { describe('template', () => {
it('should render component template correctly', () => { it('renders component template correctly', () => {
createComponent(); createComponent();
expect(wrapper.classes()).toContain('folder-caret'); expect(wrapper.classes()).toContain('folder-caret');
expect(findAllGlIcons()).toHaveLength(1); expect(findAllGlIcons()).toHaveLength(1);
}); });
it('should render caret down icon if `isGroupOpen` prop is `true`', () => { it.each`
isGroupOpen | icon
${true} | ${'angle-down'}
${false} | ${'angle-right'}
`('renders "$icon" icon when `isGroupOpen` is $isGroupOpen', ({ isGroupOpen, icon }) => {
createComponent({ createComponent({
isGroupOpen: true, isGroupOpen,
}); });
expect(findGlIcon().props('name')).toBe('angle-down'); expect(findGlIcon().props('name')).toBe(icon);
});
it('should render caret right icon if `isGroupOpen` prop is `false`', () => {
createComponent();
expect(findGlIcon().props('name')).toBe('angle-right');
}); });
}); });
}); });
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