Skip to content

Commit 4d3fddd

Browse files
author
Said Shah
committed
Updated naming for class
1 parent af9b09b commit 4d3fddd

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/molecules/form-fields/password-form-field.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import { render, fireEvent } from "@testing-library/react";
33
import {
44
PasswordFormField,
5-
InvalidInputClassName,
5+
PasswordFormFieldInvalidClassName,
66
} from "./password-form-field";
77
import faker from "faker";
88
import { InputTypes } from "../../atoms/constants/input-types";
@@ -114,7 +114,7 @@ describe("PasswordFormField", () => {
114114
expect(htmlInputElement[0].type).toBe(InputTypes.Password);
115115
});
116116

117-
test(`when isValid prop is false, renders with ${InvalidInputClassName} class name`, () => {
117+
test(`when isValid prop is false, renders with ${PasswordFormFieldInvalidClassName} class name`, () => {
118118
// Arrange
119119
const testLabel = faker.random.words();
120120

@@ -126,7 +126,9 @@ describe("PasswordFormField", () => {
126126
onChange={() => {}}
127127
/>
128128
);
129-
const result = container.getElementsByClassName(InvalidInputClassName);
129+
const result = container.getElementsByClassName(
130+
PasswordFormFieldInvalidClassName
131+
);
130132

131133
// Assert
132134
expect(result).toHaveLength(1);

src/molecules/form-fields/password-form-field.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { StringUtils } from "andculturecode-javascript-core";
99
// -----------------------------------------------------------------------------------------
1010

1111
const COMPONENT_CLASS = "c-form-field";
12-
export const InvalidInputClassName = "-invalid";
12+
export const PasswordFormFieldInvalidClassName = "-invalid";
1313

1414
// #endregion Constants
1515

@@ -51,7 +51,7 @@ const PasswordFormField: React.FC<PasswordFormFields> = (
5151
} = props;
5252

5353
const [isVisible, setIsVisible] = useState<boolean>(false);
54-
const cssIsValid = isValid ? "" : InvalidInputClassName;
54+
const cssIsValid = isValid ? "" : PasswordFormFieldInvalidClassName;
5555
const disableShowHide = StringUtils.isEmpty(value) || disabled;
5656
const fieldId = uuid.v4();
5757
const passwordShowHideLabel = isVisible ? "Hide" : "Show";

0 commit comments

Comments
 (0)