Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add 'single' flag to put Browsersync into SPA mode
- Loading branch information
1 parent
b5cc56e
commit 91480aa
Showing
5 changed files
with
76 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var browserSync = require("../../../"); | ||
|
||
var assert = require("chai").assert; | ||
var sinon = require("sinon"); | ||
var fs = require("fs"); | ||
var request = require("supertest"); | ||
|
||
describe("e2e options test (single)", function() { | ||
it("returns index.html content for a non-existing path", function(done) { | ||
browserSync.reset(); | ||
var config = { | ||
server: { | ||
baseDir: "test/fixtures" | ||
}, | ||
open: false, | ||
logLevel: "silent", | ||
cors: true, | ||
single: true | ||
}; | ||
browserSync(config, function(err, bs) { | ||
request(bs.server) | ||
.get("/a-path-that-deffo-doesnot-exist") | ||
.set('accept', '*/*') | ||
.expect(200) | ||
.end(function(err, res) { | ||
const expected = fs.readFileSync('test/fixtures/index.html', 'utf8'); | ||
assert.equal(res.text, expected); | ||
bs.cleanup(done); | ||
}); | ||
}); | ||
}); | ||
it("returns regular content for matching file path", function(done) { | ||
browserSync.reset(); | ||
var config = { | ||
server: { | ||
baseDir: "test/fixtures" | ||
}, | ||
open: false, | ||
logLevel: "silent", | ||
cors: true, | ||
single: true | ||
}; | ||
browserSync(config, function(err, bs) { | ||
request(bs.server) | ||
.get("/assets/style.css") | ||
.expect(200) | ||
.end(function(err, res) { | ||
const expected = fs.readFileSync('test/fixtures/assets/style.css', 'utf8'); | ||
assert.equal(res.text, expected); | ||
bs.cleanup(done); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters