Skip to content

Commit

Permalink
Scheduler - targetElement parameter of the onAppointmentTooltipShowin…
Browse files Browse the repository at this point in the history
…g event has a value of an unexpected type (T1226514) (DevExpress#27275)
  • Loading branch information
pomahtri authored Apr 29, 2024
1 parent 2596ad1 commit 0d1e1e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 6 additions & 3 deletions js/__internal/scheduler/m_scheduler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import registerComponent from '@js/core/component_registrator';
import config from '@js/core/config';
import devices from '@js/core/devices';
import { getPublicElement } from '@js/core/element';
import type { dxElementWrapper } from '@js/core/renderer';
import $ from '@js/core/renderer';
import { BindableTemplate } from '@js/core/templates/bindable_template';
import { EmptyTemplate } from '@js/core/templates/empty_template';
Expand Down Expand Up @@ -39,6 +41,7 @@ import {
validateDayHours,
} from '@js/renovation/ui/scheduler/view_model/to_test/views/utils/base';
import { custom as customDialog } from '@js/ui/dialog';
import type { AppointmentTooltipShowingEvent } from '@js/ui/scheduler';
import { isMaterial } from '@js/ui/themes';
import errors from '@js/ui/widget/ui.errors';
import Widget from '@js/ui/widget/ui.widget';
Expand Down Expand Up @@ -2405,8 +2408,8 @@ class Scheduler extends Widget<any> {
};
}

showAppointmentTooltipCore(target, data, options?: any) {
const arg = {
showAppointmentTooltipCore(target: dxElementWrapper, data, options?: any) {
const arg: Omit<AppointmentTooltipShowingEvent, 'component' | 'element'> = {
cancel: false,
appointments: data.map((item) => {
const result = {
Expand All @@ -2424,7 +2427,7 @@ class Scheduler extends Widget<any> {

return result;
}),
targetElement: target,
targetElement: getPublicElement(target),
};

this._createActionByOption('onAppointmentTooltipShowing')(arg);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import $ from 'jquery';
import fx from 'animation/fx';
import CustomStore from 'data/custom_store';
import { DataSource } from 'data/data_source/data_source';
Expand Down Expand Up @@ -671,7 +672,7 @@ QUnit.module('Methods', {
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(false);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltipCore('target', [], 'options');
scheduler.instance.showAppointmentTooltipCore($(), [], 'options');

assert.ok(!scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is not called');
assert.ok(scheduler.instance._appointmentTooltip.show.called, 'show tooltip is called');
Expand All @@ -682,7 +683,7 @@ QUnit.module('Methods', {
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(true);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltipCore('target', [], 'options');
scheduler.instance.showAppointmentTooltipCore($(), [], 'options');

assert.ok(scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is called');
assert.ok(!scheduler.instance._appointmentTooltip.show.called, 'show tooltip is not called');
Expand All @@ -693,7 +694,7 @@ QUnit.module('Methods', {
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(false);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltip('appointmentData', 'target', 'currentAppointmentData');
scheduler.instance.showAppointmentTooltip('appointmentData', $(), 'currentAppointmentData');

assert.ok(!scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is not called');
assert.ok(scheduler.instance._appointmentTooltip.show.called, 'show tooltip is called');
Expand All @@ -704,7 +705,7 @@ QUnit.module('Methods', {
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(true);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltip('appointmentData', 'target', 'currentAppointmentData');
scheduler.instance.showAppointmentTooltip('appointmentData', $(), 'currentAppointmentData');

assert.ok(scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is called');
assert.ok(!scheduler.instance._appointmentTooltip.show.called, 'show tooltip is not called');
Expand Down

0 comments on commit 0d1e1e4

Please sign in to comment.