Commit 68d7fe45 authored by Jimmy Gong's avatar Jimmy Gong Committed by Commit Bot

Alphabetically sort PrinterEntryList

- Alphabetically sort PrinterEntries, which applies to both Saved
  printers and nearby printers.
- Updates browser tests.

Bug: 965721
Test: end to end manual, browsertest
Change-Id: I6ee45d6d91ae51dca0cc4ef5479bbf9490f82fa6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1706880
Commit-Queue: jimmy gong <jimmyxgong@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679798}
parent a95afe23
......@@ -2,6 +2,7 @@
<link rel="import" href="chrome://resources/html/list_property_update_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
<link rel="import" href="cups_printer_dialog_util.html">
<link rel="import" href="cups_printer_types.html">
<link rel="import" href="cups_printers_browser_proxy.html">
<link rel="import" href="cups_printers_entry.html">
......
......@@ -59,6 +59,11 @@ Polymer({
item =>this.matchesSearchTerm_(item.printerInfo,this.searchTerm)) :
this.printers.slice();
updatedPrinters.sort((first, second) => {
return settings.printing.alphabeticalSort(
first.printerInfo, second.printerInfo);
});
this.updateList('filteredPrinters_', printer => printer.printerInfo,
updatedPrinters);
},
......
......@@ -190,10 +190,10 @@ suite('CupsSavedPrintersTests', function() {
setup(function() {
printerList = [
createCupsPrinterInfo('google', '4', 'id4'),
createCupsPrinterInfo('test1', '1', 'id1'),
createCupsPrinterInfo('test2', '2', 'id2'),
createCupsPrinterInfo('test3', '3', 'id3'),
createCupsPrinterInfo('google', '4', 'id4'),
];
cupsPrintersBrowserProxy =
......@@ -410,7 +410,7 @@ suite('CupsNearbyPrintersTests', function() {
];
const discoveredPrinterList = [
createCupsPrinterInfo('test3', '3', 'id3'),
createCupsPrinterInfo('google', '4', 'id4'),
createCupsPrinterInfo('test4', '4', 'id4'),
];
return cupsPrintersBrowserProxy.whenCalled('startDiscoveringPrinters')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment