mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:03:30 +02:00
Sort browser apps alphabetically. Sort again in the detailed device list as we currently have old data left over and we may wish to change the sorting later anyway. Should not be terribly bad due to most devices only having one or two browsers.
This commit is contained in:
@@ -49,6 +49,12 @@ module.exports = syrup.serial()
|
||||
return acc
|
||||
}
|
||||
|
||||
function compareIgnoreCase(a, b) {
|
||||
var la = (a || '').toLowerCase()
|
||||
, lb = (b || '').toLowerCase()
|
||||
return la === lb ? 0 : (la < lb ? -1 : 1)
|
||||
}
|
||||
|
||||
function updateBrowsers(data) {
|
||||
log.info('Updating browser list')
|
||||
push.send([
|
||||
@@ -56,7 +62,9 @@ module.exports = syrup.serial()
|
||||
, wireutil.envelope(new wire.DeviceBrowserMessage(
|
||||
options.serial
|
||||
, data.selected
|
||||
, data.apps.reduce(appReducer, [])
|
||||
, data.apps.reduce(appReducer, []).sort(function(appA, appB) {
|
||||
return compareIgnoreCase(appA.name, appB.name)
|
||||
})
|
||||
))
|
||||
])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user