diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a733642..ff545e4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org). +## [3.3.1] - 2021-09-27 +### Added +* *Nothing* + +### Changed +* *Nothing* + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* [#497](https://github.com/shlinkio/shlink-web-client/issues/497) Fixed crash in domains section when one of the domains have more than one dot. + + ## [3.3.0] - 2021-09-25 ### Added * [#465](https://github.com/shlinkio/shlink-web-client/issues/465) Added new page to manage domains and their redirects, when consuming Shlink 2.8 or higher. diff --git a/src/domains/DomainRow.tsx b/src/domains/DomainRow.tsx index 5e5713e9..1ef7046f 100644 --- a/src/domains/DomainRow.tsx +++ b/src/domains/DomainRow.tsx @@ -33,7 +33,7 @@ const DefaultDomain: FC = () => ( export const DomainRow: FC = ({ domain, editDomainRedirects, defaultRedirects }) => { const [ isOpen, toggle ] = useToggle(); const { domain: authority, isDefault, redirects } = domain; - const domainId = `domainEdit${authority.replace('.', '')}`; + const domainId = `domainEdit${authority.replace(/\./g, '')}`; return ( diff --git a/test/domains/DomainRow.test.tsx b/test/domains/DomainRow.test.tsx index 6fdc3923..bd4e9357 100644 --- a/test/domains/DomainRow.test.tsx +++ b/test/domains/DomainRow.test.tsx @@ -17,9 +17,15 @@ describe('', () => { afterEach(() => wrapper?.unmount()); it.each([ - [ Mock.of({ domain: '', isDefault: true }), 1 ], - [ Mock.of({ domain: '', isDefault: false }), 0 ], - ])('shows proper components based on the fact that provided domain is default or not', (domain, expectedComps) => { + [ Mock.of({ domain: '', isDefault: true }), 1, 'domainEdit' ], + [ Mock.of({ domain: '', isDefault: false }), 0, '' ], + [ Mock.of({ domain: 'foo.com', isDefault: true }), 1, 'domainEditfoocom' ], + [ Mock.of({ domain: 'foo.bar.com', isDefault: true }), 1, 'domainEditfoobarcom' ], + ])('shows proper components based on the fact that provided domain is default or not', ( + domain, + expectedComps, + expectedDomainId, + ) => { const wrapper = createWrapper(domain); const defaultDomainComp = wrapper.find('td').first().find('DefaultDomain'); const tooltip = wrapper.find(UncontrolledTooltip); @@ -27,9 +33,13 @@ describe('', () => { const icon = wrapper.find(FontAwesomeIcon); expect(defaultDomainComp).toHaveLength(expectedComps); - expect(tooltip).toHaveLength(expectedComps); expect(button.prop('disabled')).toEqual(domain.isDefault); expect(icon.prop('icon')).toEqual(domain.isDefault ? forbiddenIcon : editIcon); + expect(tooltip).toHaveLength(expectedComps); + + if (expectedComps > 0) { + expect(tooltip.prop('target')).toEqual(expectedDomainId); + } }); it.each([