mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fixed Plugin.tags not initialising
If the constructor is passed an object that doesn't have a `tags` key.
This commit is contained in:
@@ -181,7 +181,7 @@
|
||||
this.priority = obj.priority || 0;
|
||||
this.isPriorityGlobal = obj.isPriorityGlobal || false;
|
||||
this._messages = obj.messages || [];
|
||||
this._tags = obj.tags;
|
||||
this._tags = obj.tags || [];
|
||||
this._isDirty = obj.isDirty || false;
|
||||
|
||||
/* UI state variables */
|
||||
|
||||
@@ -183,6 +183,24 @@ describe('Plugin', () => {
|
||||
plugin.isPriorityGlobal.should.be.true();
|
||||
});
|
||||
|
||||
it('should set tags value to an empty array if no key was passed', () => {
|
||||
const plugin = new loot.Plugin({ name: 'test' });
|
||||
|
||||
plugin.tags.length.should.equal(0);
|
||||
});
|
||||
|
||||
it('should set tags to passed key\'s value', () => {
|
||||
const tags = [{
|
||||
name: 'Delev',
|
||||
}];
|
||||
const plugin = new loot.Plugin({
|
||||
name: 'test',
|
||||
tags,
|
||||
});
|
||||
|
||||
plugin.tags.should.deepEqual(tags);
|
||||
});
|
||||
|
||||
it('should set id to the plugins name without spaces', () => {
|
||||
const plugin = new loot.Plugin({ name: 'test plugin name' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user