Commit c15097f9 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Chromium LUCI CQ

Files app: Generate JS module for <files-toast> and its unittest

Bug: 1133186
Change-Id: I1dc6cdc529b21298943d7157b810e85533a645e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560335
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarJeremie Boulic <jboulic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832650}
parent 3d519f44
...@@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesPasswordDialog) { ...@@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesPasswordDialog) {
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesToast) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesToast) {
RunTestURL("foreground/elements/files_toast_unittest_gen.html"); RunTestURL("foreground/elements/files_toast_unittest.m_gen.html");
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesToolTip) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesToolTip) {
......
...@@ -60,6 +60,7 @@ js_type_check("closure_compile_jsmodules") { ...@@ -60,6 +60,7 @@ js_type_check("closure_compile_jsmodules") {
":files_metadata_entry.m", ":files_metadata_entry.m",
":files_ripple.m", ":files_ripple.m",
":files_safe_media.m", ":files_safe_media.m",
":files_toast.m",
":files_toggle_ripple.m", ":files_toggle_ripple.m",
":files_tooltip.m", ":files_tooltip.m",
] ]
...@@ -250,6 +251,23 @@ js_library("files_toast") { ...@@ -250,6 +251,23 @@ js_library("files_toast") {
] ]
} }
polymer_modulizer("files_toast") {
js_file = "files_toast.js"
html_file = "files_toast.html"
html_type = "dom-module"
preserve_url_scheme = true
}
js_library("files_toast.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/elements/files_toast.m.js" ]
deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_elements/cr_button:cr_button.m",
"//ui/webui/resources/cr_elements/cr_toast:cr_toast.m",
]
extra_deps = [ ":files_toast_module" ]
}
# TODO(tapted): Move this to //ui/file_manager/base. # TODO(tapted): Move this to //ui/file_manager/base.
js_library("files_toggle_ripple") { js_library("files_toggle_ripple") {
visibility += [ "//ui/file_manager/gallery/*" ] visibility += [ "//ui/file_manager/gallery/*" ]
...@@ -300,10 +318,10 @@ js_library("files_tooltip.m") { ...@@ -300,10 +318,10 @@ js_library("files_tooltip.m") {
extra_deps = [ ":files_tooltip_module" ] extra_deps = [ ":files_tooltip_module" ]
} }
js_unittest("files_toast_unittest") { js_unittest("files_toast_unittest.m") {
deps = [ deps = [
":files_toast", ":files_toast.m",
"//ui/webui/resources/js:webui_resource_test", "//chrome/test/data/webui:chai_assert",
] ]
} }
...@@ -319,7 +337,6 @@ js_test_gen_html("js_test_gen_html") { ...@@ -319,7 +337,6 @@ js_test_gen_html("js_test_gen_html") {
deps = [ deps = [
":files_message_unittest", ":files_message_unittest",
":files_password_dialog_unittest", ":files_password_dialog_unittest",
":files_toast_unittest",
":files_xf_elements_unittest", ":files_xf_elements_unittest",
] ]
html_import = true html_import = true
...@@ -344,7 +361,10 @@ js_library("xf_display_panel") { ...@@ -344,7 +361,10 @@ js_library("xf_display_panel") {
js_test_gen_html("js_test_gen_html_modules") { js_test_gen_html("js_test_gen_html_modules") {
is_polymer3 = true is_polymer3 = true
deps = [ ":files_tooltip_unittest.m" ] deps = [
":files_toast_unittest.m",
":files_tooltip_unittest.m",
]
closure_flags = closure_flags =
strict_error_checking_closure_args + [ strict_error_checking_closure_args + [
......
...@@ -49,6 +49,5 @@ ...@@ -49,6 +49,5 @@
<cr-button class="action" id="action" on-tap="onActionTapped_"></cr-button> <cr-button class="action" id="action" on-tap="onActionTapped_"></cr-button>
</cr-toast> </cr-toast>
</template> </template>
<script src="files_toast.js"></script> <script src="files_toast.js"></script>
</dom-module> </dom-module>
...@@ -27,7 +27,7 @@ let FilesToastData; ...@@ -27,7 +27,7 @@ let FilesToastData;
* toast.show('Toast with action', {text: 'Action', callback:function(){}}); * toast.show('Toast with action', {text: 'Action', callback:function(){}});
* toast.hide(); * toast.hide();
*/ */
const FilesToast = Polymer({ /* #export */ const FilesToast = Polymer({
is: 'files-toast', is: 'files-toast',
properties: { properties: {
......
...@@ -2,11 +2,16 @@ ...@@ -2,11 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
function setUpPage() { // clang-format off
import {assertEquals, assertFalse, assertTrue} from 'chrome://test/chai_assert.js';
import {FilesToast} from './files_toast.m.js';
// clang-format on
export function setUpPage() {
document.body.innerHTML += '<files-toast></files-toast>'; document.body.innerHTML += '<files-toast></files-toast>';
} }
async function testToast(done) { export async function testToast(done) {
/** @type {FilesToast|Element} */ /** @type {FilesToast|Element} */
const toast = document.querySelector('files-toast'); const toast = document.querySelector('files-toast');
const text = toast.shadowRoot.querySelector('#text'); const text = toast.shadowRoot.querySelector('#text');
......
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