electron/spec/api-screen-spec.js

35 lines
944 B
JavaScript
Raw Normal View History

2016-03-25 20:03:49 +00:00
const assert = require('assert')
2017-10-27 00:55:07 +00:00
const {screen} = require('electron')
2016-01-12 02:40:23 +00:00
2017-10-27 00:55:07 +00:00
describe('screen module', () => {
describe('screen.getCursorScreenPoint()', () => {
it('returns a point object', () => {
const point = screen.getCursorScreenPoint()
2016-03-25 20:03:49 +00:00
assert.equal(typeof point.x, 'number')
assert.equal(typeof point.y, 'number')
})
})
2017-10-27 00:55:07 +00:00
describe('screen.getPrimaryDisplay()', () => {
it('returns a display object', () => {
const display = screen.getPrimaryDisplay()
2016-03-25 20:03:49 +00:00
assert.equal(typeof display.scaleFactor, 'number')
assert(display.size.width > 0)
assert(display.size.height > 0)
})
})
2017-10-27 00:55:07 +00:00
describe('screen.getMenuBarHeight()', () => {
before(function () {
if (process.platform !== 'darwin') {
this.skip()
}
})
2017-10-27 00:55:07 +00:00
it('returns an integer', () => {
const screenHeight = screen.getMenuBarHeight()
assert.equal(typeof screenHeight, 'number')
})
})
2016-03-25 20:03:49 +00:00
})