B2G/gecko/browser/base/content/test/browser_bug561636.js
/**
 * In this test, we check that the message is correctly updated when it changes.
 */
In this test, we check that the message is correctly updated when it changes.
In this test we check that the message is correctly updated when it changes .
function test10()
{
  let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input type='email' required id='i'><input id='s' type='submit'></form>";
  let tab = gBrowser.addTab();
  gInvalidFormPopup.addEventListener("popupshown", function() {
    gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
    let doc = gBrowser.contentDocument;
    let input = doc.getElementById('i');
    is(doc.activeElement, input, "First invalid element should be focused");
    checkPopupShow();
    is(gInvalidFormPopup.firstChild.textContent, input.validationMessage,
       "The panel should show the current validation message");
    input.addEventListener('input', function() {
      input.removeEventListener('input', arguments.callee, false);
      executeSoon(function() {
        is(gInvalidFormPopup.firstChild.textContent, input.validationMessage,
           "The panel should show the current validation message");
        gBrowser.removeTab(gBrowser.selectedTab);
        executeSoon(finish);
      });
    }, false);
    EventUtils.synthesizeKey('f', {});
  }, false);
  tab.linkedBrowser.addEventListener("load", function(aEvent) {
    tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
    gBrowser.contentDocument.getElementById('s').click();
  }, true);
  gBrowser.selectedTab = tab;
  gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
function test10 ( ) { let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input type='email' required id='i'><input id='s' type='submit'></form>" ; let tab = gBrowser . addTab ( ) ; gInvalidFormPopup . addEventListener ( "popupshown" , function ( ) { gInvalidFormPopup . removeEventListener ( "popupshown" , arguments . callee , false ) ; let doc = gBrowser . contentDocument ; let input = doc . getElementById ( 'i' ) ; is ( doc . activeElement , input , "First invalid element should be focused" ) ; checkPopupShow ( ) ; is ( gInvalidFormPopup . firstChild . textContent , input . validationMessage , "The panel should show the current validation message" ) ; input . addEventListener ( 'input' , function ( ) { input . removeEventListener ( 'input' , arguments . callee , false ) ; executeSoon ( function ( ) { is ( gInvalidFormPopup . firstChild . textContent , input . validationMessage , "The panel should show the current validation message" ) ; gBrowser . removeTab ( gBrowser . selectedTab ) ; executeSoon ( finish ) ; } ) ; } , false ) ; EventUtils . synthesizeKey ( 'f' , { } ) ; } , false ) ; tab . linkedBrowser . addEventListener ( "load" , function ( aEvent ) { tab . linkedBrowser . removeEventListener ( "load" , arguments . callee , true ) ; gBrowser . contentDocument . getElementById ( 's' ) . click ( ) ; } , true ) ; gBrowser . selectedTab = tab ; gBrowser . selectedTab . linkedBrowser . loadURI ( uri ) ; }
In this test, we check that the message is correctly updated when it changes.
In this test we check that the message is correctly updated when it changes .
// Now, the element suffers from another error, the message should have // been updated. // Clean-up and next test.