Skip to content

Commit

Permalink
fix(dayView): fix resizing of events
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Lewis committed Apr 10, 2017
1 parent c19c1eb commit 18b573f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion scss/day-view.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
}

.cal-event {
position: absolute;
border: solid 1px;
padding: 5px;
font-size: 12px;
Expand Down
4 changes: 3 additions & 1 deletion src/components/day/calendarDayView.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ const SEGMENT_HEIGHT: number = 30;
(dragStart)="dragStart(event, dayViewContainer)"
(dragEnd)="eventDragged(dayEvent, $event.y)"
[style.marginTop.px]="dayEvent.top"
[style.height.px]="dayEvent.height">
[style.height.px]="dayEvent.height"
[style.marginLeft.px]="dayEvent.left + 70"
[style.width.px]="dayEvent.width - 1">
<mwl-calendar-day-view-event
[dayEvent]="dayEvent"
[tooltipPlacement]="tooltipPlacement"
Expand Down
2 changes: 0 additions & 2 deletions src/components/day/calendarDayViewEvent.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { DayViewEvent } from 'calendar-utils';
<ng-template #defaultTemplate>
<div
class="cal-event"
[style.marginLeft.px]="dayEvent.left + 70"
[style.width.px]="dayEvent.width - 1"
[style.backgroundColor]="dayEvent.event.color.secondary"
[style.borderColor]="dayEvent.event.color.primary"
[class.cal-starts-within-day]="!dayEvent.startsBeforeDay"
Expand Down
5 changes: 1 addition & 4 deletions test/calendarDayView.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ describe('CalendarDayViewComponent component', () => {
fixture.componentInstance.eventWidth = 300;
fixture.componentInstance.ngOnChanges({viewDate: {}, events: {}, eventWidth: {}});
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.cal-event').style.width).to.equal('299px');
expect(fixture.nativeElement.querySelector('.cal-event-container').style.width).to.equal('299px');
fixture.destroy();
});

Expand Down Expand Up @@ -275,7 +275,6 @@ describe('CalendarDayViewComponent component', () => {
fixture.detectChanges();
document.body.appendChild(fixture.nativeElement);
const event: HTMLElement = fixture.nativeElement.querySelector('.cal-event-container');
event.querySelector('.cal-event')['style'].position = 'inherit'; // hacky fix
const rect: ClientRect = event.getBoundingClientRect();
let resizeEvent: CalendarEventTimesChangedEvent;
fixture.componentInstance.eventTimesChanged.subscribe(event => {
Expand Down Expand Up @@ -313,7 +312,6 @@ describe('CalendarDayViewComponent component', () => {
fixture.detectChanges();
document.body.appendChild(fixture.nativeElement);
const event: HTMLElement = fixture.nativeElement.querySelector('.cal-event-container');
event.querySelector('.cal-event')['style'].position = 'inherit'; // hacky fix
const rect: ClientRect = event.getBoundingClientRect();
let resizeEvent: CalendarEventTimesChangedEvent;
fixture.componentInstance.eventTimesChanged.subscribe(event => {
Expand Down Expand Up @@ -471,7 +469,6 @@ describe('CalendarDayViewComponent component', () => {
fixture.detectChanges();
document.body.appendChild(fixture.nativeElement);
const event: HTMLElement = fixture.nativeElement.querySelector('.cal-event-container');
event.querySelector('.cal-event')['style'].position = 'inherit'; // hacky fix
const rect: ClientRect = event.getBoundingClientRect();
triggerDomEvent('mousedown', document.body, {clientY: rect.top, clientX: rect.left + 10});
fixture.detectChanges();
Expand Down

0 comments on commit 18b573f

Please sign in to comment.