Browse Source

move spec to chromium_spec

Shelley Vohr 7 years ago
parent
commit
e10b5e13e9
2 changed files with 22 additions and 20 deletions
  1. 0 19
      spec/api-app-spec.js
  2. 22 1
      spec/chromium-spec.js

+ 0 - 19
spec/api-app-spec.js

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

+ 22 - 1
spec/chromium-spec.js

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