diff --git a/src/short-urls/ShortUrlsList.js b/src/short-urls/ShortUrlsList.js index 945923a1..9ebeb2d0 100644 --- a/src/short-urls/ShortUrlsList.js +++ b/src/short-urls/ShortUrlsList.js @@ -115,23 +115,17 @@ export class ShortUrlsListComponent extends React.Component { )); } - renderMobileOrderingControls() { - return ( -
- -
- ); - } - render() { return ( - {this.renderMobileOrderingControls()} +
+ +
diff --git a/src/tags/TagCard.js b/src/tags/TagCard.js index 8121e570..538a86ac 100644 --- a/src/tags/TagCard.js +++ b/src/tags/TagCard.js @@ -28,36 +28,20 @@ export default class TagCard extends React.Component { return ( - -
- - {tag} - + {tag}
- - + +
); } diff --git a/test/tags/TagCard.test.js b/test/tags/TagCard.test.js new file mode 100644 index 00000000..a905b07e --- /dev/null +++ b/test/tags/TagCard.test.js @@ -0,0 +1,46 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { Link } from 'react-router-dom'; +import TagCard from '../../src/tags/TagCard'; +import TagBullet from '../../src/tags/helpers/TagBullet'; + +describe('', () => { + let wrapper; + + beforeEach(() => { + wrapper = shallow(); + }); + afterEach(() => wrapper.unmount()); + + it('shows a TagBullet and a link to the list filtering by the tag', () => { + const link = wrapper.find(Link); + const bullet = wrapper.find(TagBullet); + + expect(link.prop('to')).toEqual('/server/1/list-short-urls/1?tag=ssr'); + expect(bullet.prop('tag')).toEqual('ssr'); + }); + + it('displays delete modal when delete btn is clicked', (done) => { + const delBtn = wrapper.find('.tag-card__btn').at(0); + + expect(wrapper.state('isDeleteModalOpen')).toEqual(false); + delBtn.simulate('click'); + + setImmediate(() => { + expect(wrapper.state('isDeleteModalOpen')).toEqual(true); + done(); + }); + }); + + it('displays edit modal when edit btn is clicked', (done) => { + const editBtn = wrapper.find('.tag-card__btn').at(1); + + expect(wrapper.state('isEditModalOpen')).toEqual(false); + editBtn.simulate('click'); + + setImmediate(() => { + expect(wrapper.state('isEditModalOpen')).toEqual(true); + done(); + }); + }); +});