@madie/madie-design-system 1.2.46 → 1.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/TextArea/index.jsx +18 -1
- package/components/TextField/index.jsx +20 -1
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +2 -2
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/test/components/TextArea.test.js +24 -0
- package/test/components/TextField.test.js +26 -0
package/package.json
CHANGED
|
@@ -99,4 +99,28 @@ describe("TextArea", () => {
|
|
|
99
99
|
expect(helperText).toBeInTheDocument();
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
|
+
test("TextArea shows maxLength", async () => {
|
|
103
|
+
await act(async () => {
|
|
104
|
+
const { findByTestId, getByTestId, findByText } = render(
|
|
105
|
+
<TextArea
|
|
106
|
+
placeholder="test Name"
|
|
107
|
+
required
|
|
108
|
+
label="test Name"
|
|
109
|
+
id="testName"
|
|
110
|
+
data-testid="test-name-text-field"
|
|
111
|
+
disabled={false}
|
|
112
|
+
maxLength={10}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
expect(
|
|
116
|
+
await findByTestId("test-name-text-field")
|
|
117
|
+
).toBeInTheDocument();
|
|
118
|
+
const textNode = await getByTestId("test-name-text-field");
|
|
119
|
+
expect(textNode).toBeInTheDocument();
|
|
120
|
+
userEvent.type(textNode, "newVal");
|
|
121
|
+
Simulate.change(textNode);
|
|
122
|
+
const maxLength = await findByText("/10 Characters");
|
|
123
|
+
expect(maxLength).toBeInTheDocument();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
102
126
|
});
|
|
@@ -169,4 +169,30 @@ describe("TextField", () => {
|
|
|
169
169
|
expect(textNode.value).toBe("newVal");
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
+
|
|
173
|
+
test("Max Length renders", async () => {
|
|
174
|
+
await act(async () => {
|
|
175
|
+
const { findByTestId, getByTestId, findByText } = render(
|
|
176
|
+
<TextField
|
|
177
|
+
placeholder="test Name"
|
|
178
|
+
required
|
|
179
|
+
label="test Name"
|
|
180
|
+
id="testName"
|
|
181
|
+
inputProps={{ "data-testid": "test-name-input" }}
|
|
182
|
+
data-testid="test-name-text-field"
|
|
183
|
+
size="small"
|
|
184
|
+
maxLength={10}
|
|
185
|
+
/>
|
|
186
|
+
);
|
|
187
|
+
expect(
|
|
188
|
+
await findByTestId("test-name-text-field")
|
|
189
|
+
).toBeInTheDocument();
|
|
190
|
+
const textNode = await getByTestId("test-name-input");
|
|
191
|
+
userEvent.type(textNode, "newVal");
|
|
192
|
+
Simulate.change(textNode);
|
|
193
|
+
expect(textNode.value).toBe("newVal");
|
|
194
|
+
const maxLength = await findByText("/10 Characters");
|
|
195
|
+
expect(maxLength).toBeInTheDocument();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
172
198
|
});
|