-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: connected value showcase to charts table (#4727)
* enabled dynamic title in value showcase and fixed ordering of age groups
- Loading branch information
1 parent
ad8ad61
commit 5e05a3e
Showing
7 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @name parseChartTitle | ||
* @param string string containing a value to replace | ||
* @param value value to subsititute | ||
* @param pattern search pattern | ||
* @returns string | ||
*/ | ||
export function parseChartTitle( | ||
string: string, | ||
value: string | number, | ||
pattern: string = "${value}" | ||
) { | ||
return string.replace(pattern, `${value}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { describe, expect, test } from "vitest"; | ||
import { parseChartTitle } from "../src/utils/parseChartTitle"; | ||
|
||
describe("parseChartTitle", () => { | ||
test("text is correctly replaces", () => { | ||
const currentTitle = "The current selected value is ${value}."; | ||
const dataValue = 123; | ||
const updatedTitle = parseChartTitle(currentTitle, dataValue, "${value}"); | ||
expect(updatedTitle).toBe("The current selected value is 123."); | ||
}); | ||
}); |