[45742] Fix missing injection in project time entries

https://community.openproject.com/wp/45742
pull/11904/head
Oliver Günther 2 years ago
parent 2109753ee4
commit f1d590fc6e
  1. 4
      frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.html
  2. 11
      frontend/src/app/shared/components/grids/widgets/time-entries/project/time-entries-project.component.ts
  3. 3
      frontend/src/app/shared/components/time_entries/openproject-time-entries.module.ts
  4. 25
      modules/dashboards/spec/features/time_entries_spec.rb
  5. 6
      spec/features/support/components/time_logging_modal.rb

@ -92,7 +92,9 @@
<td class="buttons">
<a *ngIf="item.entry && item.entry.updateImmediately"
(click)="editTimeEntry(item.entry)"
[title]="text.edit">
[title]="text.edit"
attr.data-qa-selector="edit-time-entry-{{ item.entry.id }}"
>
<op-icon icon-classes="icon-context icon-edit"></op-icon>
</a>
<a *ngIf="item.entry && item.entry.delete"

@ -1,5 +1,8 @@
import {
ChangeDetectorRef, Component, Injector, OnInit,
ChangeDetectorRef,
Component,
Injector,
OnInit,
} from '@angular/core';
import { WidgetTimeEntriesListComponent } from 'core-app/shared/components/grids/widgets/time-entries/list/time-entries-list.component';
import { I18nService } from 'core-app/core/i18n/i18n.service';
@ -8,9 +11,15 @@ import { CurrentProjectService } from 'core-app/core/current-project/current-pro
import { FilterOperator } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { ConfirmDialogService } from 'core-app/shared/components/modals/confirm-dialog/confirm-dialog.service';
import { TimeEntryEditService } from 'core-app/shared/components/time_entries/edit/edit.service';
import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
@Component({
templateUrl: '../list/time-entries-list.component.html',
providers: [
HalResourceEditingService,
TimeEntryEditService,
],
})
export class WidgetTimeEntriesProjectComponent extends WidgetTimeEntriesListComponent implements OnInit {
constructor(readonly injector:Injector,

@ -45,9 +45,6 @@ import { TriggerActionsEntryComponent } from 'core-app/shared/components/time_en
// Editable fields e.g. for modals
OpenprojectFieldsModule,
],
providers: [
TimeEntryEditService,
],
declarations: [
TimeEntryEditModalComponent,
TimeEntryCreateModalComponent,

@ -68,6 +68,8 @@ describe 'Time entries widget on dashboard', type: :feature, js: true, with_mail
let(:role) do
create(:role,
permissions: %i[view_time_entries
view_work_packages
edit_time_entries
view_dashboards
manage_dashboards])
end
@ -81,6 +83,8 @@ describe 'Time entries widget on dashboard', type: :feature, js: true, with_mail
end
end
let(:time_logging_modal) { ::Components::TimeLoggingModal.new }
let(:dashboard) do
Pages::Dashboard.new(project)
end
@ -122,6 +126,27 @@ describe 'Time entries widget on dashboard', type: :feature, js: true, with_mail
.to have_selector('.comments', text: other_visible_time_entry.comments)
expect(page)
.to have_selector('.hours', text: other_visible_time_entry.hours)
# Allows to edit
page.find("[data-qa-selector='edit-time-entry-#{visible_time_entry.id}']").click
end
time_logging_modal.is_visible true
time_logging_modal.expect_work_package work_package.subject
time_logging_modal.update_field 'hours', 4
sleep(0.1)
time_logging_modal.perform_action 'Save'
time_logging_modal.is_visible false
within spent_time_widget.area do
expect(page).to have_selector('.hours', text: 4)
end
visible_time_entry.reload
expect(visible_time_entry.hours).to eq 4.0
end
end

@ -65,6 +65,12 @@ module Components
end
end
def expect_work_package(subject)
within modal_container do
expect(page).to have_selector('.ng-value', text: subject, wait: 10)
end
end
def shows_field(field, visible)
within modal_container do
if visible

Loading…
Cancel
Save