Compare commits

...
Author SHA1 Message Date
renovate[bot] 41ef4d8bbf chore(deps): update typescript toolchain 2026-11-20 23:28:01 +00:00
ShareVB d07563cf5e fix: update nginx for CVE
Fix #600
2026-11-19 09:59:15 +01:00
ShareVB cf6df4e9f3 ci: fix e2e 2026-11-15 23:06:50 +01:00
JoAdo07 91ee2ab7a8 fix(percentage-calculator): clear the result when an input is cleared
n-input-number emits null when its text is cleared, while the computeds only
treated undefined as a missing value. The arithmetic then coerced null to 0,
so emptying To showed -100 and emptying X showed 0.

The three formulas moved into a service that treats null and undefined alike,
with unit tests for the cleared cases and an e2e case that clears a filled
field.

Fixes #1906
2026-11-15 23:03:42 +01:00
8 changed files with 219 additions and 77 deletions

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ RUN pnpm build \
-exec gzip -9 -n -k {} +
# production stage
FROM nginxinc/nginx-unprivileged:stable-alpine@sha256:f5116ed4606f3eb015dd4a8e28cb9b351476dc0ad4bc6e9f93b19cec130cdf03 AS production-stage
FROM nginx/nginx-unprivileged:alpine AS production-stage
LABEL maintainer="ShareVB <sharevb@gmail.com>" \
org.opencontainers.image.authors="ShareVB <sharevb@gmail.com>"
+96 -54
View File
@@ -1261,7 +1261,7 @@ importers:
version: 4.2.0
vue-tsc:
specifier: ^3.3.10
version: 3.3.10(typescript@6.0.3)
version: 3.3.14(typescript@6.0.3)
vue3-flip-countdown:
specifier: ^0.1.6
version: 0.1.6(typescript@6.0.3)
@@ -1466,7 +1466,7 @@ importers:
version: 4.6.7
node:
specifier: runtime:24.x
version: runtime:24.21.0
version: runtime:24.22.3
oxfmt:
specifier: ^0.57.0
version: 0.57.0(svelte@5.56.4(@typescript-eslint/types@8.62.1))
@@ -5148,16 +5148,24 @@ packages:
'@vitest/utils@4.1.11':
resolution: {integrity: sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==}
'@volar/language-core@2.4.28':
resolution: {integrity: sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==}
'@volar/language-core@2.4.30':
resolution: {integrity: sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw==}
'@volar/source-map@2.4.28':
resolution: {integrity: sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==}
'@volar/typescript@2.4.28':
resolution: {integrity: sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw==}
'@volar/language-service@2.4.30':
resolution: {integrity: sha512-w/xDsASiqC71ggCOm7sTDXDNk/l72XEptodeRC68tgZ0e5QM4hM3zAqBGC7mBctvhrpYwKfMG+t9xcUo2hEFtA==}
peerDependencies:
typescript: '*'
typescript: <7
peerDependenciesMeta:
typescript:
optional: true
'@volar/source-map@2.4.30':
resolution: {integrity: sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg==}
'@volar/typescript@2.4.30':
resolution: {integrity: sha512-/DgA5tgYFPfrLFuSjIMXMGHk1LQv2+P8eny6+BhGNzFJELWIW7UZlc56ZLIRFhLsPpMfIFxM8/HvOPBggrjTZg==}
peerDependencies:
typescript: <7
peerDependenciesMeta:
typescript:
optional: true
@@ -5220,8 +5228,8 @@ packages:
'@vue/devtools-shared@8.1.5':
resolution: {integrity: sha512-mhT4zcPFhF+Xk1O4BfhhrbXzpmfqY03fS6xGpcllbQG7lDjhQf8pQHcTIhqQIYx1hfwtHmk/6jM96ele0UxPqQ==}
'@vue/language-core@3.3.10':
resolution: {integrity: sha512-CR7ByBbgPHqhxrioKPOcZBqttaozzLNwtkCzXQ+uF8gLPHnUe03srPnGpdtHD3zp+bq5iyVkZ1WNx7W564RPwg==}
'@vue/language-core@3.3.14':
resolution: {integrity: sha512-kRB+3hHg0c+BdD1XLAvwjVMQd5pC05zijSlPDRI3ERvC/s04JlRs5upy2KjeMg/9m9oD5zuMVh9yVvkKfZqoJg==}
'@vue/reactivity@3.5.39':
resolution: {integrity: sha512-TpsuBJ9gGlZa5d23XcM2y8EXanz9dZeVDQBXRwzy46ItgvM+rWpzs+UVM0wcRLxGvcav0HE5jz2gNL53xlRAog==}
@@ -9216,7 +9224,7 @@ packages:
resolution: {integrity: sha512-X75ZN8DCLftGM5iKwoYLA3rjnrAEs97MkzvSd4q2746Tgpg8b8XWiBGiBG4ZpgcAqBgtgPHTiAc8ZMCvZuikDw==}
engines: {node: '>=10'}
node@runtime:24.21.0:
node@runtime:24.22.3:
resolution:
type: variations
variants:
@@ -9224,9 +9232,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-rseyRkr7mfB4wZywbSAdVDvTsxHLoHEoK84bF8l+WLs=
integrity: sha256-aT/ojEqF5+Fy7BMvdg5ns5JbLWRCyxyzp0tz/Pgx9wo=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-aix-ppc64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-aix-ppc64.tar.gz
targets:
- cpu: ppc64
os: aix
@@ -9234,9 +9242,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-vtfupTJeEQjzLOUijd1qXw8IpJnuQqp0Qq6lg3AvYFc=
integrity: sha256-/24X1IdLdtJyISuQjMAg1ugV+6Wmx+qqBq3XJYQDB/0=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-darwin-arm64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-darwin-arm64.tar.gz
targets:
- cpu: arm64
os: darwin
@@ -9244,9 +9252,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-FGLLOzBGuBXPjqQ209pFDsGp8R2sflpGsK2lMF1+gJc=
integrity: sha256-l3YUrwUEyBBF5/2FWW28oOX5UblmgVFtra/tzKjER/c=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-darwin-x64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-darwin-x64.tar.gz
targets:
- cpu: x64
os: darwin
@@ -9254,9 +9262,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-ckKCw7Q67JmKqVJzgEZbRdIp4CG1gDX19PYwleq/5dU=
integrity: sha256-JhryryUN/X6fJc8VHRsnE6Ct+PEKmtEWxJR/aGJ6/+g=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-arm64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-arm64.tar.gz
targets:
- cpu: arm64
os: linux
@@ -9264,9 +9272,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-UcXVMGbukpILYXg7A7Buy5nzZhFg97Fcp36EdBFaZ7w=
integrity: sha256-uksmreH3s/W6Z1aFaBXeWONTdGAE5+RsyDgkOmy/Mpk=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-ppc64le.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-ppc64le.tar.gz
targets:
- cpu: ppc64le
os: linux
@@ -9274,9 +9282,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-Xy+jdCLgx13jXBaG/lHXgyTywqj+LMI5pB2cAAop2Tg=
integrity: sha256-2PhDl8FHjA7QwbKTQ2Ju0PXxoJhd8MWXXDDwwDg2Yx8=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-s390x.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-s390x.tar.gz
targets:
- cpu: s390x
os: linux
@@ -9284,9 +9292,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-PWNAX8ZaDS0pdsHwvC/Se7C9ByEkaecFqsPwOuWrTJw=
integrity: sha256-VJm2Y/Yscgk3FdqY9K6m+DQnrYurnPnHXwkk4ORWzhQ=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-x64-musl.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-x64-musl.tar.gz
targets:
- cpu: x64
os: linux
@@ -9295,9 +9303,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-bh24fvWLiBnl1UAu/xU2SRsY7djre+5e94l4duiNxf8=
integrity: sha256-Bh7D4wYhFXBbVrUfqcwzCrUNNLaWk4fU5LGlDGgJrMI=
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-x64.tar.gz
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-x64.tar.gz
targets:
- cpu: x64
os: linux
@@ -9305,10 +9313,10 @@ packages:
archive: zip
bin:
node: node.exe
integrity: sha256-h3mxveHTn41CDjtXqmV7OYka9DTT3kSpGQRM7AZ4WSE=
prefix: node-v24.21.0-win-arm64
integrity: sha256-s8x0opWznU8nMnHpb1jAbdKzV1fKEqvsZMfQWYtDTxQ=
prefix: node-v24.22.3-win-arm64
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-win-arm64.zip
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-win-arm64.zip
targets:
- cpu: arm64
os: win32
@@ -9316,10 +9324,10 @@ packages:
archive: zip
bin:
node: node.exe
integrity: sha256-FY92hbRN5R9sDfHRU1JsvNPhvHOajfxgdyHO913p5UE=
prefix: node-v24.21.0-win-x64
integrity: sha256-5hKvmfYmq0FeoiWva85clx/rRIy1yuJQuxw/pQxffZ8=
prefix: node-v24.22.3-win-x64
type: binary
url: https://nodejs.org/download/release/v24.21.0/node-v24.21.0-win-x64.zip
url: https://nodejs.org/download/release/v24.22.3/node-v24.22.3-win-x64.zip
targets:
- cpu: x64
os: win32
@@ -9327,9 +9335,9 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-MEiwgR4VjKDYZytZyDmGF2PhREkpgNjSmzad/uRXR+Q=
integrity: sha256-JIyWqE9sgzhka5/XO/ElEkZ4+PsI218jAj9GIFXg7tw=
type: binary
url: https://unofficial-builds.nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-arm64-musl.tar.gz
url: https://unofficial-builds.nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-arm64-musl.tar.gz
targets:
- cpu: arm64
os: linux
@@ -9338,14 +9346,14 @@ packages:
archive: tarball
bin:
node: bin/node
integrity: sha256-AacT402pjntNKjGR7nyj+T3QOE0aLvI8N5shYe5uEzo=
integrity: sha256-LbT4pAq+X1tdEZlkIj/tycTHxefGMpAa6GCvUix4RLI=
type: binary
url: https://unofficial-builds.nodejs.org/download/release/v24.21.0/node-v24.21.0-linux-x64-musl.tar.gz
url: https://unofficial-builds.nodejs.org/download/release/v24.22.3/node-v24.22.3-linux-x64-musl.tar.gz
targets:
- cpu: x64
os: linux
libc: musl
version: 24.21.0
version: 24.22.3
hasBin: true
nodemailer@9.0.1:
@@ -11517,6 +11525,19 @@ packages:
peerDependencies:
vue: ^3.0.0
vscode-jsonrpc@10.0.0:
resolution: {integrity: sha512-USSfxg0vDIpTQqlQBGxF3mBARyoS8cU7LHLpbYNh6dOJt32dlskxPWB0Irrh5TllTmyf7oNLAvqDqzklbwwnpA==}
engines: {node: '>=14.17.0'}
vscode-languageserver-protocol@3.18.5:
resolution: {integrity: sha512-FW4fBMzZ99N8xeob4py0l050wgCoRgTpEq5Xcsb9lM1bc29UKGR/wSV+4knaqFxssFHajy7OzNiKP/m3U1ZEuA==}
vscode-languageserver-textdocument@1.0.16:
resolution: {integrity: sha512-qeNEuOi9a3qkqRf7Gfez2WL2VwlBTLCNekHBGO9kxPVUp9XuY15yfTJ9jwvOwKI0I2MhUUfZq95NSp+LK1CLQg==}
vscode-languageserver-types@3.18.5:
resolution: {integrity: sha512-kPd6+JQNz3HMJvjKlqUxERSlZHAntl/aGpsk7ImwIh0ewDKDcjgAEyVSYciPiOJD3ftbK9IrfiqUeTZLSbCizw==}
vscode-uri@3.1.0:
resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==}
@@ -11587,8 +11608,8 @@ packages:
vue-sonner@1.3.2:
resolution: {integrity: sha512-UbZ48E9VIya3ToiRHAZUbodKute/z/M1iT8/3fU8zEbwBRE11AKuHikssv18LMk2gTTr6eMQT4qf6JoLHWuj/A==}
vue-tsc@3.3.10:
resolution: {integrity: sha512-YaDVxcW+CGtaOt3pZahMG5jYPx0hsUTxyEoPOTSMebcGUXP9lIBabQ14vfKMORb2CqqK5CxsNo/d1d+4IQwiKg==}
vue-tsc@3.3.14:
resolution: {integrity: sha512-URAu2H9AuMZMg9GCgnqbaHHHd8pBZRAwNV2e2yYS8VDsoTVXHiOSo663OS6DkEvauQ2yixn5TPFJ9WV9QIspkA==}
hasBin: true
peerDependencies:
typescript: '>=5.0.0'
@@ -15850,15 +15871,25 @@ snapshots:
convert-source-map: 2.0.0
tinyrainbow: 3.1.0
'@volar/language-core@2.4.28':
'@volar/language-core@2.4.30':
dependencies:
'@volar/source-map': 2.4.28
'@volar/source-map': 2.4.30
'@volar/source-map@2.4.28': {}
'@volar/typescript@2.4.28(typescript@6.0.3)':
'@volar/language-service@2.4.30(typescript@6.0.3)':
dependencies:
'@volar/language-core': 2.4.28
'@volar/language-core': 2.4.30
vscode-languageserver-protocol: 3.18.5
vscode-languageserver-textdocument: 1.0.16
vscode-uri: 3.1.0
optionalDependencies:
typescript: 6.0.3
'@volar/source-map@2.4.30': {}
'@volar/typescript@2.4.30(typescript@6.0.3)':
dependencies:
'@volar/language-core': 2.4.30
'@volar/language-service': 2.4.30(typescript@6.0.3)
path-browserify: 1.0.1
vscode-uri: 3.1.0
optionalDependencies:
@@ -15966,9 +15997,9 @@ snapshots:
'@vue/devtools-shared@8.1.5': {}
'@vue/language-core@3.3.10':
'@vue/language-core@3.3.14':
dependencies:
'@volar/language-core': 2.4.28
'@volar/language-core': 2.4.30
'@vue/compiler-dom': 3.5.39
'@vue/shared': 3.5.39
alien-signals: 3.2.1
@@ -20290,7 +20321,7 @@ snapshots:
util: 0.12.5
vm-browserify: 1.1.2
node@runtime:24.21.0: {}
node@runtime:24.22.3: {}
nodemailer@9.0.1: {}
@@ -22795,6 +22826,17 @@ snapshots:
evtd: 0.2.4
vue: 3.5.39(typescript@6.0.3)
vscode-jsonrpc@10.0.0: {}
vscode-languageserver-protocol@3.18.5:
dependencies:
vscode-jsonrpc: 10.0.0
vscode-languageserver-types: 3.18.5
vscode-languageserver-textdocument@1.0.16: {}
vscode-languageserver-types@3.18.5: {}
vscode-uri@3.1.0: {}
vue-color-wheel@0.1.1:
@@ -22878,10 +22920,10 @@ snapshots:
vue-sonner@1.3.2: {}
vue-tsc@3.3.10(typescript@6.0.3):
vue-tsc@3.3.14(typescript@6.0.3):
dependencies:
'@volar/typescript': 2.4.28(typescript@6.0.3)
'@vue/language-core': 3.3.10
'@volar/typescript': 2.4.30(typescript@6.0.3)
'@vue/language-core': 3.3.14
typescript: 6.0.3
vue3-flip-countdown@0.1.6(typescript@6.0.3):
@@ -58,7 +58,7 @@ test.describe('Tool - Paste image', () => {
});
test('Has title', async ({ page }) => {
await expect(page).toHaveTitle('Paste image - Toolbox');
await expect(page).toHaveTitle('Paste Image - IT Tools');
});
test('A pasted image is added to the history and can be downloaded', async ({ page }) => {
@@ -33,4 +33,22 @@ test.describe('Tool - Percentage calculator', () => {
await page.getByTestId('numberFrom').locator('input').pressSequentially('123\n');
await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue('');
});
test('Displays empty results after an input is cleared', async ({ page }) => {
await page.getByTestId('percentageX').locator('input').pressSequentially('40\n');
await page.getByTestId('percentageY').locator('input').pressSequentially('50\n');
await expect(page.getByTestId('percentageResult').locator('input')).toHaveValue('20');
await page.getByTestId('numberFrom').locator('input').pressSequentially('40\n');
await page.getByTestId('numberTo').locator('input').pressSequentially('46\n');
await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue('15');
await page.getByTestId('percentageY').locator('input').clear();
await page.getByTestId('numberTo').locator('input').clear();
await page.getByTestId('percentageX').locator('input').clear();
await page.getByTestId('numberFrom').locator('input').clear();
await expect(page.getByTestId('percentageResult').locator('input')).toHaveValue('');
await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue('');
});
});
@@ -0,0 +1,58 @@
import { describe, expect, it } from 'vitest';
import {
computeIsWhatPercentOf,
computePercentageIncreaseDecrease,
computePercentageOf,
} from './percentage-calculator.service';
describe('percentage-calculator', () => {
describe('computePercentageOf', () => {
it('computes a percentage of a value', () => {
expect(computePercentageOf(123, 456)).toBe('560.88');
expect(computePercentageOf(0, 200)).toBe('0');
});
it('returns an empty result when an input is missing', () => {
expect(computePercentageOf(undefined, 200)).toBe('');
expect(computePercentageOf(200, undefined)).toBe('');
expect(computePercentageOf(null, 200)).toBe('');
expect(computePercentageOf(200, null)).toBe('');
});
});
describe('computeIsWhatPercentOf', () => {
it('computes what percent x is of y', () => {
expect(computeIsWhatPercentOf(123, 456)).toBe('26.973684210526315');
});
it('returns an empty result when an input is missing', () => {
expect(computeIsWhatPercentOf(undefined, 12)).toBe('');
expect(computeIsWhatPercentOf(12, undefined)).toBe('');
expect(computeIsWhatPercentOf(null, 12)).toBe('');
expect(computeIsWhatPercentOf(12, null)).toBe('');
});
it('returns an empty result when the divisor is zero', () => {
expect(computeIsWhatPercentOf(12, 0)).toBe('');
});
});
describe('computePercentageIncreaseDecrease', () => {
it('computes the increase and the decrease', () => {
expect(computePercentageIncreaseDecrease(123, 456)).toBe('270.7317073170732');
expect(computePercentageIncreaseDecrease(40, 46)).toBe('15');
expect(computePercentageIncreaseDecrease(46, 40)).toBe('-13.043478260869565');
});
it('returns an empty result when an input is missing', () => {
expect(computePercentageIncreaseDecrease(undefined, 46)).toBe('');
expect(computePercentageIncreaseDecrease(40, undefined)).toBe('');
expect(computePercentageIncreaseDecrease(null, 46)).toBe('');
expect(computePercentageIncreaseDecrease(40, null)).toBe('');
});
it('returns an empty result when the reference value is zero', () => {
expect(computePercentageIncreaseDecrease(0, 46)).toBe('');
});
});
});
@@ -0,0 +1,35 @@
export type PercentageInput = number | null | undefined;
export { computePercentageOf, computeIsWhatPercentOf, computePercentageIncreaseDecrease };
function isMissing(value: PercentageInput): value is null | undefined {
return value === null || value === undefined;
}
function formatFinite(value: number): string {
return Number.isFinite(value) ? value.toString() : '';
}
function computePercentageOf(x: PercentageInput, y: PercentageInput): string {
if (isMissing(x) || isMissing(y)) {
return '';
}
return formatFinite((x / 100) * y);
}
function computeIsWhatPercentOf(x: PercentageInput, y: PercentageInput): string {
if (isMissing(x) || isMissing(y)) {
return '';
}
return formatFinite((100 * x) / y);
}
function computePercentageIncreaseDecrease(from: PercentageInput, to: PercentageInput): string {
if (isMissing(from) || isMissing(to)) {
return '';
}
return formatFinite(((to - from) / from) * 100);
}
@@ -1,35 +1,24 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import {
computeIsWhatPercentOf,
computePercentageIncreaseDecrease,
computePercentageOf,
} from './percentage-calculator.service';
const { t } = useI18n();
const percentageX = ref();
const percentageY = ref();
const percentageResult = computed(() => {
if (percentageX.value === undefined || percentageY.value === undefined) {
return '';
}
return ((percentageX.value / 100) * percentageY.value).toString();
});
const percentageResult = computed(() => computePercentageOf(percentageX.value, percentageY.value));
const numberX = ref();
const numberY = ref();
const numberResult = computed(() => {
if (numberX.value === undefined || numberY.value === undefined) {
return '';
}
const result = (100 * numberX.value) / numberY.value;
return !Number.isFinite(result) || Number.isNaN(result) ? '' : result.toString();
});
const numberResult = computed(() => computeIsWhatPercentOf(numberX.value, numberY.value));
const numberFrom = ref();
const numberTo = ref();
const percentageIncreaseDecrease = computed(() => {
if (numberFrom.value === undefined || numberTo.value === undefined) {
return '';
}
const result = ((numberTo.value - numberFrom.value) / numberFrom.value) * 100;
return !Number.isFinite(result) || Number.isNaN(result) ? '' : result.toString();
});
const percentageIncreaseDecrease = computed(() => computePercentageIncreaseDecrease(numberFrom.value, numberTo.value));
</script>
<template>
@@ -32,7 +32,7 @@ test.describe('Tool - Whitespace cleaner', () => {
});
test('Has correct title', async ({ page }) => {
await expect(page).toHaveTitle('Whitespace cleaner - Toolbox');
await expect(page).toHaveTitle('Whitespace Cleaner - IT Tools');
});
test('U1 updates the output on input with no button press', async ({ page }) => {