Adapt test to new calendar functionality

let widget calendars show weeks again (instead of months)
Avoid notifying about the param change of `cdate` and `cview` because otherwise thequeryparamListener fires and triggers an additional api call (with faulty parameters). The loading works correctly because the calendar triggers the data load on view change itself
pull/9977/head
Henriette Darge 3 years ago
parent f2a93a22b5
commit 90ffcccb38
  1. 5
      frontend/src/app/features/calendar/op-calendar.service.ts
  2. 26
      frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts
  3. 1
      frontend/src/global_styles/vendor/_full_calendar.sass
  4. 21
      modules/calendar/spec/features/calendars_spec.rb
  5. 1
      modules/dashboards/lib/dashboards/engine.rb

@ -28,10 +28,8 @@ import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/q
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { take } from 'rxjs/operators';
import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';
import { QueryFilterInstanceResource } from 'core-app/features/hal/resources/query-filter-instance-resource';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import {
QueryProps,
QueryPropsFilter,
UrlParamsHelperService,
} from 'core-app/features/work-packages/components/wp-query/url-params-helper';
@ -364,6 +362,9 @@ export class OpCalendarService extends UntilDestroyedMixin {
cdate: this.timezoneService.formattedISODate(dates.view.currentStart),
cview: dates.view.type,
},
{
custom: { notify: false },
},
);
}
}

@ -108,7 +108,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement
});
}
this.calendar.updateTimeframe(fetchInfo, this.currentProject.identifier || undefined);
void this.calendar.updateTimeframe(fetchInfo, this.currentProject.identifier || undefined);
}
// eslint-disable-next-line @angular-eslint/use-lifecycle-interface
@ -118,16 +118,22 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement
}
private initializeCalendar() {
const additionalOptions:{ [key:string]:unknown } = {
height: '100%',
headerToolbar: this.buildHeader(),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
events: this.calendarEventsFunction.bind(this),
plugins: [dayGridPlugin],
};
if (this.static) {
additionalOptions.initialView = 'dayGridWeek';
}
void this.configuration.initialized
.then(() => {
this.calendarOptions$.next(
this.calendar.calendarOptions({
height: '100%',
headerToolbar: this.buildHeader(),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
events: this.calendarEventsFunction.bind(this),
plugins: [dayGridPlugin],
}),
this.calendar.calendarOptions(additionalOptions),
);
});
}
@ -174,4 +180,8 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement
return events;
}
private get initialView():string|undefined {
return this.static ? 'dayGridWeek' : undefined;
}
}

@ -35,6 +35,7 @@
&:before,
&:after
padding-right: 4px
pointer-events: none
.fc-event-title-container
margin: 0 16px

@ -66,6 +66,7 @@ describe 'Work package calendars', type: :feature, js: true do
due_date: Date.today.at_beginning_of_month.next_month + 18.days)
end
let(:filters) { ::Components::WorkPackages::Filters.new }
let(:current_wp_split_screen) { Pages::SplitWorkPackage.new(current_work_package, project) }
before do
login_as(user)
@ -78,6 +79,8 @@ describe 'Work package calendars', type: :feature, js: true do
click_link 'Calendar'
end
loading_indicator_saveguard
# should open the calendar with the current month displayed
expect(page)
.to have_selector '.fc-event-title', text: current_work_package.subject
@ -168,30 +171,26 @@ describe 'Work package calendars', type: :feature, js: true do
expect(page)
.to have_no_selector '.fc-event-title', text: another_future_work_package.subject
# click goes to work package show page
# click goes to work package split screen
page.find('.fc-event-title', text: current_work_package.subject).click
expect(page)
.to have_selector('.subject-header', text: current_work_package.subject)
current_wp_split_screen.expect_open
# Going back in browser history will lead us back to the calendar
# Regression #29664
page.go_back
# click goes to work package show page
expect(page)
.to have_selector('.fc-event-title', text: current_work_package.subject, wait: 20)
current_wp_split_screen.expect_closed
# click goes to work package show page again
# click goes to work package split screen page again
page.find('.fc-event-title', text: current_work_package.subject).click
expect(page)
.to have_selector('.subject-header', text: current_work_package.subject)
current_wp_split_screen.expect_open
# click back goes back to calendar
page.find('.work-packages-back-button').click
current_wp_split_screen.close
expect(page)
.to have_selector '.fc-event-title', text: current_work_package.subject, wait: 20
current_wp_split_screen.expect_closed
end
end

@ -14,7 +14,6 @@ module Dashboards
{ controller: '/dashboards/dashboards', action: 'show' },
caption: :'dashboards.label',
after: :work_packages,
before: :calendar,
icon: 'icon2 icon-status',
badge: 'label_menu_badge.alpha')
end

Loading…
Cancel
Save