function selectFirstListItem(windowId) {
  return Promise.resolve().then(function() {
    // Ensure no selected item.
    return remoteCall.waitForElementLost(
        windowId,
        'div.detail-table > list > li[selected]');
  }).then(function() {
    // Push Down.
    return remoteCall.callRemoteTestUtil(
        'fakeKeyDown', windowId,
        // Down
        ['#file-list', 'ArrowDown', 'Down', true, false, false]);
  }).then(function() {
    // Wait for selection.
    return remoteCall.waitForElement(windowId,
                                     'div.detail-table > list > li[selected]');
  }).then(function() {
    // Ensure that only the first item is selected.
    return remoteCall.callRemoteTestUtil(
        'queryAllElements',
        windowId,
        ['div.detail-table > list > li[selected]']);
  }).then(function(elements) {
    chrome.test.assertEq(1, elements.length);
    chrome.test.assertEq('listitem-1', elements[0].attributes['id']);
  });
}
/**
 * Selects the first item in the file list.
 * @param {string} windowId ID of the target window.
 * @return {Promise} Promise to be fulfilled on success.
 */
Selects the first item in the file list.
@param {string} windowId ID of the target window.
@return {Promise} Promise to be fulfilled on success.
Selects the first item in the file list . @param { string } windowId ID of the target window . @return { Promise } Promise to be fulfilled on success .
function selectFirstListItem(windowId) {
  return Promise.resolve().then(function() {
    return remoteCall.waitForElementLost(
        windowId,
        'div.detail-table > list > li[selected]');
  }).then(function() {
    return remoteCall.callRemoteTestUtil(
        'fakeKeyDown', windowId,
        ['#file-list', 'ArrowDown', 'Down', true, false, false]);
  }).then(function() {
    return remoteCall.waitForElement(windowId,
                                     'div.detail-table > list > li[selected]');
  }).then(function() {
    return remoteCall.callRemoteTestUtil(
        'queryAllElements',
        windowId,
        ['div.detail-table > list > li[selected]']);
  }).then(function(elements) {
    chrome.test.assertEq(1, elements.length);
    chrome.test.assertEq('listitem-1', elements[0].attributes['id']);
  });
}
function selectFirstListItem ( windowId ) { return Promise . resolve ( ) . then ( function ( ) { return remoteCall . waitForElementLost ( windowId , 'div.detail-table > list > li[selected]' ) ; } ) . then ( function ( ) { return remoteCall . callRemoteTestUtil ( 'fakeKeyDown' , windowId , [ '#file-list' , 'ArrowDown' , 'Down' , true , false , false ] ) ; } ) . then ( function ( ) { return remoteCall . waitForElement ( windowId , 'div.detail-table > list > li[selected]' ) ; } ) . then ( function ( ) { return remoteCall . callRemoteTestUtil ( 'queryAllElements' , windowId , [ 'div.detail-table > list > li[selected]' ] ) ; } ) . then ( function ( elements ) { chrome . test . assertEq ( 1 , elements . length ) ; chrome . test . assertEq ( 'listitem-1' , elements [ 0 ] . attributes [ 'id' ] ) ; } ) ; }
Selects the first item in the file list.
Selects the first item in the file list .
// Ensure no selected item. // Push Down. // Down // Wait for selection. // Ensure that only the first item is selected.