Commit a4ce58de authored by Josh Pratt's avatar Josh Pratt Committed by Commit Bot

Formatting fix for Crostini shared usb settings page

Changes the /crostini/shared_usb_devices page in crostini settings to
more closely match /crostini/shared_paths and other settings UI.

Bug: 930588
Change-Id: I14ec8a58ce4b263520efbdcd317281a30de3d2ad
Reviewed-on: https://chromium-review.googlesource.com/c/1477569
Commit-Queue: Josh Pratt <jopra@chromium.org>
Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635903}
parent 4e403e02
...@@ -557,6 +557,9 @@ ...@@ -557,6 +557,9 @@
<message name="IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LABEL" desc="Label for managing shared USB devices."> <message name="IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LABEL" desc="Label for managing shared USB devices.">
USB Device preferences USB Device preferences
</message> </message>
<message name="IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LIST_HEADING" desc="Label for list of options to share USB devices.">
USB Devices
</message>
<message name="IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_DESCRIPTION" desc="Description for managing shared USB devices."> <message name="IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_DESCRIPTION" desc="Description for managing shared USB devices.">
Share a USB device with Linux by turning the toggle on. Sharing will only last until the device is detached. Share a USB device with Linux by turning the toggle on. Sharing will only last until the device is detached.
</message> </message>
......
...@@ -75,9 +75,6 @@ ...@@ -75,9 +75,6 @@
<settings-subpage <settings-subpage
associated-control="[[$$('#crostini')]]" associated-control="[[$$('#crostini')]]"
page-title="$i18n{crostiniSharedUsbDevicesLabel}"> page-title="$i18n{crostiniSharedUsbDevicesLabel}">
<div class="settings-box first">
<div class="label">$i18n{crostiniSharedUsbDevicesDescription}</div>
</div>
<settings-crostini-shared-usb-devices prefs="{{prefs}}"> <settings-crostini-shared-usb-devices prefs="{{prefs}}">
</settings-crostini-shared-usb-devices> </settings-crostini-shared-usb-devices>
</settings-subpage> </settings-subpage>
......
...@@ -15,13 +15,21 @@ ...@@ -15,13 +15,21 @@
justify-content: space-between; justify-content: space-between;
} }
</style> </style>
<template is="dom-repeat" <div class="settings-box first">
items="{{prefs.crostini.shared_usb_devices.value}}" as="usb"> <div>$i18n{crostiniSharedUsbDevicesDescription}</div>
<div class="toggle-container settings-box"> </div>
<div class="label">[[usb.name]]</div> <div class="settings-box continuation">
<cr-toggle class="toggle" checked="{{usb.shared}}"></cr-toggle> <h2 class="start">$i18n{crostiniSharedUsbDevicesListHeading}</h2>
</div> </div>
</template> <div class="list-frame vertical-list">
<template is="dom-repeat"
items="{{prefs.crostini.shared_usb_devices.value}}" as="device">
<div class="toggle-container settings-box">
<div class="label">[[device.name]]</div>
<cr-toggle class="toggle" checked="{{device.shared}}"></cr-toggle>
</div>
</template>
</div>
</template> </template>
<script src="crostini_shared_usb_devices.js"></script> <script src="crostini_shared_usb_devices.js"></script>
</dom-module> </dom-module>
...@@ -464,6 +464,8 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source, ...@@ -464,6 +464,8 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LABEL}, IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LABEL},
{"crostiniSharedUsbDevicesDescription", {"crostiniSharedUsbDevicesDescription",
IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_DESCRIPTION}, IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_DESCRIPTION},
{"crostiniSharedUsbDevicesListHeading",
IDS_SETTINGS_CROSTINI_SHARED_USB_DEVICES_LIST_HEADING},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings, AddLocalizedStringsBulk(html_source, kLocalizedStrings,
base::size(kLocalizedStrings)); base::size(kLocalizedStrings));
......
...@@ -215,12 +215,11 @@ suite('CrostiniPageTests', function() { ...@@ -215,12 +215,11 @@ suite('CrostiniPageTests', function() {
}); });
test('USB devices are shown', function() { test('USB devices are shown', function() {
assertEquals( assertEquals(3, subpage.shadowRoot.querySelectorAll('.toggle').length);
3, subpage.shadowRoot.querySelectorAll('.settings-box').length);
}); });
test('USB shared pref is updated by toggling', function() { test('USB shared pref is updated by toggling', function() {
assertTrue(!!subpage.$$('.settings-box .toggle')); assertTrue(!!subpage.$$('.toggle'));
subpage.$$('.toggle').click(); subpage.$$('.toggle').click();
return flushAsync() return flushAsync()
.then(() => { .then(() => {
......
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