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;
|
describe('savePage method', function() {
|
||||||
savePageDir = path.join(fixtures, 'save_page');
|
const savePageDir = path.join(fixtures, 'save_page');
|
||||||
savePageHtmlPath = path.join(savePageDir, 'save_page.html');
|
const savePageHtmlPath = path.join(savePageDir, 'save_page.html');
|
||||||
savePageJsPath = path.join(savePageDir, 'save_page_files', 'test.js');
|
const savePageJsPath = path.join(savePageDir, 'save_page_files', 'test.js');
|
||||||
savePageCssPath = path.join(savePageDir, 'save_page_files', 'test.css');
|
const savePageCssPath = path.join(savePageDir, 'save_page_files', 'test.css');
|
||||||
return it('should save page', function(done) {
|
|
||||||
w.webContents.on('did-finish-load', function() {
|
after(function() {
|
||||||
return w.webContents.savePage(savePageHtmlPath, 'HTMLComplete', function(error) {
|
try {
|
||||||
assert.equal(error, null);
|
|
||||||
assert(fs.existsSync(savePageHtmlPath));
|
|
||||||
assert(fs.existsSync(savePageJsPath));
|
|
||||||
assert(fs.existsSync(savePageCssPath));
|
|
||||||
fs.unlinkSync(savePageCssPath);
|
fs.unlinkSync(savePageCssPath);
|
||||||
fs.unlinkSync(savePageJsPath);
|
fs.unlinkSync(savePageJsPath);
|
||||||
fs.unlinkSync(savePageHtmlPath);
|
fs.unlinkSync(savePageHtmlPath);
|
||||||
fs.rmdirSync(path.join(savePageDir, 'save_page_files'));
|
fs.rmdirSync(path.join(savePageDir, 'save_page_files'));
|
||||||
fs.rmdirSync(savePageDir);
|
fs.rmdirSync(savePageDir);
|
||||||
return done();
|
} catch (e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should save page to disk', function(done) {
|
||||||
|
w.webContents.on('did-finish-load', function() {
|
||||||
|
w.webContents.savePage(savePageHtmlPath, 'HTMLComplete', function(error) {
|
||||||
|
assert.equal(error, null);
|
||||||
|
assert(fs.existsSync(savePageHtmlPath));
|
||||||
|
assert(fs.existsSync(savePageJsPath));
|
||||||
|
assert(fs.existsSync(savePageCssPath));
|
||||||
|
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() {
|
return it('should create a window with default size (800x600)', function() {
|
||||||
var size;
|
var size;
|
||||||
w.destroy();
|
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>
|
<html>
|
||||||
<script type="text/javascript" src="test.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="test.css"></script>
|
<link href="test.css" rel="stylesheet">
|
||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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