|
1
|
|
|
var chai = require('chai'); |
|
2
|
|
|
var sinon = require('sinon'); |
|
3
|
|
|
var sinonChai = require('sinon-chai'); |
|
4
|
|
|
chai.should(); |
|
5
|
|
|
chai.use(sinonChai); |
|
6
|
|
|
|
|
7
|
|
|
var assert = chai.assert; |
|
8
|
|
|
var expect = chai.expect; |
|
9
|
|
|
var vf = require('../src/scripts/vanillafilter'); |
|
10
|
|
|
|
|
11
|
|
|
describe('VanillaFilter', function() { |
|
12
|
|
|
it('should create a VanillaFilter instance with an "options" property', function() { |
|
13
|
|
|
var VFoptionsObject = new VanillaFilter(); |
|
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
assert.isObject(VFoptionsObject, 'VanillaFilter instance is an object'); |
|
16
|
|
|
assert.isObject(VFoptionsObject.options, 'VanillaFilter.options is an object'); |
|
17
|
|
|
}); |
|
18
|
|
|
|
|
19
|
|
|
it('should have a bind function', function() { |
|
20
|
|
|
var VFbindFn = new VanillaFilter(); |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
assert.isFunction(VFbindFn.bind, 'VanillaFilter.bind exists and is a function'); |
|
23
|
|
|
}); |
|
24
|
|
|
|
|
25
|
|
|
it('should have a triggerFilter function', function() { |
|
26
|
|
|
var VFtriggerFilterFn = new VanillaFilter(); |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
assert.isFunction(VFtriggerFilterFn.triggerFilter, 'VanillaFilter.triggerFilter exists and is a function'); |
|
29
|
|
|
}); |
|
30
|
|
|
|
|
31
|
|
|
it('should override user input options', function() { |
|
32
|
|
|
var VFdefaultOptions = new VanillaFilter(); |
|
|
|
|
|
|
33
|
|
|
var defaultOptions = VFdefaultOptions.options; |
|
34
|
|
|
var VFcustomOptions = new VanillaFilter({ |
|
35
|
|
|
'vanillaDisplayType': 'flex' |
|
36
|
|
|
}); |
|
37
|
|
|
var customOptions = VFcustomOptions.options; |
|
38
|
|
|
|
|
39
|
|
|
expect(defaultOptions).to.not.equal(customOptions); |
|
40
|
|
|
}); |
|
41
|
|
|
|
|
42
|
|
|
|
|
43
|
|
|
}); |
|
44
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.