From 05bcda5eabd24792bdcd7b3c09b02c0ceaa5e7e1 Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Sat, 21 May 2016 20:57:59 +0900 Subject: [PATCH] Test actual behavior for Hide Menu Bar --- test/modules/environment.js | 8 +++++ test/specs/browser/settings_test.js | 49 +++++++++++++++-------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/test/modules/environment.js b/test/modules/environment.js index e5dd654d..ec7bcd55 100644 --- a/test/modules/environment.js +++ b/test/modules/environment.js @@ -25,5 +25,13 @@ module.exports = { path: electron_binary_path, args: [`${path.join(source_root_dir, 'dist')}`, '--config-file=' + config_file_path] }); + }, + shouldTestForPlatforms: function(testCase, platforms) { + if (platforms.indexOf(process.platform) !== -1) { + return; + } + else { + testCase.skip(); + } } } diff --git a/test/specs/browser/settings_test.js b/test/specs/browser/settings_test.js index 8ff90853..e0877669 100644 --- a/test/specs/browser/settings_test.js +++ b/test/specs/browser/settings_test.js @@ -87,35 +87,36 @@ describe('browser/settings.html', function() { }); }); - if (process.platform === 'win32' || process.platform === 'linux') { - [true, false].forEach(function(v) { - it(`should be loaded from config: ${v}`, function() { - var new_config = {}; - Object.assign(new_config, config); - new_config.hideMenuBar = v; - fs.writeFileSync(env.configFilePath, JSON.stringify(new_config)); - return this.app.start().then(() => { - initClient(this.app.client) - .isSelected('#inputHideMenuBar input').then(function(value) { - value.should.equal(v); - }); - }); - }); - }); - - it('should be saved as config.json', function() { + [true, false].forEach(function(v) { + it(`should be loaded from config: ${v}`, function() { + env.shouldTestForPlatforms(this, ['win32', 'linux']); + var new_config = {}; + Object.assign(new_config, config); + new_config.hideMenuBar = v; + fs.writeFileSync(env.configFilePath, JSON.stringify(new_config)); return this.app.start().then(() => { initClient(this.app.client) - .click('#inputHideMenuBar input') - .click('#btnSave') - .pause(1000) - .then(function() { - const saved_config = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - saved_config.hideMenuBar.should.be.true(); + .isSelected('#inputHideMenuBar input').then(function(value) { + value.should.equal(v); + this.app.browserWindow.isMenuBarAutoHide().should.equal(v); }); }); }); - } + }); + + it('should be saved as config.json', function() { + env.shouldTestForPlatforms(this, ['win32', 'linux']); + return this.app.start().then(() => { + initClient(this.app.client) + .click('#inputHideMenuBar input') + .click('#btnSave') + .pause(1000) + .then(function() { + const saved_config = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + saved_config.hideMenuBar.should.be.true(); + }); + }); + }); }); }); });