Commit 4f833444 authored by Bailey Berro's avatar Bailey Berro Committed by Commit Bot

Show message when no nearby printers available

When there are no nearby printers available, show a message indicating
that.

Bug: 991929
Change-Id: If430ff4c526120aa0b0c97f1670b6e68d6a0f1d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1754942Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Bailey Berro <baileyberro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687316}
parent 72db906c
......@@ -1583,8 +1583,8 @@
<message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_UNAVAILABLE_MESSAGE" desc="The message shown when a printer can no longer be contacted while being added.">
<ph name="PRINTER_NAME">$1<ex>Acme Printer</ex></ph> is no longer available
</message>
<message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_NO_PRINTER_NEARBY" desc="The no-printer-found message shown in the auto discovery dialog.">
No printers nearby
<message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_NO_PRINTER_NEARBY" desc="The message shown when no nearby printers are found.">
There are no available printers.
</message>
<message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_SEARCHING_NEARBY_PRINTER" desc="The searching-in-progress message shown in the auto discovery dialog.">
Searching...
......
......@@ -8,10 +8,19 @@
<dom-module id="settings-cups-nearby-printers">
<template>
<style include="settings-shared"></style>
<style include="settings-shared">
#noPrinterMessage {
margin-inline-start: 60px;
margin-top: 20px;
}
</style>
<settings-cups-printers-entry-list printers="[[nearbyPrinters_]]"
search-term="[[searchTerm]]">
</settings-cups-printers-entry-list>
<div class="secondary" id="noPrinterMessage"
hidden="[[nearbyPrinters_.length]]">
$i18n{noPrinterNearbyMessage}
</div>
</template>
<script src="cups_nearby_printers.js"></script>
</dom-module>
......@@ -669,4 +669,31 @@ suite('CupsNearbyPrintersTests', function() {
verifyPrintersList(nearbyPrinterEntries, expectedPrinterList);
});
});
test('No Nearby Printers', function() {
const automaticPrinterList = [];
const discoveredPrinterList = [createCupsPrinterInfo('test3', '3', 'id3')];
return test_util.flushTasks().then(() => {
nearbyPrintersElement = page.$$('settings-cups-nearby-printers');
assertTrue(!!nearbyPrintersElement);
// Assert that there are no nearby printers.
let nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement);
assertEquals(0, nearbyPrinterEntries.length);
// Check that the "No available printers" message is shown.
assertFalse(nearbyPrintersElement.$$('#noPrinterMessage').hidden);
// Simuluate finding nearby printers.
cr.webUIListenerCallback(
'on-nearby-printers-changed', automaticPrinterList,
discoveredPrinterList);
Polymer.dom.flush();
// Check that the "No available printers" message is not shown.
assertTrue(nearbyPrintersElement.$$('#noPrinterMessage').hidden);
});
});
});
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