diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md index 3b99844675..b002fcc832 100644 --- a/web-wallet/CHANGELOG.md +++ b/web-wallet/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +- Remove "UsageIndicator" component [#3245] + ### Fixed - Fix wrong error shown in the login screen [#3226] [#3097] @@ -466,6 +468,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#3203]: https://github.com/dusk-network/rusk/issues/3203 [#3212]: https://github.com/dusk-network/rusk/issues/3212 [#3226]: https://github.com/dusk-network/rusk/issues/3226 +[#3245]: https://github.com/dusk-network/rusk/issues/3245 diff --git a/web-wallet/src/lib/components/UsageIndicator/UsageIndicator.svelte b/web-wallet/src/lib/components/UsageIndicator/UsageIndicator.svelte deleted file mode 100644 index 99da6c2f78..0000000000 --- a/web-wallet/src/lib/components/UsageIndicator/UsageIndicator.svelte +++ /dev/null @@ -1,79 +0,0 @@ - - - - -
- -
- -
- -
- - diff --git a/web-wallet/src/lib/components/__tests__/UsageIndicator.spec.js b/web-wallet/src/lib/components/__tests__/UsageIndicator.spec.js deleted file mode 100644 index 70c41c7be6..0000000000 --- a/web-wallet/src/lib/components/__tests__/UsageIndicator.spec.js +++ /dev/null @@ -1,53 +0,0 @@ -import { afterEach, describe, expect, it } from "vitest"; -import { cleanup, getAllByRole, render } from "@testing-library/svelte"; - -import { UsageIndicator } from ".."; - -const getPercentages = () => - getAllByRole(document.body, "graphics-symbol").map((el) => - el - .getAttribute("data-tooltip-text") - ?.replace(/^.*?(\d+(\.\d+)?)%.*?$/, "$1") - ); - -describe("UsageIndicator", () => { - const baseProps = { - value: 45, - }; - const baseOptions = { - props: baseProps, - target: document.body, - }; - - afterEach(cleanup); - - it("should render the `UsageIndicator` component and react to value changes", async () => { - const { container, rerender } = render(UsageIndicator, baseOptions); - - expect(getPercentages()).toStrictEqual(["45", "55"]); - expect(container.firstChild).toMatchSnapshot(); - - await rerender({ value: 80 }); - - expect(getPercentages()).toStrictEqual(["80", "20"]); - expect(container.firstChild).toMatchSnapshot(); - }); - - it("should accept additional class names", () => { - const props = { ...baseProps, className: "foo bar" }; - const { container } = render(UsageIndicator, { ...baseOptions, props }); - - expect(container.firstChild).toHaveClass("usage-indicator foo bar"); - }); - - it("should round decimal values at two decimals", async () => { - const props = { ...baseProps, value: 45.7687 }; - const { rerender } = render(UsageIndicator, { ...baseOptions, props }); - - expect(getPercentages()).toStrictEqual(["45.77", "54.23"]); - - await rerender({ value: 0.005 }); - - expect(getPercentages()).toStrictEqual(["0.01", "99.99"]); - }); -}); diff --git a/web-wallet/src/lib/components/__tests__/__snapshots__/UsageIndicator.spec.js.snap b/web-wallet/src/lib/components/__tests__/__snapshots__/UsageIndicator.spec.js.snap deleted file mode 100644 index 414a59a9b8..0000000000 --- a/web-wallet/src/lib/components/__tests__/__snapshots__/UsageIndicator.spec.js.snap +++ /dev/null @@ -1,95 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`UsageIndicator > should render the \`UsageIndicator\` component and react to value changes 1`] = ` -
- - - - - -
- - - - - - -
-`; - -exports[`UsageIndicator > should render the \`UsageIndicator\` component and react to value changes 2`] = ` -
- - - - - -
- - - - - - -
-`; diff --git a/web-wallet/src/lib/components/index.js b/web-wallet/src/lib/components/index.js index 08cd01f4ee..60ea4b7ba7 100644 --- a/web-wallet/src/lib/components/index.js +++ b/web-wallet/src/lib/components/index.js @@ -24,5 +24,4 @@ export { default as Stake } from "./Stake/Stake.svelte"; export { default as StakeMaturityInfo } from "./StakeMaturityInfo/StakeMaturityInfo.svelte"; export { default as SyncBar } from "./SyncBar/SyncBar.svelte"; export { default as Transactions } from "./Transactions/Transactions.svelte"; -export { default as UsageIndicator } from "./UsageIndicator/UsageIndicator.svelte"; export { default as Unstake } from "./Stake/Unstake.svelte"; diff --git a/web-wallet/src/routes/components-showcase/+page.svelte b/web-wallet/src/routes/components-showcase/+page.svelte index 209ad6b58f..508db2c113 100644 --- a/web-wallet/src/routes/components-showcase/+page.svelte +++ b/web-wallet/src/routes/components-showcase/+page.svelte @@ -23,7 +23,6 @@ import Throbbers from "./Throbbers.svelte"; import Toasts from "./Toasts.svelte"; import Tooltips from "./Tooltips.svelte"; - import UsageIndicators from "./UsageIndicators.svelte"; import Wizards from "./Wizards.svelte"; /** @type {Record} */ @@ -48,7 +47,6 @@ Throbbers: Throbbers, Toasts: Toasts, Tooltips: Tooltips, - "Usage Indicators": UsageIndicators, Wizards: Wizards, }; diff --git a/web-wallet/src/routes/components-showcase/UsageIndicators.svelte b/web-wallet/src/routes/components-showcase/UsageIndicators.svelte deleted file mode 100644 index 635a089fcb..0000000000 --- a/web-wallet/src/routes/components-showcase/UsageIndicators.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - - -
-
- -
-