mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-23 00:39:47 +01:00
Remove replaceSpacesInTestId and normalize test id in createAttributesFroTesting
This commit is contained in:
@@ -22,22 +22,18 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
export const isDevBuild = () => (process.env.NODE_ENV === "development")
|
||||
export const isDevBuild = () => process.env.NODE_ENV === "development";
|
||||
|
||||
export const createAttributesForTesting = (testId?: string) => {
|
||||
if (!testId || !isDevBuild()) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
"data-testid": testId
|
||||
}
|
||||
"data-testid": normalizeTestId(testId)
|
||||
};
|
||||
};
|
||||
|
||||
export const replaceSpacesInTestId = (testId?: string) => {
|
||||
if (!testId) {
|
||||
return testId;
|
||||
}
|
||||
|
||||
const normalizeTestId = (testId: string) => {
|
||||
let id = testId;
|
||||
while (id.includes(" ")) {
|
||||
id = id.replace(" ", "-");
|
||||
|
||||
Reference in New Issue
Block a user