2016-08-04 17:49:32 +02:00
|
|
|
/* eslint-env qunit */
|
2015-09-22 17:19:04 +02:00
|
|
|
import extendFn 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;
|
|
|
|
};
|
2016-08-04 17:49:32 +02:00
|
|
|
const Child = extendFn(Parent, {
|
|
|
|
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
|
|
|
});
|