move spec to chromium_spec

This commit is contained in:
Shelley Vohr 2018-02-08 13:00:41 -05:00
parent 1018cdc225
commit e10b5e13e9
No known key found for this signature in database
GPG key ID: F13993A75599653C
2 changed files with 22 additions and 20 deletions

View file

@ -112,25 +112,6 @@ describe('app module', () => {
})
})
describe('app.setLocale()', () => {
const testLocale = (locale, result, done) => {
const appPath = path.join(__dirname, 'fixtures', 'api', 'locale-check')
const electronPath = remote.getGlobal('process').execPath
let output = ''
let appProcess = ChildProcess.spawn(electronPath, [appPath, `--lang=${locale}`])
appProcess.stdout.on('data', (data) => { output += data })
appProcess.stdout.on('end', () => {
output = output.replace(/(\r\n|\n|\r)/gm, '')
assert.equal(output, result)
done()
})
}
it('should set the locale', (done) => testLocale('fr', 'fr', done))
it('should not set an invalid locale', (done) => testLocale('asdfkl', 'en-US', done))
})
describe('app.isInApplicationsFolder()', () => {
before(function () {
if (process.platform !== 'darwin') {

View file

@ -7,7 +7,7 @@ const url = require('url')
const {ipcRenderer, remote} = require('electron')
const {closeWindow} = require('./window-helpers')
const {app, BrowserWindow, ipcMain, protocol, session, webContents} = remote
const {app, BrowserWindow, ipcMain, protocol, session, webContents, ChildProcess} = remote
const isCI = remote.getGlobal('isCi')
@ -26,6 +26,27 @@ describe('chromium feature', () => {
listener = null
})
describe('command line switches', () => {
describe('--lang switch', () => {
const testLocale = (locale, result, done) => {
const appPath = path.join(__dirname, 'fixtures', 'api', 'locale-check')
const electronPath = remote.getGlobal('process').execPath
let output = ''
let appProcess = ChildProcess.spawn(electronPath, [appPath, `--lang=${locale}`])
appProcess.stdout.on('data', (data) => { output += data })
appProcess.stdout.on('end', () => {
output = output.replace(/(\r\n|\n|\r)/gm, '')
assert.equal(output, result)
done()
})
}
it('should set the locale', (done) => testLocale('fr', 'fr', done))
it('should not set an invalid locale', (done) => testLocale('asdfkl', 'en-US', done))
})
})
afterEach(() => closeWindow(w).then(() => { w = null }))
describe('heap snapshot', () => {