@@ -5204,20 +5204,20 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be possible to click outside of the combobox which should close the combobox (even if we press the combobox button)',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html`
`,
})
// Open combobox
await click(getComboboxButton())
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
assertActiveElement(getComboboxInput())
// Click the combobox button again
await click(getComboboxButton())
// Should be closed now
- assertComboboxList({state: ComboboxState.InvisibleUnmounted})
+ assertComboboxList({ state: ComboboxState.InvisibleUnmounted })
// Verify the input is focused again
assertActiveElement(getComboboxInput())
@@ -5229,7 +5229,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
suppressConsoleLogs(async () => {
let focusFn = jest.fn()
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html`
@@ -5247,13 +5247,13 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
await click(getComboboxButton())
// Ensure the combobox is open
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
// Click the span inside the button
await click(getByText('Next'))
// Ensure the combobox is closed
- assertComboboxList({state: ComboboxState.InvisibleUnmounted})
+ assertComboboxList({ state: ComboboxState.InvisibleUnmounted })
// Ensure the outside button is focused
assertActiveElement(document.getElementById('btn'))
@@ -5267,7 +5267,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be possible to hover an option and make it active',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
})
@@ -5306,7 +5306,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
`,
- setup: () => ({value: ref(null), virtual}),
+ setup: () => ({ value: ref(null), virtual }),
})
await nextTick()
@@ -5331,7 +5331,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should make a combobox option active when you move the mouse over it',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
})
@@ -5349,7 +5349,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be a no-op when we move the mouse and the combobox option is already active',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
})
@@ -5373,13 +5373,13 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be a no-op when we move the mouse and the combobox option is disabled',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
setup: () => ({
options: [
- {value: 'alice', children: 'alice', disabled: false},
- {value: 'bob', children: 'bob', disabled: true},
- {value: 'charlie', children: 'charlie', disabled: false},
+ { value: 'alice', children: 'alice', disabled: false },
+ { value: 'bob', children: 'bob', disabled: true },
+ { value: 'charlie', children: 'charlie', disabled: false },
],
}),
})
@@ -5398,13 +5398,13 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should not be possible to hover an option that is disabled',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
setup: () => ({
options: [
- {value: 'alice', children: 'alice', disabled: false},
- {value: 'bob', children: 'bob', disabled: true},
- {value: 'charlie', children: 'charlie', disabled: false},
+ { value: 'alice', children: 'alice', disabled: false },
+ { value: 'bob', children: 'bob', disabled: true },
+ { value: 'charlie', children: 'charlie', disabled: false },
],
}),
})
@@ -5426,7 +5426,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be possible to mouse leave an option and make it inactive',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
})
@@ -5462,13 +5462,13 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be possible to mouse leave a disabled option and be a no-op',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
setup: () => ({
options: [
- {value: 'alice', children: 'alice', disabled: false},
- {value: 'bob', children: 'bob', disabled: true},
- {value: 'charlie', children: 'charlie', disabled: false},
+ { value: 'alice', children: 'alice', disabled: false },
+ { value: 'bob', children: 'bob', disabled: true },
+ { value: 'charlie', children: 'charlie', disabled: false },
],
}),
})
@@ -5492,7 +5492,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
suppressConsoleLogs(async () => {
let handleChange = jest.fn()
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
setup: () => {
let value = ref(null)
@@ -5508,14 +5508,14 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
// Open combobox
await click(getComboboxButton())
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
assertActiveElement(getComboboxInput())
let options = getComboboxOptions()
// We should be able to click the first option
await click(options[1])
- assertComboboxList({state: ComboboxState.InvisibleUnmounted})
+ assertComboboxList({ state: ComboboxState.InvisibleUnmounted })
expect(handleChange).toHaveBeenCalledTimes(1)
expect(handleChange).toHaveBeenCalledWith('Option B')
@@ -5534,7 +5534,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be possible to click a combobox option, which closes the combobox with immediate mode enabled',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
})
@@ -5542,13 +5542,13 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
await focus(getComboboxInput())
assertActiveElement(getComboboxInput())
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
let options = getComboboxOptions()
// We should be able to click the first option
await click(options[1])
- assertComboboxList({state: ComboboxState.InvisibleUnmounted})
+ assertComboboxList({ state: ComboboxState.InvisibleUnmounted })
})
)
@@ -5557,16 +5557,16 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
suppressConsoleLogs(async () => {
let handleChange = jest.fn()
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
setup: () => {
let value = ref(null)
return {
value,
options: [
- {value: 'alice', children: 'Alice', disabled: false},
- {value: 'bob', children: 'Bob', disabled: true},
- {value: 'charlie', children: 'Charlie', disabled: false},
+ { value: 'alice', children: 'Alice', disabled: false },
+ { value: 'bob', children: 'Bob', disabled: true },
+ { value: 'charlie', children: 'Charlie', disabled: false },
],
update(newValue: any) {
value.value = newValue
@@ -5578,14 +5578,14 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
// Open combobox
await click(getComboboxButton())
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
assertActiveElement(getComboboxInput())
let options = getComboboxOptions()
// We should not be able to click the disabled option
await click(options[1])
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
assertNotActiveComboboxOption(options[1])
assertActiveElement(getComboboxInput())
expect(handleChange).toHaveBeenCalledTimes(0)
@@ -5607,7 +5607,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be possible focus a combobox option, so that it becomes active',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
setup: () => {
let value = ref(null)
@@ -5622,7 +5622,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
// Open combobox
await click(getComboboxButton())
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
assertActiveElement(getComboboxInput())
let options = getComboboxOptions()
@@ -5640,20 +5640,20 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should not be possible to focus a combobox option which is disabled',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
setup: () => ({
options: [
- {value: 'alice', disabled: false, children: 'alice'},
- {value: 'bob', disabled: true, children: 'bob'},
- {value: 'charlie', disabled: false, children: 'charlie'},
+ { value: 'alice', disabled: false, children: 'alice' },
+ { value: 'bob', disabled: true, children: 'bob' },
+ { value: 'charlie', disabled: false, children: 'charlie' },
],
}),
})
// Open combobox
await click(getComboboxButton())
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
assertActiveElement(getComboboxInput())
let options = getComboboxOptions()
@@ -5668,23 +5668,23 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should be possible to hold the last active option',
suppressConsoleLogs(async () => {
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html``,
})
assertComboboxButton({
state: ComboboxState.InvisibleUnmounted,
- attributes: {id: 'headlessui-combobox-button-2'},
+ attributes: { id: 'headlessui-combobox-button-2' },
})
- assertComboboxList({state: ComboboxState.InvisibleUnmounted})
+ assertComboboxList({ state: ComboboxState.InvisibleUnmounted })
await click(getComboboxButton())
assertComboboxButton({
state: ComboboxState.Visible,
- attributes: {id: 'headlessui-combobox-button-2'},
+ attributes: { id: 'headlessui-combobox-button-2' },
})
- assertComboboxList({state: ComboboxState.Visible})
+ assertComboboxList({ state: ComboboxState.Visible })
let options = getComboboxOptions()
@@ -5734,7 +5734,7 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
`,
setup: () => ({
value: ref('bob'),
- virtual: computed(() => (virtual ? {options: ['alice', 'bob', 'charlie']} : null)),
+ virtual: computed(() => (virtual ? { options: ['alice', 'bob', 'charlie'] } : null)),
}),
})
@@ -5781,15 +5781,15 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
`,
setup: () => {
let people = [
- {id: 1, name: 'Alice'},
- {id: 2, name: 'Bob'},
- {id: 3, name: 'Charlie'},
+ { id: 1, name: 'Alice' },
+ { id: 2, name: 'Bob' },
+ { id: 3, name: 'Charlie' },
]
return {
people,
value: ref(people[1]),
- virtual: computed(() => (virtual ? {options: people} : null)),
+ virtual: computed(() => (virtual ? { options: people } : null)),
}
},
})
@@ -5815,12 +5815,12 @@ describe.each([{virtual: false}, {virtual: false}])('Mouse interactions %s', ({v
'should sync the input field correctly and reset it when resetting the value from outside (when using displayValue)',
suppressConsoleLogs(async () => {
let people = [
- {id: 1, name: 'Alice'},
- {id: 2, name: 'Bob'},
- {id: 3, name: 'Charlie'},
+ { id: 1, name: 'Alice' },
+ { id: 2, name: 'Bob' },
+ { id: 3, name: 'Charlie' },
]
renderTemplate({
- components: {MyCombobox},
+ components: { MyCombobox },
template: html`
{
`,
- setup: () => ({value: ref(['bob', 'charlie'])}),
+ setup: () => ({ value: ref(['bob', 'charlie']) }),
})
// Open combobox
await click(getComboboxButton())
// Verify that we have an open combobox with multiple mode
- assertCombobox({state: ComboboxState.Visible, mode: ComboboxMode.Multiple})
+ assertCombobox({ state: ComboboxState.Visible, mode: ComboboxMode.Multiple })
// Verify that we have multiple selected combobox options
let options = getComboboxOptions()
- assertComboboxOption(options[0], {selected: false})
- assertComboboxOption(options[1], {selected: true})
- assertComboboxOption(options[2], {selected: true})
+ assertComboboxOption(options[0], { selected: false })
+ assertComboboxOption(options[1], { selected: true })
+ assertComboboxOption(options[2], { selected: true })
})
)
@@ -5908,7 +5908,7 @@ describe('Multi-select', () => {
`,
- setup: () => ({value: ref(['bob', 'charlie'])}),
+ setup: () => ({ value: ref(['bob', 'charlie']) }),
})
// Open combobox
@@ -5934,18 +5934,18 @@ describe('Multi-select', () => {
`,
- setup: () => ({value: ref(['bob', 'charlie'])}),
+ setup: () => ({ value: ref(['bob', 'charlie']) }),
})
// Open combobox
await click(getComboboxButton())
- assertCombobox({state: ComboboxState.Visible})
+ assertCombobox({ state: ComboboxState.Visible })
// Verify that bob is the active option
await click(getComboboxOptions()[0])
// Verify that the combobox is still open
- assertCombobox({state: ComboboxState.Visible})
+ assertCombobox({ state: ComboboxState.Visible })
})
)
@@ -5964,32 +5964,32 @@ describe('Multi-select', () => {
`,
- setup: () => ({value: ref(['bob', 'charlie'])}),
+ setup: () => ({ value: ref(['bob', 'charlie']) }),
})
// Open combobox
await click(getComboboxButton())
- assertCombobox({state: ComboboxState.Visible})
+ assertCombobox({ state: ComboboxState.Visible })
let options = getComboboxOptions()
- assertComboboxOption(options[0], {selected: false})
- assertComboboxOption(options[1], {selected: true})
- assertComboboxOption(options[2], {selected: true})
+ assertComboboxOption(options[0], { selected: false })
+ assertComboboxOption(options[1], { selected: true })
+ assertComboboxOption(options[2], { selected: true })
// Click on bob
await click(getComboboxOptions()[1])
- assertComboboxOption(options[0], {selected: false})
- assertComboboxOption(options[1], {selected: false})
- assertComboboxOption(options[2], {selected: true})
+ assertComboboxOption(options[0], { selected: false })
+ assertComboboxOption(options[1], { selected: false })
+ assertComboboxOption(options[2], { selected: true })
// Click on bob again
await click(getComboboxOptions()[1])
- assertComboboxOption(options[0], {selected: false})
- assertComboboxOption(options[1], {selected: true})
- assertComboboxOption(options[2], {selected: true})
+ assertComboboxOption(options[0], { selected: false })
+ assertComboboxOption(options[1], { selected: true })
+ assertComboboxOption(options[2], { selected: true })
})
)
@@ -6010,39 +6010,39 @@ describe('Multi-select', () => {
`,
setup: () => {
let people = [
- {id: 1, name: 'alice'},
- {id: 2, name: 'bob'},
- {id: 3, name: 'charlie'},
+ { id: 1, name: 'alice' },
+ { id: 2, name: 'bob' },
+ { id: 3, name: 'charlie' },
]
let value = ref([people[1], people[2]])
- return {people, value}
+ return { people, value }
},
})
// Open combobox
await click(getComboboxButton())
- assertCombobox({state: ComboboxState.Visible})
+ assertCombobox({ state: ComboboxState.Visible })
let options = getComboboxOptions()
- assertComboboxOption(options[0], {selected: false})
- assertComboboxOption(options[1], {selected: true})
- assertComboboxOption(options[2], {selected: true})
+ assertComboboxOption(options[0], { selected: false })
+ assertComboboxOption(options[1], { selected: true })
+ assertComboboxOption(options[2], { selected: true })
// Click on bob
await click(getComboboxOptions()[1])
- assertComboboxOption(options[0], {selected: false})
- assertComboboxOption(options[1], {selected: false})
- assertComboboxOption(options[2], {selected: true})
+ assertComboboxOption(options[0], { selected: false })
+ assertComboboxOption(options[1], { selected: false })
+ assertComboboxOption(options[2], { selected: true })
// Click on bob again
await click(getComboboxOptions()[1])
- assertComboboxOption(options[0], {selected: false})
- assertComboboxOption(options[1], {selected: true})
- assertComboboxOption(options[2], {selected: true})
+ assertComboboxOption(options[0], { selected: false })
+ assertComboboxOption(options[1], { selected: true })
+ assertComboboxOption(options[2], { selected: true })
})
)
@@ -6068,13 +6068,13 @@ describe('Multi-select', () => {
let users = ['alice', 'bob', 'charlie']
let value = ref([])
- return {users, value}
+ return { users, value }
},
})
// Open combobox
await click(getComboboxButton())
- assertCombobox({state: ComboboxState.Visible})
+ assertCombobox({ state: ComboboxState.Visible })
let options = getComboboxOptions()
@@ -6267,19 +6267,19 @@ describe('Form compatibility', () => {
id: 1,
value: 'pickup',
label: 'Pickup',
- extra: {info: 'Some extra info'},
+ extra: { info: 'Some extra info' },
},
{
id: 2,
value: 'home-delivery',
label: 'Home delivery',
- extra: {info: 'Some extra info'},
+ extra: { info: 'Some extra info' },
},
{
id: 3,
value: 'dine-in',
label: 'Dine in',
- extra: {info: 'Some extra info'},
+ extra: { info: 'Some extra info' },
},
])
let value = ref(options.value[0])