forked from DevExpress/DevExtreme
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bundled tests for "onInitialized" and "onDisposing" events (DevEx…
…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
1 parent
a73947b
commit 8c06474
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
testing/tests/DevExpress.ui.widgets/init_dispose_widget_bundled_tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); | ||
}); |