Merge pull request #499 from shlinkio/develop

Release 3.3.1
This commit is contained in:
Alejandro Celaya 2021-09-27 22:57:46 +02:00 committed by GitHub
commit a295734c13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 5 deletions

View file

@ -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). 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 ## [3.3.0] - 2021-09-25
### Added ### 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. * [#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.

View file

@ -33,7 +33,7 @@ const DefaultDomain: FC = () => (
export const DomainRow: FC<DomainRowProps> = ({ domain, editDomainRedirects, defaultRedirects }) => { export const DomainRow: FC<DomainRowProps> = ({ domain, editDomainRedirects, defaultRedirects }) => {
const [ isOpen, toggle ] = useToggle(); const [ isOpen, toggle ] = useToggle();
const { domain: authority, isDefault, redirects } = domain; const { domain: authority, isDefault, redirects } = domain;
const domainId = `domainEdit${authority.replace('.', '')}`; const domainId = `domainEdit${authority.replace(/\./g, '')}`;
return ( return (
<tr className="responsive-table__row"> <tr className="responsive-table__row">

View file

@ -17,9 +17,15 @@ describe('<DomainRow />', () => {
afterEach(() => wrapper?.unmount()); afterEach(() => wrapper?.unmount());
it.each([ it.each([
[ Mock.of<ShlinkDomain>({ domain: '', isDefault: true }), 1 ], [ Mock.of<ShlinkDomain>({ domain: '', isDefault: true }), 1, 'domainEdit' ],
[ Mock.of<ShlinkDomain>({ domain: '', isDefault: false }), 0 ], [ Mock.of<ShlinkDomain>({ domain: '', isDefault: false }), 0, '' ],
])('shows proper components based on the fact that provided domain is default or not', (domain, expectedComps) => { [ Mock.of<ShlinkDomain>({ domain: 'foo.com', isDefault: true }), 1, 'domainEditfoocom' ],
[ Mock.of<ShlinkDomain>({ 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 wrapper = createWrapper(domain);
const defaultDomainComp = wrapper.find('td').first().find('DefaultDomain'); const defaultDomainComp = wrapper.find('td').first().find('DefaultDomain');
const tooltip = wrapper.find(UncontrolledTooltip); const tooltip = wrapper.find(UncontrolledTooltip);
@ -27,9 +33,13 @@ describe('<DomainRow />', () => {
const icon = wrapper.find(FontAwesomeIcon); const icon = wrapper.find(FontAwesomeIcon);
expect(defaultDomainComp).toHaveLength(expectedComps); expect(defaultDomainComp).toHaveLength(expectedComps);
expect(tooltip).toHaveLength(expectedComps);
expect(button.prop('disabled')).toEqual(domain.isDefault); expect(button.prop('disabled')).toEqual(domain.isDefault);
expect(icon.prop('icon')).toEqual(domain.isDefault ? forbiddenIcon : editIcon); expect(icon.prop('icon')).toEqual(domain.isDefault ? forbiddenIcon : editIcon);
expect(tooltip).toHaveLength(expectedComps);
if (expectedComps > 0) {
expect(tooltip.prop('target')).toEqual(expectedDomainId);
}
}); });
it.each([ it.each([