Moved copy-to-clipboard control next to short URL

This commit is contained in:
Alejandro Celaya
2020-03-06 21:22:07 +01:00
parent 96d538db15
commit fba156b271
8 changed files with 50 additions and 54 deletions

View File

@@ -4,6 +4,7 @@ import moment from 'moment';
import Moment from 'react-moment';
import { assoc, toString } from 'ramda';
import { ExternalLink } from 'react-external-link';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import createShortUrlsRow from '../../../src/short-urls/helpers/ShortUrlsRow';
import Tag from '../../../src/tags/helpers/Tag';
@@ -87,17 +88,17 @@ describe('<ShortUrlsRow />', () => {
});
it('updates state when copied to clipboard', () => {
const col = wrapper.find('td').at(5);
const menu = col.find(ShortUrlsRowMenu);
const col = wrapper.find('td').at(1);
const menu = col.find(CopyToClipboard);
expect(menu).toHaveLength(1);
expect(stateFlagTimeout).not.toHaveBeenCalled();
menu.simulate('copyToClipboard');
menu.simulate('copy');
expect(stateFlagTimeout).toHaveBeenCalledTimes(1);
});
it('shows copy hint when state prop is true', () => {
const isHidden = () => wrapper.find('td').at(5).find('.short-urls-row__copy-hint').prop('hidden');
const isHidden = () => wrapper.find('td').at(1).find('.short-urls-row__copy-hint').prop('hidden');
expect(isHidden()).toEqual(true);
wrapper.setState({ copiedToClipboard: true });

View File

@@ -49,8 +49,8 @@ describe('<ShortUrlsRowMenu />', () => {
const wrapper = createWrapper();
const items = wrapper.find(DropdownItem);
expect(items).toHaveLength(9);
expect(items.find('[divider]')).toHaveLength(2);
expect(items).toHaveLength(7);
expect(items.find('[divider]')).toHaveLength(1);
});
describe('toggles state when toggling modal windows', () => {