Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change popup text #3179

Merged
merged 4 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/frontend/src/metric/Metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function MeasurementValue({ metric }) {
if (metric.latest_measurement) {
return (
<Popup trigger={valueText} flowing hoverable>
<TimeAgoWithDate date={metric.latest_measurement.end}>Last measured</TimeAgoWithDate><br />
<TimeAgoWithDate date={metric.latest_measurement.start}>First measured</TimeAgoWithDate>
<TimeAgoWithDate date={metric.latest_measurement.end}>{metric.status ? "Metric was last measured":"Last measurement attempt"}</TimeAgoWithDate><br />
<TimeAgoWithDate date={metric.latest_measurement.start}>{metric.status ? "Value was first measured":"Value unknown since"}</TimeAgoWithDate>
</Popup>
)
}
Expand Down
21 changes: 20 additions & 1 deletion components/frontend/src/metric/Metric.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Table } from 'semantic-ui-react';
import { render, screen } from '@testing-library/react';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { Metric } from './Metric';
import { DataModel } from '../context/DataModel';

Expand Down Expand Up @@ -84,3 +84,22 @@ it('renders the minutes as percentage', () => {
expect(screen.getAllByText(/50% minutes/).length).toBe(1);
expect(screen.getAllByText(/≦ 0% minutes/).length).toBe(1);
});

it('renders correct popups with status', async () => {
render_metric("violations");
fireEvent.mouseOver(screen.getByText(/50 violations/));

await waitFor(() => screen.getByText(/Metric was last measured/))
expect(screen.getAllByText(/Metric was last measured/).length).toBe(1);
expect(screen.getAllByText(/Value was first measured/).length).toBe(1);
});

it('renders correct popups without status', async () => {
report.subjects.subject_uuid.metrics.violations.status = null;
render_metric("violations");
fireEvent.mouseOver(screen.getByText(/50 violations/));

await waitFor(() => screen.getByText(/Last measurement attempt/))
expect(screen.getAllByText(/Last measurement attempt/).length).toBe(1);
expect(screen.getAllByText(/Value unknown since/).length).toBe(1);
});
1 change: 1 addition & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Changed

- Use users' full name instead of their username in the change log so it's easier to see who changed what. Closes [#2930](https://github.com/ICTU/quality-time/issues/2930).
- Improved tooltips for the measurement column in the metrics details table. Closes [#3171](https://github.com/ICTU/quality-time/issues/3171).

### Added

Expand Down