Skip to content

Commit

Permalink
Add bundled tests for "onInitialized" and "onDisposing" events (DevEx…
Browse files Browse the repository at this point in the history
…press#11762)

* Add bundled tests for "onInitialized" and "onDisposing" events

* add LayoutManager to tests

Co-authored-by: AlekseyMartynov <AlekseyMartynov@users.noreply.github.com>
  • Loading branch information
2 people authored and levkovskiy.dmitry committed Jan 30, 2020
1 parent a73947b commit 8c06474
Showing 1 changed file with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import GoogleStaticProvider from 'ui/map/provider.google_static';
import fx from 'animation/fx';
import { each } from 'core/utils/iterator';
import 'bundles/modules/parts/widgets-all';

const { module: testModule, test } = QUnit;

testModule('Init and dispose', {
before: function() {
this.element = document.createElement('div');
document.getElementById('qunit-fixture').appendChild(this.element);
},
after: function() {
this.element.remove();
}
}, function() {
fx.off = true;
GoogleStaticProvider.remapConstant('/mapURL?');

const getOptions = function(componentName, assert, done) {
const options = {
onInitialized: () => {
assert.ok(true, `${componentName} initialized`);
},
onDisposing: () => {
assert.ok(true, `${componentName} disposed`);
done();
}
};

switch(componentName) {
case 'dxValidator':
options.adapter = {};
break;
case 'dxMap':
options.provider = 'googleStatic';
break;
}

return options;
};

each(DevExpress.ui, function(componentName, componentConstructor) {
if(componentName.indexOf('dx') !== 0) {
return;
}

test(componentName, function(assert) {
assert.expect(2);
const done = assert.async();
const instance = new componentConstructor(this.element, getOptions(componentName, assert, done));
instance.dispose();
});
});
});

0 comments on commit 8c06474

Please sign in to comment.