pebble-web 2.25.2-alpha.2 → 2.25.2-alpha.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.
@@ -57,4 +57,9 @@ export declare function getCalendarTestIds(id: string): {
57
57
  applyButtonId: string;
58
58
  clearButtonId: string;
59
59
  };
60
+ export declare function getPopUpTestIds(id: string): {
61
+ closeButtonId: string;
62
+ approveButtonId: string;
63
+ rejectButtonId: string;
64
+ };
60
65
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pebble-web",
3
- "version": "2.25.2-alpha.2",
3
+ "version": "2.25.2-alpha.3",
4
4
  "author": "ritz078 <rkritesh078@gmail.com>",
5
5
  "license": "MIT",
6
6
  "main": "dist/pebble-web.js",
@@ -9,6 +9,7 @@ import {
9
9
  flexCenter
10
10
  } from "./styles/PopUp.styles";
11
11
  import { PopUpProps } from "./typings/PopUp";
12
+ import { getPopUpTestIds, getTestIds } from "../utils/testIds";
12
13
 
13
14
  const PopUp: React.FunctionComponent<PopUpProps> = props => {
14
15
  const {
@@ -20,8 +21,10 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
20
21
  rejectButtonText = "No",
21
22
  children,
22
23
  approveButtonProps,
23
- rejectButtonProps
24
+ rejectButtonProps,
25
+ testId
24
26
  } = props;
27
+ const {closeButtonId, approveButtonId, rejectButtonId} = getTestIds(testId, id => getPopUpTestIds(id));
25
28
  return (
26
29
  <Modal visible={visible} modalClassName={flexCenter}>
27
30
  <div className={modalContainer}>
@@ -29,6 +32,7 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
29
32
  <i
30
33
  className={cx("pi", "pi-close", iconCloseClassName)}
31
34
  onClick={onClose}
35
+ data-testid={closeButtonId}
32
36
  />
33
37
  )}
34
38
  {children}
@@ -40,6 +44,7 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
40
44
  type="secondary"
41
45
  onClick={onReject}
42
46
  {...rejectButtonProps}
47
+ testId={rejectButtonId}
43
48
  >
44
49
  {rejectButtonText}
45
50
  </Button>
@@ -50,6 +55,7 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
50
55
  type="primary"
51
56
  onClick={onApprove}
52
57
  {...approveButtonProps}
58
+ testId={approveButtonId}
53
59
  >
54
60
  {approveButtonText}
55
61
  </Button>
@@ -9,4 +9,5 @@ export interface PopUpProps {
9
9
  rejectButtonText?: string | Element;
10
10
  approveButtonProps?: Omit<ButtonProps, "children" | "onClick">;
11
11
  rejectButtonProps?: Omit<ButtonProps, "children" | "onClick">;
12
+ testId?: string;
12
13
  }
@@ -109,3 +109,11 @@ export function getCalendarTestIds(id: string){
109
109
  clearButtonId: `${id}-clear-btn`
110
110
  };
111
111
  }
112
+
113
+ export function getPopUpTestIds(id: string){
114
+ return {
115
+ closeButtonId: `${id}-close-btn`,
116
+ approveButtonId: `${id}-approve-btn`,
117
+ rejectButtonId: `${id}-reject-btn`
118
+ };
119
+ }