| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Returns the HTML element for the |field|. | 6 * Returns the HTML element for the |field|. |
| 7 * @param {string} field The field name for the element. | 7 * @param {string} field The field name for the element. |
| 8 * @return {HTMLElement} The HTML element. | 8 * @return {HTMLElement} The HTML element. |
| 9 */ | 9 */ |
| 10 function getField(field) { | 10 function getField(field) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 assertEquals(this.browsePreload, document.location.href); | 188 assertEquals(this.browsePreload, document.location.href); |
| 189 | 189 |
| 190 var phoneList = getField('phone'); | 190 var phoneList = getField('phone'); |
| 191 expectEquals(0, phoneList.validationRequests_); | 191 expectEquals(0, phoneList.validationRequests_); |
| 192 phoneList.doneValidating().then(function() { | 192 phoneList.doneValidating().then(function() { |
| 193 phoneList.focus(); | 193 phoneList.focus(); |
| 194 var input = phoneList.querySelector('input'); | 194 var input = phoneList.querySelector('input'); |
| 195 input.focus(); | 195 input.focus(); |
| 196 document.execCommand('insertText', false, '111-222-333'); | 196 document.execCommand('insertText', false, '111-222-333'); |
| 197 assertEquals('111-222-333', input.value); | 197 assertEquals('111-222-333', input.value); |
| 198 input.blur(); | 198 // TODO(bondd, dbeam): The way that focus/blur interact with the testing |
| 199 // system is rather confusing. The next line was originally |
| 200 // input.blur(); |
| 201 // but the test would time out when run as a single test locally (i.e. |
| 202 // --gtest_filter=<test_name>), and complete successfully when other tests |
| 203 // were run first (e.g. by the trybot, or locally with a wider |
| 204 // gtest_filter). Changing the line to |
| 205 // phoneList.blur(); |
| 206 // makes the result more deterministic when the test is run by itself. |
| 207 // |
| 208 // phoneList.blur() calls cr.ui.List.handleElementBlur_, which triggers |
| 209 // InlineEditableItemList.handleListFocusChange_, which sends the |
| 210 // 'commitedit' event. |
| 211 phoneList.blur(); |
| 199 phoneList.doneValidating().then(testDone); | 212 phoneList.doneValidating().then(testDone); |
| 200 }); | 213 }); |
| 201 }); | 214 }); |
| OLD | NEW |