-
Notifications
You must be signed in to change notification settings - Fork 667
Scheduler - Qunit tests - remove watchers of private methods #32994
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
base: 26_1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -636,15 +636,16 @@ QUnit.module('Options', () => { | |||
| view: 'timelineWeek', | ||||
| }); | ||||
|
|
||||
| const spyAppointmentPopupForm = sinon.spy( | ||||
| scheduler.instance, | ||||
| 'createAppointmentPopupForm' | ||||
| ); | ||||
|
|
||||
| scheduler.instance.option('resources', resources); | ||||
| await waitAsync(10); | ||||
|
|
||||
| assert.ok(spyAppointmentPopupForm.calledOnce, 'Appointment form was recreated'); | ||||
| scheduler.instance.showAppointmentPopup({ | ||||
| startDate: new Date(2017, 11, 18, 10), | ||||
| endDate: new Date(2017, 11, 18, 11), | ||||
| }, true); | ||||
|
|
||||
| const resourceEditor = scheduler.appointmentForm.getEditor('TestResources'); | ||||
| assert.ok(resourceEditor, 'Appointment form contains the resource editor after changing resources'); | ||||
| }); | ||||
|
|
||||
| QUnit.test('Filter options should be updated when dataSource is changed', async function(assert) { | ||||
|
|
@@ -935,16 +936,14 @@ QUnit.module('Options', () => { | |||
| dataSource, | ||||
| }); | ||||
|
|
||||
| const initMarkupSpy = sinon.spy(scheduler.instance, '_initMarkup'); | ||||
| const reloadDataSourceSpy = sinon.spy(scheduler.instance, 'reloadDataSource'); | ||||
| let count = 0; | ||||
| let loadCount = 0; | ||||
|
|
||||
| const nextDataSource = new DataSource({ | ||||
| store: new CustomStore({ | ||||
| load: function() { | ||||
| const d = $.Deferred(); | ||||
| setTimeout(function() { | ||||
| count++; | ||||
| loadCount++; | ||||
| d.resolve([]); | ||||
| }, 100); | ||||
|
|
||||
|
|
@@ -959,10 +958,10 @@ QUnit.module('Options', () => { | |||
| 'views[2].intervalCount': 2, | ||||
| 'views[2].startDate': new Date(), | ||||
| }); | ||||
| await waitForAsync(() => count === 2); | ||||
| await waitForAsync(() => loadCount === 2); | ||||
| await waitAsync(200); | ||||
|
||||
| await waitAsync(200); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -379,16 +379,13 @@ QUnit.module('Integration: Date navigator', moduleConfig, function() { | |
| }); | ||
|
|
||
| QUnit.test('Tasks should be rerendered after click on next/prev button', async function(assert) { | ||
| await this.createInstance({ currentDate: new Date(2015, 1, 24) }); | ||
| const initialDate = new Date(2015, 1, 24); | ||
| await this.createInstance({ currentDate: initialDate }); | ||
|
|
||
| const spy = sinon.spy(this.instance, 'setRemoteFilterIfNeeded'); | ||
| $(this.instance.$element()).find('.dx-scheduler-navigator-previous').trigger('dxclick'); | ||
|
Comment on lines
381
to
+385
|
||
|
|
||
| try { | ||
| $(this.instance.$element()).find('.dx-scheduler-navigator-previous').trigger('dxclick'); | ||
| assert.ok(spy.calledOnce, 'setRemoteFilterIfNeeded is called'); | ||
| } finally { | ||
| this.instance.setRemoteFilterIfNeeded.restore(); | ||
| } | ||
| const currentDate = this.instance.option('currentDate'); | ||
| assert.ok(currentDate < initialDate, 'currentDate changed to an earlier date after clicking previous'); | ||
| }); | ||
|
|
||
| QUnit.test('Tasks should have correct position after click on next/prev button & calendar', async function(assert) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test’s new assertion is satisfied even if the appointment popup form is created lazily only when
showAppointmentPopupis called, so it may not actually validate that the form is recreated in response to theresourcesoption change. To keep the original intent without spying on internals, create/show the popup first (so a form instance exists), then changeresources, then verify via a public signal that the form was rebuilt/updated (e.g., the resource editor appears/updates after the change).