Browse Source

update touch bar spec

Shelley Vohr 7 years ago
parent
commit
0317189213
1 changed files with 12 additions and 14 deletions
  1. 12 14
      spec/api-touch-bar-spec.js

+ 12 - 14
spec/api-touch-bar-spec.js

@@ -6,22 +6,22 @@ const {closeWindow} = require('./window-helpers')
 const {TouchBarButton, TouchBarColorPicker, TouchBarGroup} = TouchBar
 const {TouchBarLabel, TouchBarPopover, TouchBarScrubber, TouchBarSegmentedControl, TouchBarSlider, TouchBarSpacer} = TouchBar
 
-describe('TouchBar module', function () {
-  it('throws an error when created without an options object', function () {
+describe('TouchBar module', () => {
+  it('throws an error when created without an options object', () => {
     assert.throws(() => {
       const touchBar = new TouchBar()
       touchBar.toString()
     }, /Must specify options object as first argument/)
   })
 
-  it('throws an error when created with invalid items', function () {
+  it('throws an error when created with invalid items', () => {
     assert.throws(() => {
       const touchBar = new TouchBar({items: [1, true, {}, []]})
       touchBar.toString()
     }, /Each item must be an instance of TouchBarItem/)
   })
 
-  it('throws an error when an invalid escape item is set', function () {
+  it('throws an error when an invalid escape item is set', () => {
     assert.throws(() => {
       const touchBar = new TouchBar({items: [], escapeItem: 'esc'})
       touchBar.toString()
@@ -33,19 +33,19 @@ describe('TouchBar module', function () {
     }, /Escape item must be an instance of TouchBarItem/)
   })
 
-  describe('BrowserWindow behavior', function () {
+  describe('BrowserWindow behavior', () => {
     let window
 
-    beforeEach(function () {
+    beforeEach(() => {
       window = new BrowserWindow()
     })
 
-    afterEach(function () {
+    afterEach(() => {
       window.setTouchBar(null)
-      return closeWindow(window).then(function () { window = null })
+      return closeWindow(window).then(() => { window = null })
     })
 
-    it('can be added to and removed from a window', function () {
+    it('can be added to and removed from a window', () => {
       const label = new TouchBarLabel({label: 'bar'})
       const touchBar = new TouchBar([
         new TouchBarButton({label: 'foo', backgroundColor: '#F00', click: () => {}}),
@@ -73,9 +73,7 @@ describe('TouchBar module', function () {
           showArrowButtons: true
         })
       ])
-      const escapeButton = new TouchBarButton({
-        label: 'foo'
-      })
+      const escapeButton = new TouchBarButton({label: 'foo'})
       window.setTouchBar(touchBar)
       touchBar.escapeItem = escapeButton
       label.label = 'baz'
@@ -85,7 +83,7 @@ describe('TouchBar module', function () {
       touchBar.escapeItem = null
     })
 
-    it('calls the callback on the items when a window interaction event fires', function (done) {
+    it('calls the callback on the items when a window interaction event fires', (done) => {
       const button = new TouchBarButton({
         label: 'bar',
         click: () => {
@@ -97,7 +95,7 @@ describe('TouchBar module', function () {
       window.emit('-touch-bar-interaction', {}, button.id)
     })
 
-    it('calls the callback on the escape item when a window interaction event fires', function (done) {
+    it('calls the callback on the escape item when a window interaction event fires', (done) => {
       const button = new TouchBarButton({
         label: 'bar',
         click: () => {