B2G/gecko/toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js
// Check the default values are set.
Check the default values are set.
Check the default values are set .
function test() {
  waitForExplicitFinish();
  registerCleanupFunction(function() {
    SpecialPowers.clearUserPref("view_source.tab_size");
    SpecialPowers.clearUserPref("view_source.wrap_long_lines");
    SpecialPowers.clearUserPref("view_source.syntax_highlight");
  });
  openViewSourceWindow(source, function(aWindow) {
    mWindow = aWindow;
    wrapMenuItem = aWindow.document.getElementById('menu_wrapLongLines');
    syntaxMenuItem = aWindow.document.getElementById('menu_highlightSyntax');
    if (wrapMenuItem.getAttribute("checked") == "false")
      wrapMenuItem.removeAttribute("checked");
    if (syntaxMenuItem.getAttribute("checked") == "false")
      syntaxMenuItem.removeAttribute("checked");
    is(wrapMenuItem.hasAttribute("checked"), false, "Wrap menu item not checked by default");
    is(syntaxMenuItem.hasAttribute("checked"), true, "Syntax menu item checked by default");
    checkStyle(aWindow, "-moz-tab-size", 4);
    checkStyle(aWindow, "white-space", "pre");
    test1();
  });
}
function test ( ) { waitForExplicitFinish ( ) ; registerCleanupFunction ( function ( ) { SpecialPowers . clearUserPref ( "view_source.tab_size" ) ; SpecialPowers . clearUserPref ( "view_source.wrap_long_lines" ) ; SpecialPowers . clearUserPref ( "view_source.syntax_highlight" ) ; } ) ; openViewSourceWindow ( source , function ( aWindow ) { mWindow = aWindow ; wrapMenuItem = aWindow . document . getElementById ( 'menu_wrapLongLines' ) ; syntaxMenuItem = aWindow . document . getElementById ( 'menu_highlightSyntax' ) ; if ( wrapMenuItem . getAttribute ( "checked" ) == "false" ) wrapMenuItem . removeAttribute ( "checked" ) ; if ( syntaxMenuItem . getAttribute ( "checked" ) == "false" ) syntaxMenuItem . removeAttribute ( "checked" ) ; is ( wrapMenuItem . hasAttribute ( "checked" ) , false , "Wrap menu item not checked by default" ) ; is ( syntaxMenuItem . hasAttribute ( "checked" ) , true , "Syntax menu item checked by default" ) ; checkStyle ( aWindow , "-moz-tab-size" , 4 ) ; checkStyle ( aWindow , "white-space" , "pre" ) ; test1 ( ) ; } ) ; }
Check the default values are set.
Check the default values are set .
// Strip checked="false" attributes, since we're not interested in them.