B2G/gecko/browser/components/sessionstore/test/browser_662743.js
// check its value as well.
check its value as well.
check its value as well .
function test() {
  waitForExplicitFinish();
  let testTabCount = 0;
  let formData = [
    { },
    { "#select_id" : 0 },
    { "#select_id" : 2 },
    { "#select_id" : 8 },
    { "/xhtml:html/xhtml:body/xhtml:select" : 5},
    { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : 6},
    { id:{ "select_id": {"selectedIndex":0,"value":"val2"} } },
    { id:{ "select_id": {"selectedIndex":4,"value":"val8"} } },
    { id:{ "select_id": {"selectedIndex":8,"value":"val5"} } },
    { id:{ "select_id": {"selectedIndex":0,"value":"val0"} }, xpath: {} },
    { id:{},"xpath":{ "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']": {"selectedIndex":1,"value":"val7"} } },
    { xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":3,"value":"val3"} } },
    { id:{ "select_id": {"selectedIndex":3,"value":"val4"} } },
    { "#select_id" : 3, id:{ "select_id": {"selectedIndex":1,"value":"val1"} } },
    { "#select_id" : 5, xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":4,"value":"val4"} } },
    { "/xhtml:html/xhtml:body/xhtml:select" : 5, id:{ "select_id": {"selectedIndex":1,"value":"val1"} }},
    { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : 2, xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":7,"value":"val7"} } }
  ];
  let expectedValues = [
    [ "val3"], 
    [ "val0"],
    [ "val2"],
    [ "val3"],  (invalid index)
    [ "val5"],
    [ "val6"],
    [ "val2"],
    [ "val3"],  (invalid value)
    [ "val5"], 
    [ "val0"],
    [ "val7"],
    [ "val3"],
    [ "val4"],
    [ "val1"],
    [ "val4"],
    [ "val1"],
    [ "val7"]
  ];
  let callback = function() {
    testTabCount--;
    if (testTabCount == 0) {
      finish();
    }
  };
  for (let i = 0; i < formData.length; i++) {
    testTabCount++;
    testTabRestoreData(formData[i], expectedValues[i], callback);
  }
}
function test ( ) { waitForExplicitFinish ( ) ; let testTabCount = 0 ; let formData = [ { } , { "#select_id" : 0 } , { "#select_id" : 2 } , { "#select_id" : 8 } , { "/xhtml:html/xhtml:body/xhtml:select" : 5 } , { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : 6 } , { id : { "select_id" : { "selectedIndex" : 0 , "value" : "val2" } } } , { id : { "select_id" : { "selectedIndex" : 4 , "value" : "val8" } } } , { id : { "select_id" : { "selectedIndex" : 8 , "value" : "val5" } } } , { id : { "select_id" : { "selectedIndex" : 0 , "value" : "val0" } } , xpath : { } } , { id : { } , "xpath" : { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : { "selectedIndex" : 1 , "value" : "val7" } } } , { xpath : { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : { "selectedIndex" : 3 , "value" : "val3" } } } , { id : { "select_id" : { "selectedIndex" : 3 , "value" : "val4" } } } , { "#select_id" : 3 , id : { "select_id" : { "selectedIndex" : 1 , "value" : "val1" } } } , { "#select_id" : 5 , xpath : { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : { "selectedIndex" : 4 , "value" : "val4" } } } , { "/xhtml:html/xhtml:body/xhtml:select" : 5 , id : { "select_id" : { "selectedIndex" : 1 , "value" : "val1" } } } , { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : 2 , xpath : { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : { "selectedIndex" : 7 , "value" : "val7" } } } ] ; let expectedValues = [ [ "val3" ] , [ "val0" ] , [ "val2" ] , [ "val3" ] , [ "val5" ] , [ "val6" ] , [ "val2" ] , [ "val3" ] , [ "val5" ] , [ "val0" ] , [ "val7" ] , [ "val3" ] , [ "val4" ] , [ "val1" ] , [ "val4" ] , [ "val1" ] , [ "val7" ] ] ; let callback = function ( ) { testTabCount -- ; if ( testTabCount == 0 ) { finish ( ) ; } } ; for ( let i = 0 ; i < formData . length ; i ++ ) { testTabCount ++ ; testTabRestoreData ( formData [ i ] , expectedValues [ i ] , callback ) ; } }
check its value as well.
check its value as well .
/** Tests selected options **/ // default case // old format // invalid index // new format // index doesn't match value (testing an option in between (two)) // index doesn't match value (testing an invalid value) // index doesn't match value (testing an invalid index) // index and value match position zero // index doesn't match value (testing the last option (seven)) // index and value match the default option "selectedIndex":3,"value":"val3" // index matches default option however it doesn't match value // combinations // default value // default value (invalid index) // default value (invalid value) // value is still valid (even it has an invalid index)