mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-20 21:46:20 +00:00
Updated to airbnb coding styles
This commit is contained in:
@@ -6,21 +6,21 @@ import { DropdownBtn, DropdownBtnProps } from '../../src/utils/DropdownBtn';
|
||||
describe('<DropdownBtn />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
const createWrapper = (props: PropsWithChildren<DropdownBtnProps>) => {
|
||||
wrapper = shallow(<DropdownBtn children={'foo'} {...props} />);
|
||||
wrapper = shallow(<DropdownBtn children="foo" {...props} />);
|
||||
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
afterEach(() => wrapper?.unmount());
|
||||
|
||||
it.each([[ 'foo' ], [ 'bar' ], [ 'baz' ]])('displays provided text', (text) => {
|
||||
it.each([['foo'], ['bar'], ['baz']])('displays provided text', (text) => {
|
||||
const wrapper = createWrapper({ text });
|
||||
const toggle = wrapper.find(DropdownToggle);
|
||||
|
||||
expect(toggle.prop('children')).toContain(text);
|
||||
});
|
||||
|
||||
it.each([[ 'foo' ], [ 'bar' ], [ 'baz' ]])('displays provided children', (children) => {
|
||||
it.each([['foo'], ['bar'], ['baz']])('displays provided children', (children) => {
|
||||
const wrapper = createWrapper({ text: '', children });
|
||||
const menu = wrapper.find(DropdownMenu);
|
||||
|
||||
@@ -28,10 +28,10 @@ describe('<DropdownBtn />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ undefined, 'dropdown-btn__toggle btn-block' ],
|
||||
[ '', 'dropdown-btn__toggle btn-block' ],
|
||||
[ 'foo', 'dropdown-btn__toggle btn-block foo' ],
|
||||
[ 'bar', 'dropdown-btn__toggle btn-block bar' ],
|
||||
[undefined, 'dropdown-btn__toggle btn-block'],
|
||||
['', 'dropdown-btn__toggle btn-block'],
|
||||
['foo', 'dropdown-btn__toggle btn-block foo'],
|
||||
['bar', 'dropdown-btn__toggle btn-block bar'],
|
||||
])('includes provided classes', (className, expectedClasses) => {
|
||||
const wrapper = createWrapper({ text: '', className });
|
||||
const toggle = wrapper.find(DropdownToggle);
|
||||
@@ -40,9 +40,9 @@ describe('<DropdownBtn />', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[ 100, { minWidth: '100px' }],
|
||||
[ 250, { minWidth: '250px' }],
|
||||
[ undefined, {}],
|
||||
[100, { minWidth: '100px' }],
|
||||
[250, { minWidth: '250px' }],
|
||||
[undefined, {}],
|
||||
])('renders proper styles when minWidth is provided', (minWidth, expectedStyle) => {
|
||||
const wrapper = createWrapper({ text: '', minWidth });
|
||||
const style = wrapper.find(DropdownMenu).prop('style');
|
||||
|
||||
Reference in New Issue
Block a user