Merge pull request #11863 from electron/move-locale-test
Move locale doc to command line switches
This commit is contained in:
commit
8b9b1e5595
4 changed files with 26 additions and 25 deletions
|
@ -530,12 +530,6 @@ Returns `String` - The current application locale. Possible return values are do
|
||||||
|
|
||||||
**Note:** On Windows you have to call it after the `ready` events gets emitted.
|
**Note:** On Windows you have to call it after the `ready` events gets emitted.
|
||||||
|
|
||||||
### `app.setLocale(locale)`
|
|
||||||
|
|
||||||
* `locale` String
|
|
||||||
|
|
||||||
Set the locale of the app (must be called before the `ready` event).
|
|
||||||
|
|
||||||
### `app.addRecentDocument(path)` _macOS_ _Windows_
|
### `app.addRecentDocument(path)` _macOS_ _Windows_
|
||||||
|
|
||||||
* `path` String
|
* `path` String
|
||||||
|
|
|
@ -28,6 +28,10 @@ Disables the disk cache for HTTP requests.
|
||||||
|
|
||||||
Disable HTTP/2 and SPDY/3.1 protocols.
|
Disable HTTP/2 and SPDY/3.1 protocols.
|
||||||
|
|
||||||
|
## --lang
|
||||||
|
|
||||||
|
Set a custom locale.
|
||||||
|
|
||||||
## --inspect=`port` and --inspect-brk=`port`
|
## --inspect=`port` and --inspect-brk=`port`
|
||||||
|
|
||||||
Debug-related flags, see the [Debugging the Main Process][debugging-main-process] guide for details.
|
Debug-related flags, see the [Debugging the Main Process][debugging-main-process] guide for details.
|
||||||
|
|
|
@ -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()', () => {
|
describe('app.isInApplicationsFolder()', () => {
|
||||||
before(function () {
|
before(function () {
|
||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
|
|
|
@ -4,6 +4,7 @@ const http = require('http')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const ws = require('ws')
|
const ws = require('ws')
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
|
const ChildProcess = require('child_process')
|
||||||
const {ipcRenderer, remote} = require('electron')
|
const {ipcRenderer, remote} = require('electron')
|
||||||
const {closeWindow} = require('./window-helpers')
|
const {closeWindow} = require('./window-helpers')
|
||||||
|
|
||||||
|
@ -26,6 +27,27 @@ describe('chromium feature', () => {
|
||||||
listener = null
|
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 }))
|
afterEach(() => closeWindow(w).then(() => { w = null }))
|
||||||
|
|
||||||
describe('heap snapshot', () => {
|
describe('heap snapshot', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue