@nice-digital/nds-action-banner 4.0.2-alpha.0 → 4.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-digital/nds-action-banner",
3
- "version": "4.0.2-alpha.0",
3
+ "version": "4.0.3",
4
4
  "description": "Action banner component for the NICE Design System",
5
5
  "keywords": [
6
6
  "banner"
@@ -30,8 +30,8 @@
30
30
  "url": "https://github.com/nice-digital/nice-design-system/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@nice-digital/icons": "^6.0.0-alpha.0",
34
- "@nice-digital/nds-core": "^4.0.2-alpha.0",
33
+ "@nice-digital/icons": "^6.0.0",
34
+ "@nice-digital/nds-core": "^4.0.3",
35
35
  "classnames": "^2.3.1"
36
36
  },
37
37
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "@types/node": "^18.11.9",
47
47
  "typescript": "^4.8.4"
48
48
  },
49
- "gitHead": "4e9cad8a2b94cdf4af05b18a6610835883bedf0e"
49
+ "gitHead": "ae51389ba2e51dbe9ee3849e71d44fd567fb2822"
50
50
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const jsx_runtime_1 = require("react/jsx-runtime");
16
- const react_1 = require("@testing-library/react");
17
- const ActionBanner_1 = require("./ActionBanner");
18
- const user_event_1 = __importDefault(require("@testing-library/user-event"));
19
- describe("ActionBanner", () => {
20
- it("should render child text", () => {
21
- const sampleText = "Some sample text";
22
- (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ title: "Title" }, { children: sampleText })));
23
- expect(react_1.screen.getByText(sampleText)).toBeInTheDocument();
24
- });
25
- it("should match snapshot for default action banner", () => {
26
- const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ title: "Some title", cta: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "/test" }, { children: "Some CTA" })) }, { children: "Some body" })));
27
- expect(container).toMatchSnapshot();
28
- });
29
- it("should match snapshot for closeable subtle action banner", () => {
30
- const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ variant: "subtle", title: "Some title", cta: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "/test" }, { children: "Some CTA" })), onClosing: jest.fn() }, { children: "Some body" })));
31
- expect(container).toMatchSnapshot();
32
- });
33
- it("should spread additional props onto the container", () => {
34
- const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ title: "Some title", cta: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "/test" }, { children: "Some CTA" })), "data-track": "test" }, { children: "Some body" })));
35
- expect(container.querySelector("section")).toHaveAttribute("data-track", "test");
36
- });
37
- it("should merge additional classes into the existing classes", () => {
38
- const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ title: "Some title", className: "mt--0" }, { children: "Some body" })));
39
- expect(container.querySelector("section")).toHaveClass("mt--0");
40
- });
41
- it("should not render an empty CTA", () => {
42
- const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ title: "Title" }, { children: "Body" })));
43
- expect(container.querySelector(".action-banner__actions")).toBe(null);
44
- });
45
- it("should hide banner after clicking close button", () => __awaiter(void 0, void 0, void 0, function* () {
46
- const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ title: "Title", onClosing: jest.fn() }, { children: "Body" })));
47
- // First, check for the banner's existence
48
- expect(container.querySelector("section")).toBeInTheDocument();
49
- const button = react_1.screen.getByRole("button");
50
- user_event_1.default.click(button);
51
- // Next, check that the banner has gone
52
- yield (0, react_1.waitFor)(() => {
53
- expect(container.querySelector("section")).toBe(null);
54
- });
55
- }));
56
- it("should call onClosing prop with component instance on close button click", () => __awaiter(void 0, void 0, void 0, function* () {
57
- const onClosing = jest.fn();
58
- const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ActionBanner_1.ActionBanner, Object.assign({ title: "Title", onClosing: onClosing }, { children: "Body" })));
59
- const button = react_1.screen.getByRole("button");
60
- user_event_1.default.click(button);
61
- yield (0, react_1.waitFor)(() => {
62
- expect(onClosing).toHaveBeenCalledTimes(1);
63
- });
64
- }));
65
- });