Skip to content

Commit 724eddc

Browse files
author
Julia Volkova
committed
added tests for loadPabel custom options
1 parent 084c6ce commit 724eddc

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

packages/devextreme/testing/tests/DevExpress.ui.widgets/loadPanel.tests.js

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ QUnit.module('options changed callbacks', {
457457
assert.ok(!instance.$content().hasClass(LOADPANEL_PANE_HIDDEN_CLASS));
458458
});
459459

460-
QUnit.test('LoadPanel with custom indicator (deprecated)', function(assert) {
460+
QUnit.test('LoadPanel with custom indicator (deprecated from 25.2)', function(assert) {
461461
const url = '../../testing/content/customLoadIndicator.png';
462462
const instance = this.element
463463
.dxLoadPanel({
@@ -476,39 +476,36 @@ QUnit.module('options changed callbacks', {
476476

477477
QUnit.test('LoadPanel with custom indicator', function(assert) {
478478
const url = '../../testing/content/customLoadIndicator.png';
479+
const customSize = 120;
480+
const indicatorOptions = {
481+
indicatorSrc: url,
482+
animationType: 'sparkle',
483+
height: customSize,
484+
width: customSize,
485+
};
486+
const updatedOptions = {
487+
indicatorSrc: '',
488+
animationType: 'circle',
489+
height: undefined,
490+
width: undefined,
491+
};
479492
const instance = this.element
480493
.dxLoadPanel({
481494
showIndicator: true,
482-
indicatorOptions: {
483-
indicatorSrc: url
484-
},
495+
indicatorOptions,
485496
})
486497
.dxLoadPanel('instance');
487498
instance.show();
488499

489500
const loadIndicatorInstance = this.instance.$content().find('.dx-loadindicator').dxLoadIndicator().dxLoadIndicator('instance');
490501

491-
assert.equal(loadIndicatorInstance.option('indicatorSrc'), url, 'custom indicator option installed successfully');
492-
instance.option('indicatorOptions.indicatorSrc', '');
493-
assert.equal(instance.option('indicatorOptions.indicatorSrc'), loadIndicatorInstance.option('indicatorSrc'), 'custom indicator option changed successfully');
494-
});
495-
496-
QUnit.test('indicatorSrc option change', function(assert) {
497-
const url = '../../testing/content/customLoadIndicator.png';
498-
const instance = this.element
499-
.dxLoadPanel({
500-
showIndicator: true
501-
})
502-
.dxLoadPanel('instance');
503-
instance.show();
504-
505-
instance.option('indicatorOptions.indicatorSrc', url);
506-
507-
const loadIndicatorInstance = this.instance.$content().find('.dx-loadindicator').dxLoadIndicator().dxLoadIndicator('instance');
508-
509-
assert.strictEqual(loadIndicatorInstance.option('indicatorSrc'), url, 'custom indicator option installed successfully');
510-
instance.option('indicatorOptions.indicatorSrc', '');
511-
assert.equal(instance.option('indicatorOptions.indicatorSrc'), loadIndicatorInstance.option('indicatorSrc'), 'custom indicator option changed successfully');
502+
Object.entries(indicatorOptions).forEach(([optionName, value]) => {
503+
assert.strictEqual(loadIndicatorInstance.option(optionName), value, `custom ${optionName} option installed successfully`);
504+
});
505+
Object.entries(updatedOptions).forEach(([optionName, value]) => {
506+
instance.option(`indicatorOptions.${optionName}`, value);
507+
assert.strictEqual(loadIndicatorInstance.option(optionName), value, `custom ${optionName} option changed successfully`);
508+
});
512509
});
513510

514511
QUnit.test('indicatorOptions.indicatorSrc option change when showIndicator is false', function(assert) {

0 commit comments

Comments
 (0)