parent
cf3c23f9e2
commit
df01b54ba6
|
@ -62,4 +62,4 @@ rect.color = "red"
|
|||
Credits
|
||||
-------
|
||||
|
||||
aggregation 2015-2019 by Dr. Ralf S. Engelschall (http://engelschall.com/)
|
||||
thx to aggregation 2015-2019 by Dr. Ralf S. Engelschall (http://engelschall.com/)
|
||||
|
|
10
package.json
10
package.json
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"name": "@uci-utils/class-merge",
|
||||
"version": "1.0.3",
|
||||
"version": "1.1.0",
|
||||
"description": "Function to merge classes when making an extended class",
|
||||
"main": "src/merge.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/mocha -r esm --timeout 30000",
|
||||
"testd": "UCI_ENV=dev ./node_modules/.bin/nodemon --exec './node_modules/.bin/mocha -r esm --timeout 30000' || exit 0"
|
||||
"test": "./node_modules/.bin/mocha --timeout 30000",
|
||||
"testd": "UCI_ENV=dev ./node_modules/.bin/nodemon --exec './node_modules/.bin/mocha --timeout 30000' || exit 0"
|
||||
},
|
||||
"author": "David Kebler",
|
||||
"license": "MIT",
|
||||
|
@ -26,8 +27,7 @@
|
|||
"homepage": "https://github.com/uCOMmandIt/uci-utils/class-merge#readme",
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"chai-eventemitter": "^1.1.1",
|
||||
"esm": "^3.2.25",
|
||||
"chai-eventemitter2": "^0.2.1",
|
||||
"mocha": "^7.0.1",
|
||||
"nodemon": "^2.0.2"
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import merge from '../src/merge.js'
|
||||
import chai, { expect } from 'chai'
|
||||
import eventemitter from 'chai-eventemitter'
|
||||
import eventemitter from 'chai-eventemitter2'
|
||||
import { EventEmitter as Emitter } from 'events'
|
||||
|
||||
chai.use(eventemitter)
|
||||
chai.use(eventemitter())
|
||||
|
||||
|
||||
describe('Class Merge', function () {
|
||||
|
@ -43,14 +43,21 @@ describe('Class Merge', function () {
|
|||
|
||||
})
|
||||
|
||||
it('Should handle more complex mixin', function () {
|
||||
// rect.on('test',(data)=>expect(data).to.be.equal('some data'))
|
||||
// rect.emit('test','some data')
|
||||
expect(function(){ rect.emit('test', 'some data') }).to.emitFrom(rect, 'test', 'some data')
|
||||
it('Should handle more complex mixin, i.e. with eventEmitter', function () {
|
||||
|
||||
expect(rect).to.be.an.eventEmitter
|
||||
expect(rect)
|
||||
.to.emit('foo')
|
||||
.to.emit('bar', {count: 2})
|
||||
.to.emit('baz', {withArgs: ['X', 'Y', 'Z']})
|
||||
.to.emit('error', {count: 0})
|
||||
.on(() =>
|
||||
{
|
||||
rect.emit('foo')
|
||||
rect.emit('bar')
|
||||
rect.emit('bar')
|
||||
rect.emit('baz', 'X', 'Y', 'Z')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
Loading…
Reference in New Issue