mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
Fix Bluetooth panel device list handling
This commit is contained in:
@@ -20,6 +20,17 @@ const devices = [
|
||||
{ name: 'Mouse', connected: false, trusted: true, address: '5' }
|
||||
]
|
||||
|
||||
const arrayLikeDevices = {
|
||||
0: devices[0],
|
||||
1: devices[1],
|
||||
length: 2
|
||||
}
|
||||
assertDeepEqual(
|
||||
bluetooth.toArray(arrayLikeDevices).map(bluetooth.deviceLabel),
|
||||
['Speaker', 'Headphones'],
|
||||
'bluetooth converts Quickshell QObjectList-style values into arrays'
|
||||
)
|
||||
|
||||
const lists = bluetooth.deviceLists(devices)
|
||||
assertDeepEqual(lists.connected.map(bluetooth.deviceLabel), ['Headphones'], 'bluetooth groups connected devices')
|
||||
assertDeepEqual(lists.known.map(bluetooth.deviceLabel), ['Mouse', 'Speaker'], 'bluetooth groups known devices by label')
|
||||
@@ -27,6 +38,16 @@ assertDeepEqual(lists.discovered.map(bluetooth.deviceLabel), ['Keyboard'], 'blue
|
||||
assertDeepEqual(bluetooth.visibleSections(lists, true), ['connected', 'known', 'discovered'], 'bluetooth shows discovered section while scanning')
|
||||
assertDeepEqual(bluetooth.visibleSections(lists, false), ['connected', 'known'], 'bluetooth hides discovered section when not scanning')
|
||||
|
||||
const arrayLikeLists = bluetooth.deviceLists({
|
||||
0: { name: 'Earbuds', connected: true, address: '6' },
|
||||
1: { name: 'Trackpad', paired: true, address: '7' },
|
||||
2: { name: 'Gamepad', address: '8' },
|
||||
length: 3
|
||||
})
|
||||
assertDeepEqual(arrayLikeLists.connected.map(bluetooth.deviceLabel), ['Earbuds'], 'bluetooth groups connected devices from array-like values')
|
||||
assertDeepEqual(arrayLikeLists.known.map(bluetooth.deviceLabel), ['Trackpad'], 'bluetooth groups known devices from array-like values')
|
||||
assertDeepEqual(arrayLikeLists.discovered.map(bluetooth.deviceLabel), ['Gamepad'], 'bluetooth groups discovered devices from array-like values')
|
||||
|
||||
assertDeepEqual(
|
||||
bluetooth.withPendingAction({ a: 'connecting' }, 'b', 'forgetting'),
|
||||
{ a: 'connecting', b: 'forgetting' },
|
||||
|
||||
Reference in New Issue
Block a user