-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(snippet): Allow async attribute to be removed from snippet with s…
…nippetOptions.async = false - fixes #670
- Loading branch information
Shane Osbourne
committed
Jun 17, 2015
1 parent
3503a54
commit c32bec6
Showing
4 changed files
with
40 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<script type='text/javascript' id="__bs_script__">//<![CDATA[ | ||
document.write("<script async src='%script%'><\/script>".replace("HOST", location.hostname)); | ||
//]]></script> | ||
document.write("<script %async%src='%script%'><\/script>".replace("HOST", location.hostname)); | ||
//]]></script> |
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,32 @@ | ||
"use strict"; | ||
|
||
var browserSync = require("../../../"); | ||
|
||
var assert = require("chai").assert; | ||
|
||
describe("E2E script with/without async attribute", function () { | ||
|
||
it("serves with async", function (done) { | ||
browserSync.reset(); | ||
var config = {open: false}; | ||
browserSync(config, function (err, bs) { | ||
assert.include(bs.options.get("snippet"), "async"); | ||
bs.cleanup(); | ||
done(); | ||
}); | ||
}); | ||
it("serves without async", function (done) { | ||
browserSync.reset(); | ||
var config = { | ||
open: false, | ||
snippetOptions: { | ||
async: false | ||
} | ||
}; | ||
browserSync(config, function (err, bs) { | ||
assert.notInclude(bs.options.get("snippet"), "async"); | ||
bs.cleanup(); | ||
done(); | ||
}); | ||
}); | ||
}); |