diff --git a/frontend/packages/akr/package.json b/frontend/packages/akr/package.json index bacbc109a..10bc3f7fb 100644 --- a/frontend/packages/akr/package.json +++ b/frontend/packages/akr/package.json @@ -22,6 +22,6 @@ "akr:tslint": "yarn g:tsc --pretty --noEmit" }, "dependencies": { - "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.4" + "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" } } diff --git a/frontend/packages/otr/package.json b/frontend/packages/otr/package.json index a430d648a..ca59f0200 100644 --- a/frontend/packages/otr/package.json +++ b/frontend/packages/otr/package.json @@ -25,6 +25,6 @@ "otr:tslint": "yarn g:tsc --pretty --noEmit" }, "dependencies": { - "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.4" + "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" } } diff --git a/frontend/packages/shared/CHANGELOG.MD b/frontend/packages/shared/CHANGELOG.MD index 82bdb768e..6c3f99e0b 100644 --- a/frontend/packages/shared/CHANGELOG.MD +++ b/frontend/packages/shared/CHANGELOG.MD @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Released] +## [1.10.5] - 2024-02-28 + +### Fixed + +- ToggleFilterGroup buttons should render zero counts properly + ## [1.10.4] - 2024-01-23 ### Changed diff --git a/frontend/packages/shared/package.json b/frontend/packages/shared/package.json index 1f2840db2..483b74164 100644 --- a/frontend/packages/shared/package.json +++ b/frontend/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@opetushallitus/kieli-ja-kaantajatutkinnot.shared", - "version": "1.10.4", + "version": "1.10.5", "description": "Shared Frontend Package", "exports": { "./components": "./src/components/index.tsx", diff --git a/frontend/packages/shared/src/components/ToggleFilterGroup/ToggleFilterGroup.test.tsx b/frontend/packages/shared/src/components/ToggleFilterGroup/ToggleFilterGroup.test.tsx new file mode 100644 index 000000000..db4284f80 --- /dev/null +++ b/frontend/packages/shared/src/components/ToggleFilterGroup/ToggleFilterGroup.test.tsx @@ -0,0 +1,42 @@ +import renderer from 'react-test-renderer'; + +import { ToggleFilterGroup } from './ToggleFilterGroup'; + +const enum FilterStatusEnum { + Active, + Passive, + Expired, +} +const filterData = [ + { + status: FilterStatusEnum.Active, + label: 'Active', + count: 10, + testId: 'toggleFilter--active', + }, + { + status: FilterStatusEnum.Passive, + label: 'Passive', + count: 0, + }, + { + status: FilterStatusEnum.Expired, + label: 'Expired', + }, +]; + +describe('ToggleFilterGroup', () => { + it('should render correctly', () => { + const tree = renderer + .create( + , + ) + .toJSON(); + + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/frontend/packages/shared/src/components/ToggleFilterGroup/ToggleFilterGroup.tsx b/frontend/packages/shared/src/components/ToggleFilterGroup/ToggleFilterGroup.tsx index 3d118fa3a..1e682c94f 100644 --- a/frontend/packages/shared/src/components/ToggleFilterGroup/ToggleFilterGroup.tsx +++ b/frontend/packages/shared/src/components/ToggleFilterGroup/ToggleFilterGroup.tsx @@ -33,7 +33,7 @@ export function ToggleFilterGroup({ >
{label}
- {count &&
{`(${count})`}
} + {typeof count === "number" && !isNaN(count) &&
{`(${count})`}
}
))} diff --git a/frontend/packages/shared/src/components/ToggleFilterGroup/__snapshots__/ToggleFilterGroup.test.tsx.snap b/frontend/packages/shared/src/components/ToggleFilterGroup/__snapshots__/ToggleFilterGroup.test.tsx.snap new file mode 100644 index 000000000..2e3da577e --- /dev/null +++ b/frontend/packages/shared/src/components/ToggleFilterGroup/__snapshots__/ToggleFilterGroup.test.tsx.snap @@ -0,0 +1,102 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ToggleFilterGroup should render correctly 1`] = ` +
+ + + +
+`; diff --git a/frontend/packages/vkt/package.json b/frontend/packages/vkt/package.json index 0ca8728e6..d21d5afdd 100644 --- a/frontend/packages/vkt/package.json +++ b/frontend/packages/vkt/package.json @@ -26,6 +26,6 @@ }, "dependencies": { "reduxjs-toolkit-persist": "^7.2.1", - "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.4" + "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" } } diff --git a/frontend/packages/yki/package.json b/frontend/packages/yki/package.json index 6fff96e12..464b565b3 100644 --- a/frontend/packages/yki/package.json +++ b/frontend/packages/yki/package.json @@ -26,7 +26,7 @@ "yki:tslint": "yarn g:tsc --pretty --noEmit" }, "dependencies": { - "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.4" + "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" }, "devDependencies": { "multer": "^1.4.5-lts.1" diff --git a/frontend/yarn.lock b/frontend/yarn.lock index b6c8ccd3c..e86ea0f7f 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2586,7 +2586,7 @@ __metadata: version: 0.0.0-use.local resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.akr@workspace:packages/akr" dependencies: - shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.3" + shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" languageName: unknown linkType: soft @@ -2594,7 +2594,7 @@ __metadata: version: 0.0.0-use.local resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.otr@workspace:packages/otr" dependencies: - shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.3" + shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" languageName: unknown linkType: soft @@ -2687,7 +2687,7 @@ __metadata: languageName: unknown linkType: soft -"@opetushallitus/kieli-ja-kaantajatutkinnot.shared@workspace:packages/shared, shared@npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.3": +"@opetushallitus/kieli-ja-kaantajatutkinnot.shared@workspace:packages/shared, shared@npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5": version: 0.0.0-use.local resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.shared@workspace:packages/shared" languageName: unknown @@ -2698,7 +2698,7 @@ __metadata: resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.vkt@workspace:packages/vkt" dependencies: reduxjs-toolkit-persist: "npm:^7.2.1" - shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.3" + shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" languageName: unknown linkType: soft @@ -2707,7 +2707,7 @@ __metadata: resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.yki@workspace:packages/yki" dependencies: multer: "npm:^1.4.5-lts.1" - shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.3" + shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" languageName: unknown linkType: soft