@transferwise/components 0.0.0-experimental-2d4d50d → 0.0.0-experimental-6dfede3

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": "@transferwise/components",
3
- "version": "0.0.0-experimental-2d4d50d",
3
+ "version": "0.0.0-experimental-6dfede3",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -62,7 +62,7 @@ const DateTrigger = ({
62
62
  <span className="input-group-addon">
63
63
  <CloseButton
64
64
  className={`clear-btn clear-btn--${size}`}
65
- aria-label={formatMessage(messages.ariaLabel)}
65
+ aria-label={`${formatMessage(messages.ariaLabel)} ${label}`}
66
66
  size={Size.SMALL}
67
67
  onClick={(event) => {
68
68
  event.stopPropagation();
@@ -6,10 +6,12 @@ import { fakeKeyDownEventForKey } from '../../common/fakeEvents';
6
6
 
7
7
  import DateTrigger from '.';
8
8
 
9
- const defaultLocale = 'en-GB';
9
+ const locale = 'en-GB';
10
+ const formatMessage = (message) => message.id;
11
+
10
12
  jest.mock('react-intl', () => ({
11
- useIntl: () => ({ locale: defaultLocale, formatMessage: (id) => `${id}` }),
12
- defineMessages: (translations) => translations,
13
+ ...jest.requireActual('react-intl'),
14
+ useIntl: jest.fn(() => ({ locale, formatMessage })),
13
15
  }));
14
16
 
15
17
  jest.mock('@transferwise/formatting', () => ({
@@ -73,6 +75,12 @@ describe('DateTrigger', () => {
73
75
  expect(label().text()).toBe('hello');
74
76
  });
75
77
 
78
+ it('adds label to clear button aria-label', () => {
79
+ const onClear = jest.fn();
80
+ component.setProps({ label: 'hello', onClear });
81
+ expect(clearButton().prop('aria-label')).toBe('neptune.ClearButton.ariaLabel hello');
82
+ });
83
+
76
84
  it('calls on click handler on button click', () => {
77
85
  button().simulate('click');
78
86
  expect(props.onClick).toHaveBeenCalledTimes(1);