-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathoptions.enabled.js
103 lines (85 loc) · 2.57 KB
/
options.enabled.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'use strict';
var assert = require('assert');
var should = require('should');
var App = require('..');
var app;
describe('.enabled() / .enable()', function () {
beforeEach(function() {
app = new App();
});
describe('.enable()', function () {
it('should set the value to true', function () {
app.enable('foo').should.equal(app);
app.option('foo').should.be.true
});
});
describe('.enabled()', function () {
it('should default to false', function () {
app.enabled('xyz').should.be.false;
});
it('should return true when set', function () {
app.option('a', 'b');
app.enabled('a').should.be.true
});
it('should return true when set', function () {
app.option('a', false);
app.enabled('a').should.be.false;
});
});
describe('.disable()', function () {
it('should set the value to false', function () {
app.disable('foo').should.equal(app);
app.option('foo').should.be.false;
});
});
describe('.disabled()', function () {
it('should default to true', function () {
app.disabled('xyz').should.be.true
});
it('should return false when set', function () {
app.option('abc', 'xyz');
app.disabled('abc').should.be.false;
});
});
describe('.enable/enabled()', function () {
it('should set the value to true', function () {
app.enable('foo');
app.enabled('foo').should.be.true;
});
it('should return `this`', function () {
app.enable('foo').should.equal(app);
});
it('should default to false', function () {
app.enabled('xyz').should.be.false;
});
it('should return true when set', function () {
app.enable('a');
app.enabled('a').should.be.true;
});
it('should return `false` when set to `false` as an option.', function () {
app.option('a', false);
app.enabled('a').should.be.false;
});
it('should return true when set as an option.', function () {
app.option('a', true);
app.enabled('a').should.be.true;
});
});
describe('.disable/disabled()', function () {
it('should set the value to false', function () {
app.disable('foo');
app.disabled('foo').should.be.true;
app.enabled('foo').should.be.false;
});
it('should return `this`', function () {
app.disable('foo').should.eql(app);
});
it('should default to true', function () {
app.disabled('xyz').should.be.true;
});
it('should return false when set', function () {
app.disable('abc');
app.disabled('abc').should.be.true;
});
});
});