Extracted some QR code modal components to external components

This commit is contained in:
Alejandro Celaya
2021-08-16 17:26:54 +02:00
parent 520e52595f
commit 5166340779
4 changed files with 53 additions and 23 deletions

View File

@@ -6,9 +6,10 @@ import createQrCodeModal from '../../../src/short-urls/helpers/QrCodeModal';
import { ShortUrl } from '../../../src/short-urls/data';
import { ReachableServer } from '../../../src/servers/data';
import { CopyToClipboardIcon } from '../../../src/utils/CopyToClipboardIcon';
import { DropdownBtn } from '../../../src/utils/DropdownBtn';
import { SemVer } from '../../../src/utils/helpers/version';
import { ImageDownloader } from '../../../src/common/services/ImageDownloader';
import { QrFormatDropdown } from '../../../src/short-urls/helpers/qr-codes/QrFormatDropdown';
import { QrErrorCorrectionDropdown } from '../../../src/short-urls/helpers/qr-codes/QrErrorCorrectionDropdown';
describe('<QrCodeModal />', () => {
let wrapper: ShallowWrapper;
@@ -95,10 +96,10 @@ describe('<QrCodeModal />', () => {
[ '2.8.0' as SemVer, 2, 'col-md-6' ],
])('shows expected components based on server version', (version, expectedAmountOfDropdowns, expectedRangeClass) => {
const wrapper = createWrapper(version);
const dropdown = wrapper.find(DropdownBtn);
const dropdownsLength = wrapper.find(QrFormatDropdown).length + wrapper.find(QrErrorCorrectionDropdown).length;
const firstCol = wrapper.find(Row).find(FormGroup).first();
expect(dropdown).toHaveLength(expectedAmountOfDropdowns);
expect(dropdownsLength).toEqual(expectedAmountOfDropdowns);
expect(firstCol.prop('className')).toEqual(expectedRangeClass);
});