Commit fef4af49 authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI: Replace remaining usages of MockInteractions.tap()

In most cases it is replaced with native click(), and in one case
replaced with MockInteractions.down().

Fixed: 812035
Change-Id: I977d3f920a37dc494c78d22ab901c9a4f61b12c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2468178
Commit-Queue: John Lee <johntlee@chromium.org>
Auto-Submit: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817081}
parent 0b926446
...@@ -5,7 +5,16 @@ ...@@ -5,7 +5,16 @@
module.exports = { module.exports = {
'env': {'browser': true, 'es6': true}, 'env': {'browser': true, 'es6': true},
'rules': { 'rules': {
'no-restricted-properties': 'off', 'no-restricted-properties': [
'error',
{
'object': 'MockInteractions',
'property': 'tap',
'message': 'Do not use on-tap handlers in prod code, and use the ' +
'native click() method in tests. See more context at ' +
'crbug.com/812035.',
},
],
'no-var': 'off', 'no-var': 'off',
'prefer-const': 'off', 'prefer-const': 'off',
'eqeqeq': ['error', 'always', {'null': 'ignore'}], 'eqeqeq': ['error', 'always', {'null': 'ignore'}],
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import {HIDE_FOCUS_RING_ATTRIBUTE, LOCAL_STORAGE_FOLDER_STATE_KEY, LOCAL_STORAGE_TREE_WIDTH_KEY} from 'chrome://bookmarks/bookmarks.js'; import {HIDE_FOCUS_RING_ATTRIBUTE, LOCAL_STORAGE_FOLDER_STATE_KEY, LOCAL_STORAGE_TREE_WIDTH_KEY} from 'chrome://bookmarks/bookmarks.js';
import {isMac} from 'chrome://resources/js/cr.m.js'; import {isMac} from 'chrome://resources/js/cr.m.js';
import {getDeepActiveElement} from 'chrome://resources/js/util.m.js'; import {getDeepActiveElement} from 'chrome://resources/js/util.m.js';
import {keyDownOn, pressAndReleaseKeyOn, tap} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {down, keyDownOn, pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
import {TestStore} from 'chrome://test/bookmarks/test_store.js'; import {TestStore} from 'chrome://test/bookmarks/test_store.js';
import {createFolder, normalizeIterable, replaceBody} from 'chrome://test/bookmarks/test_util.js'; import {createFolder, normalizeIterable, replaceBody} from 'chrome://test/bookmarks/test_util.js';
import {flushTasks} from 'chrome://test/test_util.m.js'; import {flushTasks} from 'chrome://test/test_util.m.js';
...@@ -85,7 +85,7 @@ suite('<bookmarks-app>', function() { ...@@ -85,7 +85,7 @@ suite('<bookmarks-app>', function() {
assertEquals(null, getFocusAttribute()); assertEquals(null, getFocusAttribute());
tap(item); down(item);
assertEquals('', getFocusAttribute()); assertEquals('', getFocusAttribute());
keyDownOn(item, 16, [], 'Shift'); keyDownOn(item, 16, [], 'Shift');
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import {Command, CommandManager, createBookmark, DialogFocusManager, getDisplayedList, MenuSource, selectFolder} from 'chrome://bookmarks/bookmarks.js'; import {Command, CommandManager, createBookmark, DialogFocusManager, getDisplayedList, MenuSource, selectFolder} from 'chrome://bookmarks/bookmarks.js';
import {isMac} from 'chrome://resources/js/cr.m.js'; import {isMac} from 'chrome://resources/js/cr.m.js';
import {pressAndReleaseKeyOn, tap} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {TestCommandManager} from 'chrome://test/bookmarks/test_command_manager.js'; import {TestCommandManager} from 'chrome://test/bookmarks/test_command_manager.js';
import {TestStore} from 'chrome://test/bookmarks/test_store.js'; import {TestStore} from 'chrome://test/bookmarks/test_store.js';
...@@ -322,7 +322,7 @@ suite('<bookmarks-command-manager>', function() { ...@@ -322,7 +322,7 @@ suite('<bookmarks-command-manager>', function() {
assertTrue(dialog.open); assertTrue(dialog.open);
// Pressing 'cancel' should not open the window. // Pressing 'cancel' should not open the window.
tap(dialog.querySelector('.cancel-button')); dialog.querySelector('.cancel-button').click();
assertFalse(dialog.open); assertFalse(dialog.open);
assertEquals(null, lastCreate); assertEquals(null, lastCreate);
...@@ -330,7 +330,7 @@ suite('<bookmarks-command-manager>', function() { ...@@ -330,7 +330,7 @@ suite('<bookmarks-command-manager>', function() {
assertTrue(dialog.open); assertTrue(dialog.open);
// Pressing 'yes' will open all the URLs. // Pressing 'yes' will open all the URLs.
tap(dialog.querySelector('.action-button')); dialog.querySelector('.action-button').click();
assertFalse(dialog.open); assertFalse(dialog.open);
assertEquals(20, lastCreate.url.length); assertEquals(20, lastCreate.url.length);
}); });
...@@ -394,13 +394,13 @@ suite('<bookmarks-command-manager>', function() { ...@@ -394,13 +394,13 @@ suite('<bookmarks-command-manager>', function() {
commandManager.root.querySelectorAll('.dropdown-item').forEach(element => { commandManager.root.querySelectorAll('.dropdown-item').forEach(element => {
commandItem[element.getAttribute('command')] = element; commandItem[element.getAttribute('command')] = element;
}); });
tap(commandItem[Command.EDIT]); commandItem[Command.EDIT].click();
testCommandManager.assertLastCommand(null); testCommandManager.assertLastCommand(null);
}); });
test('keyboard shortcuts are disabled while a dialog is open', function() { test('keyboard shortcuts are disabled while a dialog is open', function() {
assertFalse(DialogFocusManager.getInstance().hasOpenDialog()); assertFalse(DialogFocusManager.getInstance().hasOpenDialog());
let items = new Set(['12']); const items = new Set(['12']);
store.data.selection.items = items; store.data.selection.items = items;
store.notifyObservers(); store.notifyObservers();
...@@ -590,8 +590,8 @@ suite('<bookmarks-item> CommandManager integration', function() { ...@@ -590,8 +590,8 @@ suite('<bookmarks-item> CommandManager integration', function() {
}); });
test('copy/cut/paste for folder nodes independent of selection', function() { test('copy/cut/paste for folder nodes independent of selection', function() {
let bmpCopyFunction = chrome.bookmarkManagerPrivate.copy; const bmpCopyFunction = chrome.bookmarkManagerPrivate.copy;
let bmpCutFunction = chrome.bookmarkManagerPrivate.cut; const bmpCutFunction = chrome.bookmarkManagerPrivate.cut;
let lastCut; let lastCut;
let lastCopy; let lastCopy;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import {navigation, Page} from 'chrome://extensions/extensions.js'; import {navigation, Page} from 'chrome://extensions/extensions.js';
import {assert} from 'chrome://resources/js/assert.m.js'; import {assert} from 'chrome://resources/js/assert.m.js';
import {tap} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {isChildVisible} from '../test_util.m.js'; import {isChildVisible} from '../test_util.m.js';
...@@ -177,14 +176,14 @@ suite(extension_item_tests.suiteName, function() { ...@@ -177,14 +176,14 @@ suite(extension_item_tests.suiteName, function() {
currentPage = newPage; currentPage = newPage;
}); });
tap(item.$$('#detailsButton')); item.$$('#detailsButton').click();
expectDeepEquals( expectDeepEquals(
currentPage, {page: Page.DETAILS, extensionId: item.data.id}); currentPage, {page: Page.DETAILS, extensionId: item.data.id});
// Reset current page and test inspect-view navigation. // Reset current page and test inspect-view navigation.
navigation.navigateTo({page: Page.LIST}); navigation.navigateTo({page: Page.LIST});
currentPage = null; currentPage = null;
tap(item.$$('#inspect-views a[is="action-link"]:nth-of-type(2)')); item.$$('#inspect-views a[is="action-link"]:nth-of-type(2)').click();
expectDeepEquals( expectDeepEquals(
currentPage, {page: Page.DETAILS, extensionId: item.data.id}); currentPage, {page: Page.DETAILS, extensionId: item.data.id});
...@@ -239,7 +238,7 @@ suite(extension_item_tests.suiteName, function() { ...@@ -239,7 +238,7 @@ suite(extension_item_tests.suiteName, function() {
}); });
}; };
tap(item.$$('#dev-reload-button')); item.$$('#dev-reload-button').click();
return proxyDelegate.whenCalled('reloadItem') return proxyDelegate.whenCalled('reloadItem')
.then(function(id) { .then(function(id) {
expectEquals(item.data.id, id); expectEquals(item.data.id, id);
...@@ -248,7 +247,7 @@ suite(extension_item_tests.suiteName, function() { ...@@ -248,7 +247,7 @@ suite(extension_item_tests.suiteName, function() {
.then(function() { .then(function() {
proxyDelegate.resetResolver('reloadItem'); proxyDelegate.resetResolver('reloadItem');
proxyDelegate.setForceReloadItemError(true); proxyDelegate.setForceReloadItemError(true);
tap(item.$$('#dev-reload-button')); item.$$('#dev-reload-button').click();
return proxyDelegate.whenCalled('reloadItem'); return proxyDelegate.whenCalled('reloadItem');
}) })
.then(function(id) { .then(function(id) {
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
/** @fileoverview Suite of tests for extension-sidebar. */ /** @fileoverview Suite of tests for extension-sidebar. */
import {navigation, Page} from 'chrome://extensions/extensions.js'; import {navigation, Page} from 'chrome://extensions/extensions.js';
import {assert} from 'chrome://resources/js/assert.m.js'; import {assert} from 'chrome://resources/js/assert.m.js';
import {tap} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {eventToPromise} from '../test_util.m.js'; import {eventToPromise} from '../test_util.m.js';
...@@ -72,14 +71,14 @@ suite(extension_sidebar_tests.suiteName, function() { ...@@ -72,14 +71,14 @@ suite(extension_sidebar_tests.suiteName, function() {
currentPage = newPage; currentPage = newPage;
}); });
tap(sidebar.$$('#sections-shortcuts')); sidebar.$$('#sections-shortcuts').click();
expectDeepEquals(currentPage, {page: Page.SHORTCUTS}); expectDeepEquals(currentPage, {page: Page.SHORTCUTS});
tap(sidebar.$$('#sections-extensions')); sidebar.$$('#sections-extensions').click();
expectDeepEquals(currentPage, {page: Page.LIST}); expectDeepEquals(currentPage, {page: Page.LIST});
// Clicking on the link for the current page should close the dialog. // Clicking on the link for the current page should close the dialog.
sidebar.addEventListener('close-drawer', () => done()); sidebar.addEventListener('close-drawer', () => done());
tap(sidebar.$$('#sections-extensions')); sidebar.$$('#sections-extensions').click();
}); });
}); });
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
import {ensureLazyLoaded} from 'chrome://history/history.js'; import {ensureLazyLoaded} from 'chrome://history/history.js';
import {pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
import {createSession, createWindow, polymerSelectAll} from 'chrome://test/history/test_util.js'; import {createSession, createWindow, polymerSelectAll} from 'chrome://test/history/test_util.js';
import {flushTasks} from 'chrome://test/test_util.m.js'; import {flushTasks} from 'chrome://test/test_util.m.js';
import {pressAndReleaseKeyOn, tap} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
suite('<history-synced-device-manager>', function() { suite('<history-synced-device-manager>', function() {
let element; let element;
...@@ -61,7 +61,7 @@ suite('<history-synced-device-manager>', function() { ...@@ -61,7 +61,7 @@ suite('<history-synced-device-manager>', function() {
pressAndReleaseKeyOn(focused, 38, [], 'ArrowUp'); pressAndReleaseKeyOn(focused, 38, [], 'ArrowUp');
focused = cards[0].$['collapse-button']; focused = cards[0].$['collapse-button'];
assertEquals(focused, lastFocused); assertEquals(focused, lastFocused);
tap(focused); focused.click();
await flushTasks(); await flushTasks();
// Pressing down goes to the next card. // Pressing down goes to the next card.
...@@ -73,7 +73,7 @@ suite('<history-synced-device-manager>', function() { ...@@ -73,7 +73,7 @@ suite('<history-synced-device-manager>', function() {
pressAndReleaseKeyOn(focused, 38, [], 'ArrowUp'); pressAndReleaseKeyOn(focused, 38, [], 'ArrowUp');
focused = cards[0].$['collapse-button']; focused = cards[0].$['collapse-button'];
assertEquals(focused, lastFocused); assertEquals(focused, lastFocused);
tap(focused); focused.click();
await flushTasks(); await flushTasks();
// First card's urls are focusable again. // First card's urls are focusable again.
......
...@@ -75,7 +75,7 @@ cr.define('multidevice_setup', () => { ...@@ -75,7 +75,7 @@ cr.define('multidevice_setup', () => {
startSetupPageElement.$.deviceDropdown.querySelectorAll('option'); startSetupPageElement.$.deviceDropdown.querySelectorAll('option');
for (option of optionNodeList.values()) { for (option of optionNodeList.values()) {
if (option.textContent.trim() === optionText) { if (option.textContent.trim() === optionText) {
MockInteractions.tap(option); option.click();
return; return;
} }
} }
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
module.exports = { module.exports = {
'rules': { 'rules': {
'no-restricted-properties': [
'error',
{
'object': 'MockInteractions',
'property': 'tap',
'message': 'Do not use on-tap handlers in prod code, and use the ' +
'native click() method in tests. See more context at ' +
'crbug.com/812035.',
},
],
'no-var': 'error', 'no-var': 'error',
'prefer-const': 'error', 'prefer-const': 'error',
'eqeqeq': ['error', 'always', {'null': 'ignore'}], 'eqeqeq': ['error', 'always', {'null': 'ignore'}],
......
...@@ -30,7 +30,7 @@ suite('SettingsCheckbox', function() { ...@@ -30,7 +30,7 @@ suite('SettingsCheckbox', function() {
document.body.appendChild(testElement); document.body.appendChild(testElement);
}); });
test('value changes on tap', function() { test('value changes on click', function() {
assertTrue(testElement.checked); assertTrue(testElement.checked);
testElement.$.checkbox.click(); testElement.$.checkbox.click();
......
...@@ -34,7 +34,7 @@ suite('SettingsToggleButton', () => { ...@@ -34,7 +34,7 @@ suite('SettingsToggleButton', () => {
document.body.appendChild(testElement); document.body.appendChild(testElement);
}); });
test('value changes on tap', () => { test('value changes on click', () => {
assertTrue(testElement.checked); assertTrue(testElement.checked);
assertTrue(testElement.pref.value); assertTrue(testElement.pref.value);
......
...@@ -20,17 +20,17 @@ LineChartTest.Menu = function() { ...@@ -20,17 +20,17 @@ LineChartTest.Menu = function() {
assertEquals(menu.buttons_.length, 3); assertEquals(menu.buttons_.length, 3);
const buttons = menu.buttons_; const buttons = menu.buttons_;
MockInteractions.tap(buttons[0]); buttons[0].click();
assertFalse(data1.isVisible()); assertFalse(data1.isVisible());
MockInteractions.tap(buttons[2]); buttons[2].click();
assertFalse(data3.isVisible()); assertFalse(data3.isVisible());
MockInteractions.tap(buttons[0]); buttons[0].click();
assertTrue(data1.isVisible()); assertTrue(data1.isVisible());
assertFalse(menu.buttonOuterDiv_.hasAttribute('hidden')); assertFalse(menu.buttonOuterDiv_.hasAttribute('hidden'));
MockInteractions.tap(menu.handleDiv_); menu.handleDiv_.click();
assertTrue(menu.buttonOuterDiv_.hasAttribute('hidden')); assertTrue(menu.buttonOuterDiv_.hasAttribute('hidden'));
MockInteractions.tap(menu.handleDiv_); menu.handleDiv_.click();
assertFalse(menu.buttonOuterDiv_.hasAttribute('hidden')); assertFalse(menu.buttonOuterDiv_.hasAttribute('hidden'));
menu.removeDataSeries(data1); menu.removeDataSeries(data1);
......
...@@ -47,16 +47,16 @@ PageTest.Drawer = function() { ...@@ -47,16 +47,16 @@ PageTest.Drawer = function() {
}); });
function openByButton() { function openByButton() {
MockInteractions.tap($('nav-menu-btn')); $('nav-menu-btn').click();
} }
function closeByClickBackground() { function closeByClickBackground() {
MockInteractions.tap($('sys-internals-drawer')); $('sys-internals-drawer').click();
} }
function closeByClickInfoPageButton() { function closeByClickInfoPageButton() {
const infoPageBtn = document.getElementsByClassName('drawer-item')[0]; const infoPageBtn = document.getElementsByClassName('drawer-item')[0];
MockInteractions.tap(infoPageBtn); infoPageBtn.click();
} }
test('Tap to open and close', function() { test('Tap to open and close', function() {
......
...@@ -58,9 +58,9 @@ PageTest.Switch = function() { ...@@ -58,9 +58,9 @@ PageTest.Switch = function() {
} }
function clickDrawerBtn(btnIndex) { function clickDrawerBtn(btnIndex) {
MockInteractions.tap($('nav-menu-btn')); $('nav-menu-btn').click();
const infoBtn = document.getElementsByClassName('drawer-item')[btnIndex]; const infoBtn = document.getElementsByClassName('drawer-item')[btnIndex];
MockInteractions.tap(infoBtn); infoBtn.click();
} }
function goPage(hash, btnIndex) { function goPage(hash, btnIndex) {
......
...@@ -54,13 +54,13 @@ cr.define('user_manager.control_bar_tests', function() { ...@@ -54,13 +54,13 @@ cr.define('user_manager.control_bar_tests', function() {
}); });
// Simulate clicking 'Create Profile'. // Simulate clicking 'Create Profile'.
MockInteractions.tap(controlBarElement.$.addUser); controlBarElement.$.addUser.click();
}); });
}); });
test('Can launch guest profile', function() { test('Can launch guest profile', function() {
// Simulate clicking 'Browse as guest'. // Simulate clicking 'Browse as guest'.
MockInteractions.tap(controlBarElement.$.launchGuest); controlBarElement.$.launchGuest.click();
return browserProxy.whenCalled('launchGuestUser'); return browserProxy.whenCalled('launchGuestUser');
}); });
}); });
...@@ -93,7 +93,7 @@ cr.define('user_manager.control_bar_tests', function() { ...@@ -93,7 +93,7 @@ cr.define('user_manager.control_bar_tests', function() {
test('Cannot create profile', function() { test('Cannot create profile', function() {
// Simulate clicking 'Create Profile'. // Simulate clicking 'Create Profile'.
MockInteractions.tap(controlBarElement.$.addUser); controlBarElement.$.addUser.click();
return browserProxy.whenCalled('areAllProfilesLocked').then(function() { return browserProxy.whenCalled('areAllProfilesLocked').then(function() {
// Make sure DOM is up to date. // Make sure DOM is up to date.
...@@ -106,7 +106,7 @@ cr.define('user_manager.control_bar_tests', function() { ...@@ -106,7 +106,7 @@ cr.define('user_manager.control_bar_tests', function() {
test('Cannot launch guest profile', function() { test('Cannot launch guest profile', function() {
// Simulate clicking 'Browse as guest'. // Simulate clicking 'Browse as guest'.
MockInteractions.tap(controlBarElement.$.launchGuest); controlBarElement.$.launchGuest.click();
return browserProxy.whenCalled('areAllProfilesLocked').then(function() { return browserProxy.whenCalled('areAllProfilesLocked').then(function() {
// Make sure DOM is up to date. // Make sure DOM is up to date.
...@@ -129,14 +129,14 @@ cr.define('user_manager.control_bar_tests', function() { ...@@ -129,14 +129,14 @@ cr.define('user_manager.control_bar_tests', function() {
}); });
// Simulate clicking 'Create Profile'. // Simulate clicking 'Create Profile'.
MockInteractions.tap(controlBarElement.$.addUser); controlBarElement.$.addUser.click();
}); });
}); });
test('Can launch guest profile with force sign in', function() { test('Can launch guest profile with force sign in', function() {
controlBarElement.isForceSigninEnabled_ = true; controlBarElement.isForceSigninEnabled_ = true;
Polymer.dom.flush(); Polymer.dom.flush();
MockInteractions.tap(controlBarElement.$.launchGuest); controlBarElement.$.launchGuest.click();
return browserProxy.whenCalled('launchGuestUser'); return browserProxy.whenCalled('launchGuestUser');
}); });
}); });
......
...@@ -72,7 +72,7 @@ cr.define('user_manager.create_profile_tests', function() { ...@@ -72,7 +72,7 @@ cr.define('user_manager.create_profile_tests', function() {
createProfileElement.$.nameInput.value = 'profile name'; createProfileElement.$.nameInput.value = 'profile name';
// Simulate clicking 'Create'. // Simulate clicking 'Create'.
MockInteractions.tap(createProfileElement.$.save); createProfileElement.$.save.click();
return browserProxy.whenCalled('createProfile').then(function(args) { return browserProxy.whenCalled('createProfile').then(function(args) {
assertEquals('profile name', args.profileName); assertEquals('profile name', args.profileName);
...@@ -91,7 +91,7 @@ cr.define('user_manager.create_profile_tests', function() { ...@@ -91,7 +91,7 @@ cr.define('user_manager.create_profile_tests', function() {
}); });
// Simulate clicking 'Cancel'. // Simulate clicking 'Cancel'.
MockInteractions.tap(createProfileElement.$.cancel); createProfileElement.$.cancel.click();
}); });
}); });
...@@ -108,7 +108,7 @@ cr.define('user_manager.create_profile_tests', function() { ...@@ -108,7 +108,7 @@ cr.define('user_manager.create_profile_tests', function() {
createProfileElement.$.nameInput.value = 'profile name'; createProfileElement.$.nameInput.value = 'profile name';
// Simulate clicking 'Create'. // Simulate clicking 'Create'.
MockInteractions.tap(createProfileElement.$.save); createProfileElement.$.save.click();
browserProxy.whenCalled('createProfile').then(function(args) { browserProxy.whenCalled('createProfile').then(function(args) {
// The paper-spinner is active when create is in progress. // The paper-spinner is active when create is in progress.
...@@ -129,7 +129,7 @@ cr.define('user_manager.create_profile_tests', function() { ...@@ -129,7 +129,7 @@ cr.define('user_manager.create_profile_tests', function() {
createProfileElement.$.nameInput.value = 'profile name'; createProfileElement.$.nameInput.value = 'profile name';
// Simulate clicking 'Create'. // Simulate clicking 'Create'.
MockInteractions.tap(createProfileElement.$.save); createProfileElement.$.save.click();
return browserProxy.whenCalled('createProfile').then(function(args) { return browserProxy.whenCalled('createProfile').then(function(args) {
cr.webUIListenerCallback('create-profile-error', 'Error Message'); cr.webUIListenerCallback('create-profile-error', 'Error Message');
...@@ -147,7 +147,7 @@ cr.define('user_manager.create_profile_tests', function() { ...@@ -147,7 +147,7 @@ cr.define('user_manager.create_profile_tests', function() {
createProfileElement.$.nameInput.value = 'foo'; createProfileElement.$.nameInput.value = 'foo';
// Simulate clicking 'Create'. // Simulate clicking 'Create'.
MockInteractions.tap(createProfileElement.$.save); createProfileElement.$.save.click();
return browserProxy.whenCalled('createProfile').then(function(args) { return browserProxy.whenCalled('createProfile').then(function(args) {
cr.webUIListenerCallback('create-profile-warning', 'Warning Message'); cr.webUIListenerCallback('create-profile-warning', 'Warning Message');
...@@ -222,10 +222,10 @@ cr.define('user_manager.create_profile_tests', function() { ...@@ -222,10 +222,10 @@ cr.define('user_manager.create_profile_tests', function() {
assertTrue(createShortcutCheckbox.checked); assertTrue(createShortcutCheckbox.checked);
// Simulate unchecking the create shortcut checkbox. // Simulate unchecking the create shortcut checkbox.
MockInteractions.tap(createShortcutCheckbox); createShortcutCheckbox.click();
// Simulate clicking 'Create'. // Simulate clicking 'Create'.
MockInteractions.tap(createProfileElement.$.save); createProfileElement.$.save.click();
return browserProxy.whenCalled('createProfile').then(function(args) { return browserProxy.whenCalled('createProfile').then(function(args) {
assertEquals('profile name', args.profileName); assertEquals('profile name', args.profileName);
...@@ -244,7 +244,7 @@ cr.define('user_manager.create_profile_tests', function() { ...@@ -244,7 +244,7 @@ cr.define('user_manager.create_profile_tests', function() {
assertTrue(createShortcutCheckbox.checked); assertTrue(createShortcutCheckbox.checked);
// Simulate clicking 'Create'. // Simulate clicking 'Create'.
MockInteractions.tap(createProfileElement.$.save); createProfileElement.$.save.click();
return browserProxy.whenCalled('createProfile').then(function(args) { return browserProxy.whenCalled('createProfile').then(function(args) {
assertEquals('profile name', args.profileName); assertEquals('profile name', args.profileName);
......
...@@ -4,16 +4,6 @@ ...@@ -4,16 +4,6 @@
module.exports = { module.exports = {
'rules': { 'rules': {
'no-restricted-properties': [
'error',
{
'object': 'MockInteractions',
'property': 'tap',
'message': 'Do not use on-tap handlers in prod code, and use the ' +
'native click() method in tests. See more context at ' +
'crbug.com/812035.',
},
],
'no-var': 'error', 'no-var': 'error',
'prefer-const': 'error', 'prefer-const': 'error',
}, },
......
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