Repository navigation
Expand file tree
/
Copy pathui.js
More file actions
99 lines (79 loc) · 2.26 KB
/
Copy pathui.js
File metadata and controls
99 lines (79 loc) · 2.26 KB
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
"use strict";
var browserSync = require("../../../");
var request = require("supertest");
var Immutable = require("immutable");
var assert = require("chai").assert;
describe("Plugins: User interface", function () {
var instance;
before(function (done) {
browserSync.reset();
var config = {
logLevel: "silent",
server: "test/fixtures",
open: false
};
instance = browserSync(config, done).instance;
});
after(function () {
instance.cleanup();
});
it("Should start the UI", function (done) {
request(instance.ui.server)
.get("/")
.expect(200)
.end(done);
});
});
describe("Plugins: User interface", function () {
var instance;
before(function (done) {
browserSync.reset();
var config = {
logLevel: "silent",
server: "test/fixtures",
open: false,
ui: false
};
instance = browserSync(config, done).instance;
});
after(function () {
instance.cleanup();
});
it("Should ignore the UI if false given in options", function (done) {
assert.isUndefined(instance.ui);
assert.isFalse(instance.options.get("ui"));
done();
});
});
describe("Plugins: User interface - providing an override", function () {
var instance;
before(function (done) {
browserSync.reset();
var config = {
logLevel: "silent",
server: "test/fixtures",
open: false
};
browserSync.use({
"plugin:name": "UI",
"plugin": function (opts, bs, cb) {
opts = Immutable.fromJS(opts).mergeDeep(Immutable.fromJS({
urls: {
ui: "http://localhost:3001"
}
}));
cb(null, {
options: opts
});
}
}, {port: 3333});
instance = browserSync(config, done).instance;
});
after(function () {
instance.cleanup();
});
it("Should use the user-provided plugin", function (done) {
assert.deepEqual(instance.ui.options.get("port"), 3333);
done();
});
});