Skip to content

Commit 1a18de2

Browse files
committed
Prettier
1 parent 3df289c commit 1a18de2

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ export default class Combobox {
1414
this.isComposing = false
1515

1616
if (!list.id) {
17-
list.id = `combobox-${Math.random()
18-
.toString()
19-
.slice(2, 6)}`
17+
list.id = `combobox-${Math.random().toString().slice(2, 6)}`
2018
}
2119

2220
this.keyboardEventHandler = event => keyboardBindings(event, this)

test/test.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ function click(element) {
1010
element.dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}))
1111
}
1212

13-
describe('combobox-nav', function() {
14-
describe('with API', function() {
15-
let input, list
16-
beforeEach(function() {
13+
describe('combobox-nav', function () {
14+
describe('with API', function () {
15+
let input
16+
let list
17+
beforeEach(function () {
1718
document.body.innerHTML = `
1819
<input type="text">
1920
<ul role="listbox" id="list-id">
@@ -27,11 +28,11 @@ describe('combobox-nav', function() {
2728
list = document.querySelector('ul')
2829
})
2930

30-
afterEach(function() {
31+
afterEach(function () {
3132
document.body.innerHTML = ''
3233
})
3334

34-
it('installs, starts, navigates, stops, and uninstalls', function() {
35+
it('installs, starts, navigates, stops, and uninstalls', function () {
3536
const combobox = new Combobox(input, list)
3637
assert.equal(input.getAttribute('role'), 'combobox')
3738
assert.equal(input.getAttribute('aria-expanded'), 'false')
@@ -63,9 +64,12 @@ describe('combobox-nav', function() {
6364
})
6465
})
6566

66-
describe('with default setup', function() {
67-
let input, list, options, combobox
68-
beforeEach(function() {
67+
describe('with default setup', function () {
68+
let input
69+
let list
70+
let options
71+
let combobox
72+
beforeEach(function () {
6973
document.body.innerHTML = `
7074
<input type="text">
7175
<ul role="listbox" id="list-id">
@@ -85,16 +89,16 @@ describe('combobox-nav', function() {
8589
combobox.start()
8690
})
8791

88-
afterEach(function() {
92+
afterEach(function () {
8993
combobox.destroy()
9094
combobox = null
9195
document.body.innerHTML = ''
9296
})
9397

94-
it('updates attributes on keyboard events', function() {
98+
it('updates attributes on keyboard events', function () {
9599
const expectedTargets = []
96100

97-
document.addEventListener('combobox-commit', function({target}) {
101+
document.addEventListener('combobox-commit', function ({target}) {
98102
expectedTargets.push(target.id)
99103
})
100104

@@ -144,10 +148,10 @@ describe('combobox-nav', function() {
144148
assert.equal(expectedTargets[1], 'link')
145149
})
146150

147-
it('fires commit events on click', function() {
151+
it('fires commit events on click', function () {
148152
const expectedTargets = []
149153

150-
document.addEventListener('combobox-commit', function({target}) {
154+
document.addEventListener('combobox-commit', function ({target}) {
151155
expectedTargets.push(target.id)
152156
})
153157

@@ -160,7 +164,7 @@ describe('combobox-nav', function() {
160164
assert.equal(expectedTargets[1], 'baymax')
161165
})
162166

163-
it('clear selection on input operation', function() {
167+
it('clear selection on input operation', function () {
164168
press(input, 'ArrowDown')
165169
assert.equal(options[0].getAttribute('aria-selected'), 'true')
166170
assert.equal(input.getAttribute('aria-activedescendant'), 'baymax')
@@ -182,9 +186,9 @@ describe('combobox-nav', function() {
182186
assert(!input.hasAttribute('aria-activedescendant'), 'Nothing should be selected')
183187
})
184188

185-
it('fires event and follows the link on click', function() {
189+
it('fires event and follows the link on click', function () {
186190
let eventFired = false
187-
document.addEventListener('combobox-commit', function() {
191+
document.addEventListener('combobox-commit', function () {
188192
eventFired = true
189193
})
190194

@@ -193,7 +197,7 @@ describe('combobox-nav', function() {
193197
assert.equal(window.location.hash, '#link')
194198
})
195199

196-
it('clears aria-activedescendant and sets aria-selected=false when cleared', function() {
200+
it('clears aria-activedescendant and sets aria-selected=false when cleared', function () {
197201
press(input, 'ArrowDown')
198202
assert.equal(options[0].getAttribute('aria-selected'), 'true')
199203
assert.equal(input.getAttribute('aria-activedescendant'), 'baymax')
@@ -204,7 +208,7 @@ describe('combobox-nav', function() {
204208
assert.equal(input.hasAttribute('aria-activedescendant'), false)
205209
})
206210

207-
it('scrolls when the selected item is not in view', function() {
211+
it('scrolls when the selected item is not in view', function () {
208212
list.style.overflow = 'auto'
209213
list.style.height = '18px'
210214
list.style.position = 'relative'

0 commit comments

Comments
 (0)