2016-08-04 17:49:32 +02:00
|
|
|
/* eslint-env qunit */
|
2018-09-28 22:21:18 +02:00
|
|
|
import extend from '../../src/js/extend.js';
|
2015-07-10 20:42:29 +02:00
|
|
|
|
2016-08-04 17:49:32 +02:00
|
|
|
QUnit.module('extend.js');
|
2015-07-10 20:42:29 +02:00
|
|
|
|
2016-08-12 19:51:31 +02:00
|
|
|
QUnit.test('should add implicit parent constructor call', function(assert) {
|
2016-08-04 17:49:32 +02:00
|
|
|
let superCalled = false;
|
|
|
|
const Parent = function() {
|
2015-07-10 20:42:29 +02:00
|
|
|
superCalled = true;
|
|
|
|
};
|
2018-09-28 22:21:18 +02:00
|
|
|
const Child = extend(Parent, {
|
2016-08-04 17:49:32 +02:00
|
|
|
foo: 'bar'
|
2015-07-10 20:42:29 +02:00
|
|
|
});
|
2016-08-04 17:49:32 +02:00
|
|
|
const child = new Child();
|
|
|
|
|
2016-08-12 19:51:31 +02:00
|
|
|
assert.ok(superCalled, 'super constructor called');
|
|
|
|
assert.ok(child.foo, 'child properties set');
|
2015-07-10 20:42:29 +02:00
|
|
|
});
|