foreman-tasks 13.2.0 → 13.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a192677704918d5f7e81554fb38e70f389a795c021c4889f6f910fa992a1bed7
4
- data.tar.gz: 000732f9d423e0bc8ba6293f7150a631de785535a94d6b5004d40922768897d1
3
+ metadata.gz: 3a911bd4cd6b5bc47ec2aeb30c804aacf1151b9b0deadb3b1c1c9307f93057d1
4
+ data.tar.gz: db6d6432425484dd28740260c4de5e2a45ad16e18a5b1d49969750d6dbfe85e6
5
5
  SHA512:
6
- metadata.gz: d6e131b3624a79ef45aca8c87674938bcc7b2b8c1c0be6652251b6818f0bb1a4ad3843b976d2394901ffe861d7e153fdaeb764c1b44c0cdcbddb46d73d06c6f9
7
- data.tar.gz: 95888cc143cb58b40d0485d6c67f71c95e9e8e88d08f086b31982f9cfc3693aee68cecd885984581e7fb704feee3978d6e601551b6b200413036f6cbfd0c3336
6
+ metadata.gz: 4acd3a055ec83f16c6d4fb22e909d80d3d2a130f7d1d2c57f5d6bbdb76634a6d97cb2d24209b6d540557b93ca0c379869e4d676ffc261cd7ce4c3a6409d3bca4
7
+ data.tar.gz: d86f68e0b10de405487963ff0565456f592ddca298b6b37cb32b1e243245b949b5b9011d46662d8ad0d58f3b54bc714cdef4f22a1f500a805f39ac4db381d76f
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '13.2.0'.freeze
2
+ VERSION = '13.2.1'.freeze
3
3
  end
@@ -79,12 +79,13 @@ MetadataField.defaultProps = {
79
79
  span: undefined,
80
80
  };
81
81
 
82
- const copyableText = text =>
82
+ const copyableText = (text, ouiaId) =>
83
83
  text ? (
84
84
  <ClipboardCopy
85
85
  variant="inline-compact"
86
86
  hoverTip={__('Copy')}
87
87
  clickTip={__('Copied')}
88
+ ouiaId={ouiaId}
88
89
  >
89
90
  {text}
90
91
  </ClipboardCopy>
@@ -161,7 +162,7 @@ const TaskInfo = props => {
161
162
  <MetadataField
162
163
  labelOuiaId="task-info-metadata-id-label"
163
164
  title={__('Id')}
164
- value={copyableText(id)}
165
+ value={copyableText(id, 'task-info-id-copy')}
165
166
  />
166
167
 
167
168
  <GridItem span={12}>
@@ -225,7 +226,7 @@ const TaskInfo = props => {
225
226
  <MetadataField
226
227
  labelOuiaId="task-info-metadata-external-id-label"
227
228
  title={__('External Id')}
228
- value={copyableText(externalId)}
229
+ value={copyableText(externalId, 'task-info-ext-id-copy')}
229
230
  />
230
231
  {help && (
231
232
  <MetadataField
@@ -1,15 +1,56 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
1
+ import React from 'react';
2
+ import {
3
+ render,
4
+ screen,
5
+ fireEvent,
6
+ waitFor,
7
+ within,
8
+ } from '@testing-library/react';
9
+ import '@testing-library/jest-dom';
2
10
 
3
11
  import { TASKS_DASHBOARD_AVAILABLE_TIMES } from '../../TasksDashboardConstants';
4
12
  import TasksTimeRow from './TasksTimeRow';
5
13
 
6
- const fixtures = {
7
- 'render with minimal props': {},
8
- 'render with props': {
9
- time: TASKS_DASHBOARD_AVAILABLE_TIMES.WEEK,
10
- updateTime: jest.fn(),
11
- },
12
- };
14
+ describe('TasksTimeRow', () => {
15
+ it('renders the time label and defaults the dropdown to 24h', () => {
16
+ render(<TasksTimeRow />);
13
17
 
14
- describe('TasksTimeRow', () =>
15
- testComponentSnapshotsWithFixtures(TasksTimeRow, fixtures));
18
+ expect(screen.getByText('With focus on last')).toBeInTheDocument();
19
+ expect(screen.getByRole('button', { name: /24h/i })).toBeInTheDocument();
20
+ });
21
+
22
+ it('renders the dropdown with the provided time selection', () => {
23
+ render(
24
+ <TasksTimeRow
25
+ time={TASKS_DASHBOARD_AVAILABLE_TIMES.WEEK}
26
+ updateTime={jest.fn()}
27
+ />
28
+ );
29
+
30
+ expect(screen.getByText('With focus on last')).toBeInTheDocument();
31
+ expect(screen.getByRole('button', { name: /^week$/i })).toBeInTheDocument();
32
+ });
33
+
34
+ it('calls updateTime when a different time option is selected', async () => {
35
+ const updateTime = jest.fn();
36
+
37
+ render(
38
+ <TasksTimeRow
39
+ time={TASKS_DASHBOARD_AVAILABLE_TIMES.H24}
40
+ updateTime={updateTime}
41
+ />
42
+ );
43
+
44
+ fireEvent.click(screen.getByRole('button', { name: /24h/i }));
45
+
46
+ const menu = await screen.findByRole('menu');
47
+ fireEvent.click(within(menu).getByRole('menuitem', { name: /^12h$/i }));
48
+
49
+ await waitFor(() => {
50
+ expect(updateTime).toHaveBeenCalledTimes(1);
51
+ expect(updateTime).toHaveBeenCalledWith(
52
+ TASKS_DASHBOARD_AVAILABLE_TIMES.H12
53
+ );
54
+ });
55
+ });
56
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.0
4
+ version: 13.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
@@ -436,7 +436,6 @@ files:
436
436
  - webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.js
437
437
  - webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.scss
438
438
  - webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.test.js
439
- - webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/__snapshots__/TasksTimeRow.test.js.snap
440
439
  - webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.js
441
440
  - webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.scss
442
441
  - webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardActions.js
@@ -1,37 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`TasksTimeRow render with minimal props 1`] = `
4
- <div
5
- className="tasks-time-row"
6
- >
7
- <span
8
- className="time-label"
9
- >
10
- With focus on last
11
- </span>
12
- <TimeDropDown
13
- className=""
14
- id="tasks-dashboard-time-period-dropdown"
15
- onChange={[Function]}
16
- selectedTime="H24"
17
- />
18
- </div>
19
- `;
20
-
21
- exports[`TasksTimeRow render with props 1`] = `
22
- <div
23
- className="tasks-time-row"
24
- >
25
- <span
26
- className="time-label"
27
- >
28
- With focus on last
29
- </span>
30
- <TimeDropDown
31
- className=""
32
- id="tasks-dashboard-time-period-dropdown"
33
- onChange={[MockFunction]}
34
- selectedTime="WEEK"
35
- />
36
- </div>
37
- `;