Commit 08c470fc authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

WebUI: Add test to JS module version of cr.ui.Grid

Bug: 1133198
Change-Id: Idd34346986ab6157713792b218400a096cc5f435
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2474314
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818805}
parent 59bfd3e6
...@@ -441,6 +441,7 @@ group("modulize") { ...@@ -441,6 +441,7 @@ group("modulize") {
"./cr_components:modulize", "./cr_components:modulize",
"./cr_components/chromeos:modulize", "./cr_components/chromeos:modulize",
"./cr_elements:modulize", "./cr_elements:modulize",
"./js/cr/ui:modulize",
"./resources:modulize", "./resources:modulize",
"./settings:modulize", "./settings:modulize",
] ]
......
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//ui/webui/resources/tools/js_modulizer.gni")
group("modulize") {
deps = [ ":modulize_local" ]
}
js_modulizer("modulize_local") {
input_files = [ "grid_test.js" ]
namespace_rewrites = [
"cr.ui.Grid|Grid",
"cr.ui.ArrayDataModel|ArrayDataModel",
]
}
...@@ -2,7 +2,12 @@ ...@@ -2,7 +2,12 @@
// 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 testGetColumnCount() { // clang-format off
// #import {Grid} from 'chrome://resources/js/cr/ui/grid.m.js';
// #import {ArrayDataModel} from 'chrome://resources/js/cr/ui/array_data_model.m.js';
// clang-format on
/* #export */ function testGetColumnCount() {
var g = cr.ui.Grid.prototype; var g = cr.ui.Grid.prototype;
g.measured_ = { g.measured_ = {
height: 8, height: 8,
...@@ -78,3 +83,5 @@ function testGetColumnCount() { ...@@ -78,3 +83,5 @@ function testGetColumnCount() {
// Can not fit two columns due to bigger horizontal padding. // Can not fit two columns due to bigger horizontal padding.
assertEquals(1, columns); assertEquals(1, columns);
} }
window.testGetColumnCount = testGetColumnCount;
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/string_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
...@@ -124,6 +125,10 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListTest) { ...@@ -124,6 +125,10 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListTest) {
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, GridTest) { IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, GridTest) {
LoadTestUrl("js/cr/ui/grid_test.html"); LoadTestUrl("js/cr/ui/grid_test.html");
} }
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, GridModuleTest) {
LoadTestUrl("?module=js/cr/ui/grid_test.m.js");
}
#endif #endif
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListSelectionModelTest) { IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListSelectionModelTest) {
......
...@@ -46,6 +46,8 @@ template("js_modulizer") { ...@@ -46,6 +46,8 @@ template("js_modulizer") {
[ "$target_gen_dir/" + get_path_info(_input, "name") + ".m.js" ] [ "$target_gen_dir/" + get_path_info(_input, "name") + ".m.js" ]
} }
data = outputs
args = [ args = [
"--in_folder", "--in_folder",
rebase_path(".", root_build_dir), rebase_path(".", root_build_dir),
......
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