Commit 56e9d8a7 authored by Jimmy Gong's avatar Jimmy Gong Committed by Commit Bot

Update error container for printer dialogs to use display flex

- Fixes a bug where some large error text would appear misplaced in both
  add and edit printer dialog.
- Update browsertest to reflect this change.

Bug: 1019432
Test: browsertests and end to end
Change-Id: I24c2c96f4cf68c647a16d8cb69580cdf66ae43f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888950
Commit-Queue: jimmy gong <jimmyxgong@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711102}
parent 7c2e24a2
...@@ -79,15 +79,9 @@ ...@@ -79,15 +79,9 @@
<style include="cups-printer-shared"></style> <style include="cups-printer-shared"></style>
<add-printer-dialog> <add-printer-dialog>
<div slot="dialog-title"> <div slot="dialog-title">
$i18n{addPrintersManuallyTitle} <span>$i18n{addPrintersManuallyTitle}</span>
<div id="general-error-container" hidden="[[!errorText_]]"> <printer-dialog-error error-text="[[errorText_]]">
<div id="general-error"> </printer-dialog-error>
<iron-icon id="general-error-icon" icon="cr:warning"></iron-icon>
<div id="general-error-message">
[[errorText_]]
</div>
</div>
</div>
</div> </div>
<div slot="dialog-body"> <div slot="dialog-body">
<div class="settings-box first two-line"> <div class="settings-box first two-line">
...@@ -161,15 +155,10 @@ ...@@ -161,15 +155,10 @@
} }
</style> </style>
<add-printer-dialog> <add-printer-dialog>
<div slot="dialog-title">$i18n{manufacturerAndModelDialogTitle} <div slot="dialog-title">
<div id="general-error-container" hidden="[[!errorText_]]"> <span>$i18n{manufacturerAndModelDialogTitle}</span>
<div id="general-error"> <printer-dialog-error error-text="[[errorText_]]">
<iron-icon id="general-error-icon" icon="cr:warning"></iron-icon> </printer-dialog-error>
<div id="general-error-message">
[[errorText_]]
</div>
</div>
</div>
</div> </div>
<div slot="dialog-body"> <div slot="dialog-body">
<div class="subtext" id="makeModelTextInfo"> <div class="subtext" id="makeModelTextInfo">
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="cups_printer_dialog_util.html"> <link rel="import" href="cups_printer_dialog_util.html">
<link rel="import" href="cups_printer_shared_css.html"> <link rel="import" href="cups_printer_shared_css.html">
<link rel="import" href="cups_printers_browser_proxy.html"> <link rel="import" href="cups_printers_browser_proxy.html">
...@@ -54,3 +55,36 @@ ...@@ -54,3 +55,36 @@
</template> </template>
<script src="cups_add_printer_dialog_elements.js"></script> <script src="cups_add_printer_dialog_elements.js"></script>
</dom-module> </dom-module>
<dom-module id="printer-dialog-error">
<template>
<style>
#error-wrap {
display: flex;
}
#error-container {
height: 20px;
margin-top: 10px;
}
#error-icon {
--iron-icon-fill-color: var(--google-red-600);
}
#error-message {
color: var(--google-red-600);
font-size: 10px;
margin-inline-start: 5px;
}
</style>
<div id="error-container" hidden="[[!errorText]]">
<div id="error-wrap">
<iron-icon id="error-icon" icon="cr:warning"></iron-icon>
<div id="error-message">
[[errorText]]
</div>
</div>
</div>
</template>
</dom-module>
...@@ -52,3 +52,18 @@ Polymer({ ...@@ -52,3 +52,18 @@ Polymer({
this.$.dialog.close(); this.$.dialog.close();
}, },
}); });
/**
* 'printer-dialog-error' is the error container for dialogs.
*/
Polymer({
is: 'printer-dialog-error',
properties: {
/** The error text to be displayed on the dialog. */
errorText: {
type: String,
value: '',
},
},
});
...@@ -19,14 +19,8 @@ ...@@ -19,14 +19,8 @@
<style include="cr-shared-style cups-printer-shared"></style> <style include="cr-shared-style cups-printer-shared"></style>
<add-printer-dialog> <add-printer-dialog>
<div slot="dialog-title">$i18n{editPrinterDialogTitle} <div slot="dialog-title">$i18n{editPrinterDialogTitle}
<div id="general-error-container" hidden="[[!errorText_]]"> <printer-dialog-error error-text="[[errorText_]]">
<div id="general-error"> </printer-dialog-error>
<iron-icon id="general-error-icon" icon="cr:warning"></iron-icon>
<div id="general-error-message">
[[errorText_]]
</div>
</div>
</div>
</div> </div>
<div slot="dialog-body" scrollable> <div slot="dialog-body" scrollable>
<div class="settings-box first two-line"> <div class="settings-box first two-line">
......
...@@ -98,22 +98,6 @@ ...@@ -98,22 +98,6 @@
padding-inline-start: 20px; padding-inline-start: 20px;
} }
#general-error-container {
height: 20px;
margin-top: 10px;
}
#general-error-icon {
--iron-icon-fill-color: var(--google-red-600);
}
#general-error-message {
color: var(--google-red-600);
display: inline-block;
font-size: 10px;
margin-inline-start: 5px;
}
#no-search-results { #no-search-results {
text-align: center; text-align: center;
} }
......
...@@ -237,7 +237,8 @@ suite('CupsAddPrinterDialogTests', function() { ...@@ -237,7 +237,8 @@ suite('CupsAddPrinterDialogTests', function() {
.then(function(result) { .then(function(result) {
// The general error should be showing. // The general error should be showing.
assertTrue(!!addDialog.errorText_); assertTrue(!!addDialog.errorText_);
assertFalse(addDialog.$$('#general-error-container').hidden); const generalErrorElement = addDialog.$$('printer-dialog-error');
assertFalse(generalErrorElement.$$('#error-container').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