This repository has been archived by the owner on Apr 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from shepherdwind/add-ci
test: add ci
- Loading branch information
Showing
5 changed files
with
79 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: node_js | ||
|
||
notifications: | ||
email: | ||
- [email protected] | ||
|
||
node_js: | ||
- '6.11.0' | ||
|
||
install: | ||
- npm install | ||
|
||
script: | ||
- npm run ci |
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,31 @@ | ||
'use strict'; | ||
|
||
test('basic reload', () => { | ||
document.body.innerHTML = ` | ||
<head> | ||
<link href="a.css"> | ||
<link href="b.css"> | ||
<script src="a.js"></script> | ||
</head> | ||
`; | ||
const reload = require('../hotModuleReplacement')(1, { | ||
fileMap: '{fileName}', | ||
}); | ||
const spy = jest.spyOn(EventTarget.prototype, 'addEventListener'); | ||
let cb; | ||
spy.mockImplementation((event, _cb) => { | ||
cb = _cb; | ||
}); | ||
reload(); | ||
expect(spy).toHaveBeenCalled(); | ||
|
||
expect(document.querySelectorAll('link').length === 3); | ||
cb(); | ||
|
||
expect(document.querySelectorAll('link').length === 2); | ||
expect(document.querySelector('link').href.indexOf('?') > -1); | ||
|
||
spy.mockReset(); | ||
spy.mockRestore(); | ||
}); | ||
|
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,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>css hot loader example</title> | ||
|
||
<link rel="stylesheet" href="common.css"> | ||
<link rel="stylesheet" href="output.css"> | ||
</head> | ||
<body> | ||
|
||
<!-- React stuff --> | ||
<div id="root"> hello world</div> | ||
|
||
<script src="common.js"></script> <!-- webpack javascript output --> | ||
<script src="output.js"></script> <!-- webpack javascript output --> | ||
|
||
</body> | ||
</html> | ||
|
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