Commit 9d6341de authored by Michael Checo's avatar Michael Checo Committed by Commit Bot

Printing: Hide queue input when protocol is set to "App Socket"

Bug: 1132952
Test: browser_tests --gtest_filter=OSSettingsCupsPrinterPageV3Test.All
Change-Id: Ib32f26778d72f7b9c8ccf85883a2d0a09f335b84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2481662Reviewed-by: default avatarJimmy Gong <jimmyxgong@chromium.org>
Commit-Queue: Michael Checo <michaelcheco@google.com>
Cr-Commit-Position: refs/heads/master@{#818165}
parent ac4bb221
...@@ -55,12 +55,14 @@ ...@@ -55,12 +55,14 @@
</div> </div>
</div> </div>
</div> </div>
<div class="settings-box two-line"> <template is="dom-if" if="[[showPrinterQueue_]]" restamp>
<cr-input id="printerQueueInput" label="$i18n{printerQueue}" <div class="settings-box two-line">
value="{{newPrinter.printerQueue}}" maxlength=64 <cr-input id="printerQueueInput" label="$i18n{printerQueue}"
on-keypress="onKeypress_"> value="{{newPrinter.printerQueue}}" maxlength=64
</cr-input> on-keypress="onKeypress_">
</div> </cr-input>
</div>
</template>
</div> </div>
<div slot="dialog-buttons"> <div slot="dialog-buttons">
<!-- Left Group --> <!-- Left Group -->
......
...@@ -52,6 +52,12 @@ Polymer({ ...@@ -52,6 +52,12 @@ Polymer({
type: String, type: String,
value: '', value: '',
}, },
/** @private */
showPrinterQueue_: {
type: Boolean,
value: true,
},
}, },
observers: [ observers: [
...@@ -162,6 +168,8 @@ Polymer({ ...@@ -162,6 +168,8 @@ Polymer({
* @private * @private
*/ */
onProtocolChange_(event) { onProtocolChange_(event) {
// Queue input should be hidden when protocol is set to "App Socket".
this.showPrinterQueue_ = event.target.value !== 'socket';
this.set('newPrinter.printerProtocol', event.target.value); this.set('newPrinter.printerProtocol', event.target.value);
}, },
......
...@@ -605,6 +605,27 @@ suite('CupsAddPrinterDialogTests', function() { ...@@ -605,6 +605,27 @@ suite('CupsAddPrinterDialogTests', function() {
assertFalse(addButton.disabled); assertFalse(addButton.disabled);
}); });
}); });
test('Queue input is hidden when protocol is App Socket', () => {
const addDialog = dialog.$$('add-printer-manually-dialog');
let printerQueueInput = addDialog.$$('#printerQueueInput');
const select = addDialog.shadowRoot.querySelector('select');
assertTrue(!!printerQueueInput);
select.value = 'socket';
select.dispatchEvent(new CustomEvent('change'), {'bubbles': true});
Polymer.dom.flush();
printerQueueInput = addDialog.$$('#printerQueueInput');
assertFalse(!!printerQueueInput);
select.value = 'http';
select.dispatchEvent(new CustomEvent('change'), {'bubbles': true});
Polymer.dom.flush();
printerQueueInput = addDialog.$$('#printerQueueInput');
assertTrue(!!printerQueueInput);
});
}); });
suite('EditPrinterDialog', function() { suite('EditPrinterDialog', function() {
......
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