@dxc-technology/halstack-react 0.0.0-4fd9593 → 0.0.0-58e75a5
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/dist/new-date/NewDate.js
CHANGED
|
@@ -63,6 +63,8 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
63
63
|
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
64
64
|
_ref$placeholder = _ref.placeholder,
|
|
65
65
|
placeholder = _ref$placeholder === void 0 ? false : _ref$placeholder,
|
|
66
|
+
_ref$clearable = _ref.clearable,
|
|
67
|
+
clearable = _ref$clearable === void 0 ? false : _ref$clearable,
|
|
66
68
|
_ref$disabled = _ref.disabled,
|
|
67
69
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
68
70
|
_ref$optional = _ref.optional,
|
|
@@ -320,6 +322,7 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
320
322
|
helperText: helperText,
|
|
321
323
|
placeholder: placeholder ? format.toUpperCase() : null,
|
|
322
324
|
action: calendarAction,
|
|
325
|
+
clearable: clearable,
|
|
323
326
|
disabled: disabled,
|
|
324
327
|
optional: optional,
|
|
325
328
|
onChange: handleIOnChange,
|
|
@@ -377,6 +380,7 @@ DxcNewDate.propTypes = {
|
|
|
377
380
|
format: _propTypes["default"].string,
|
|
378
381
|
helperText: _propTypes["default"].string,
|
|
379
382
|
placeholder: _propTypes["default"].bool,
|
|
383
|
+
clearable: _propTypes["default"].bool,
|
|
380
384
|
disabled: _propTypes["default"].bool,
|
|
381
385
|
optional: _propTypes["default"].bool,
|
|
382
386
|
onChange: _propTypes["default"].func,
|
|
@@ -86,7 +86,7 @@ function _templateObject11() {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function _templateObject10() {
|
|
89
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 18px;\n width: 18px;\n margin-left: calc(1rem * 0.25);\n pointer-events: none;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
|
|
89
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: calc(1rem * 0.25);\n pointer-events: none;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
|
|
90
90
|
|
|
91
91
|
_templateObject10 = function _templateObject10() {
|
|
92
92
|
return data;
|
package/package.json
CHANGED
package/test/NewDate.test.js
CHANGED
|
@@ -5,16 +5,19 @@ import userEvent from "@testing-library/user-event";
|
|
|
5
5
|
import DxcNewDate from "../src/new-date/NewDate";
|
|
6
6
|
|
|
7
7
|
describe("NewDate component tests", () => {
|
|
8
|
-
test("Renders with correct label, helper text, optional and
|
|
9
|
-
const { getByText, getByRole } = render(
|
|
10
|
-
<DxcNewDate label="Example label" helperText="Example of helper text" placeholder optional />
|
|
8
|
+
test("Renders with correct label, helper text, optional, placeholder and clearable action", () => {
|
|
9
|
+
const { getByText, getByRole, getAllByRole } = render(
|
|
10
|
+
<DxcNewDate label="Example label" helperText="Example of helper text" placeholder optional clearable />
|
|
11
11
|
);
|
|
12
12
|
const input = getByRole("textbox");
|
|
13
|
-
|
|
14
13
|
expect(getByText("Example label")).toBeTruthy();
|
|
15
14
|
expect(getByText("Example of helper text")).toBeTruthy();
|
|
16
15
|
expect(getByText("(Optional)")).toBeTruthy();
|
|
17
16
|
expect(input.getAttribute("placeholder")).toBe("DD-MM-YYYY");
|
|
17
|
+
userEvent.type(input, "10/90/2010");
|
|
18
|
+
const closeAction = getAllByRole("button")[0];
|
|
19
|
+
userEvent.click(closeAction);
|
|
20
|
+
expect(input.value).toBe("");
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
test("Renders with personalized error", () => {
|