|
@@ -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', () => {
|