-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
152 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"verbose": true, | ||
"testRegex": "(/__tests__/.*|(\\.|/)spec)\\.jsx?$", | ||
"setupFiles": ["<rootDir>/test/setup.js"], | ||
"modulePaths": [ | ||
"<rootDir>/app", | ||
"<rootDir>/app/actions", | ||
"<rootDir>/app/api", | ||
"<rootDir>/app/components", | ||
"<rootDir>/app/containers", | ||
"<rootDir>/app/reducers", | ||
"<rootDir>/app/selectors", | ||
"<rootDir>/app/static", | ||
"<rootDir>/app/store", | ||
"<rootDir>/app/types", | ||
"<rootDir>/app/utils" | ||
], | ||
"moduleFileExtensions": ["js", "jsx", "test.js"], | ||
"moduleDirectories": ["node_modules"], | ||
"moduleNameMapper": { | ||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js", | ||
"\\.(css|less)$": "identity-obj-proxy" | ||
}, | ||
"collectCoverage": true, | ||
"collectCoverageFrom": [ | ||
"app/**/*.{js}", | ||
"!**/node_modules/**", | ||
"!**/vendor/**", | ||
"!**/dist/**", | ||
"!**/containers/**", | ||
"!**/__tests__/**", | ||
"!**/processIsRunning.js", | ||
"!**/*.test.js", | ||
"!**/*.development.js", | ||
"!app/index.main.js" | ||
], | ||
"coverageReporters": ["text"], | ||
"coveragePathIgnorePatterns": ["<rootDir>/build/", "<rootDir>/node_modules/", "<rootDir>/app/node_modules/", "<rootDir>/app/dist", "<rootDir>/app/types"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const electron = jest.genMockFromModule('electron'); | ||
|
||
electron.screen = {}; | ||
|
||
const primaryDisplay = { | ||
workAreaSize: { | ||
width: 1920 | ||
} | ||
}; | ||
|
||
electron.screen.setPrimaryDisplayWidth = width => { | ||
primaryDisplay.workAreaSize.width = width; | ||
}; | ||
|
||
electron.screen.getPrimaryDisplay = () => primaryDisplay; | ||
|
||
module.exports = electron; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// @flow | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import { Provider } from 'react-redux'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { SIZES, MIN_FACTOR, MAX_FACTOR, clampScaleFactor, getInitialWindowDimensions, getSize } from '../windowScale'; | ||
|
||
jest.mock('electron', function electronMock () { | ||
this.width = 1920; | ||
const screen = { | ||
getPrimaryDisplay: () => ({ | ||
workAreaSize: { | ||
width: this.width | ||
} | ||
}) | ||
}; | ||
return { | ||
screen, | ||
setWidth: _width => { this.width = _width; } | ||
}; | ||
}); | ||
|
||
const testSizes = [{ width: 1920 }, { width: 800, height: 600 }].concat(SIZES); | ||
|
||
describe('util: windowScale', () => { | ||
it(`clamps scale factors below ${MIN_FACTOR}`, () => { | ||
const below = clampScaleFactor(0.1); | ||
|
||
expect(below).toBe(MIN_FACTOR); | ||
}); | ||
|
||
it(`clamps scale factors above ${MAX_FACTOR}`, () => { | ||
const above = clampScaleFactor(2); | ||
|
||
expect(above).toBe(MAX_FACTOR); | ||
}); | ||
|
||
it(`doesn't clamp values between ${MIN_FACTOR} and ${MAX_FACTOR}`, () => { | ||
const within = clampScaleFactor(1); | ||
|
||
expect(within).toBeLessThanOrEqual(MAX_FACTOR); | ||
expect(within).toBeGreaterThanOrEqual(MIN_FACTOR); | ||
}); | ||
|
||
testSizes.forEach(size => { | ||
it(`ensures the initial window size fits the screen's dimensions (screen width: ${size.width})`, () => { | ||
require('electron').setWidth(size.width); | ||
const result = getInitialWindowDimensions(); | ||
expect(result.dimensions.width).toBeLessThanOrEqual(size.width); | ||
expect(result.scale).toBeLessThanOrEqual(MAX_FACTOR); | ||
expect(result.scale).toBeGreaterThanOrEqual(MIN_FACTOR); | ||
}); | ||
}); | ||
|
||
it('infers a window size based on a scale factor', () => { | ||
const dimensions1 = getSize(1); | ||
const dimensions125 = getSize(1.25); | ||
const dimensions08 = getSize(0.8); | ||
|
||
expect(dimensions08).toEqual({ width: 1024, height: 576 }); | ||
expect(dimensions1).toEqual({ width: 1280, height: 720 }); | ||
expect(dimensions125).toEqual({ width: 1600, height: 900 }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export { default as bind } from './bind'; | ||
export { default as lcuRequest } from './lcuRequest'; | ||
export { validatePath, validatePathSync } from './validatePath'; | ||
export { default as dispatchToRenderer } from './dispatchToRenderer'; | ||
export { default as parseLockfile } from './parseLockfile'; | ||
export { default as processIsRunning } from './processIsRunning'; | ||
export { default as env } from './env'; | ||
|
||
module.exports.windowScale = require('./windowScale'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.