spec: Remove annoying outputs from savePage test
This commit is contained in:
parent
c10c419f1d
commit
60d44b3b04
3 changed files with 26 additions and 18 deletions
|
@ -455,31 +455,39 @@ describe('browser-window module', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
describe('save page', function() {
|
||||
var savePageCssPath, savePageDir, savePageHtmlPath, savePageJsPath;
|
||||
savePageDir = path.join(fixtures, 'save_page');
|
||||
savePageHtmlPath = path.join(savePageDir, 'save_page.html');
|
||||
savePageJsPath = path.join(savePageDir, 'save_page_files', 'test.js');
|
||||
savePageCssPath = path.join(savePageDir, 'save_page_files', 'test.css');
|
||||
return it('should save page', function(done) {
|
||||
|
||||
describe('savePage method', function() {
|
||||
const savePageDir = path.join(fixtures, 'save_page');
|
||||
const savePageHtmlPath = path.join(savePageDir, 'save_page.html');
|
||||
const savePageJsPath = path.join(savePageDir, 'save_page_files', 'test.js');
|
||||
const savePageCssPath = path.join(savePageDir, 'save_page_files', 'test.css');
|
||||
|
||||
after(function() {
|
||||
try {
|
||||
fs.unlinkSync(savePageCssPath);
|
||||
fs.unlinkSync(savePageJsPath);
|
||||
fs.unlinkSync(savePageHtmlPath);
|
||||
fs.rmdirSync(path.join(savePageDir, 'save_page_files'));
|
||||
fs.rmdirSync(savePageDir);
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
|
||||
it('should save page to disk', function(done) {
|
||||
w.webContents.on('did-finish-load', function() {
|
||||
return w.webContents.savePage(savePageHtmlPath, 'HTMLComplete', function(error) {
|
||||
w.webContents.savePage(savePageHtmlPath, 'HTMLComplete', function(error) {
|
||||
assert.equal(error, null);
|
||||
assert(fs.existsSync(savePageHtmlPath));
|
||||
assert(fs.existsSync(savePageJsPath));
|
||||
assert(fs.existsSync(savePageCssPath));
|
||||
fs.unlinkSync(savePageCssPath);
|
||||
fs.unlinkSync(savePageJsPath);
|
||||
fs.unlinkSync(savePageHtmlPath);
|
||||
fs.rmdirSync(path.join(savePageDir, 'save_page_files'));
|
||||
fs.rmdirSync(savePageDir);
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
});
|
||||
return w.loadURL("file://" + fixtures + "/pages/save_page/index.html");
|
||||
w.loadURL("file://" + fixtures + "/pages/save_page/index.html");
|
||||
});
|
||||
});
|
||||
return describe('BrowserWindow options argument is optional', function() {
|
||||
|
||||
describe('BrowserWindow options argument is optional', function() {
|
||||
return it('should create a window with default size (800x600)', function() {
|
||||
var size;
|
||||
w.destroy();
|
||||
|
|
2
spec/fixtures/pages/save_page/index.html
vendored
2
spec/fixtures/pages/save_page/index.html
vendored
|
@ -1,6 +1,6 @@
|
|||
<html>
|
||||
<script type="text/javascript" src="test.js"></script>
|
||||
<script type="text/javascript" src="test.css"></script>
|
||||
<link href="test.css" rel="stylesheet">
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
|
2
spec/fixtures/pages/save_page/test.js
vendored
2
spec/fixtures/pages/save_page/test.js
vendored
|
@ -1 +1 @@
|
|||
console.log('save_page');
|
||||
// do nothing
|
||||
|
|
Loading…
Reference in a new issue