B2G/gecko/browser/components/tabview/test/browser_tabview_bug766597.js
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .
function test() {
  waitForExplicitFinish();
  let tContextMenu = document.getElementById("tabContextMenu");
  let tvMenuPopup = document.getElementById("context_tabViewMenuPopup");
  let group1;
  let group2;
  function openMoveToGroupPopup() {
    let tab = gBrowser.selectedTab;
    let tvMenu = document.getElementById("context_tabViewMenu");
    let tvMenuPopup = document.getElementById("context_tabViewMenuPopup");
    let tvEvent = new Event("");
    tab.dispatchEvent(tvEvent);
    tContextMenu.openPopup(tab, "end_after", 0, 0, true, false, tvEvent);
    tvMenuPopup.openPopup(tvMenu, "end_after", 0, 0, true, false);
  }
  function hideMoveToGroupPopup() {
    tvMenuPopup.hidePopup();
    tContextMenu.hidePopup();
  }
  function createGroups() {
    let cw = TabView.getContentWindow();
    group1 = createGroupItemWithTabs(window, 200, 200, 20, ["about:blank"]);
    group1.setTitle("group with items and title");
    group2 = createEmptyGroupItem(cw, 200, 200, 20);
    cw.UI.setActive(cw.GroupItems.groupItems[0]);
    is(cw.GroupItems.groupItems.length, 3, "Validate group count in tab view.");
    hideTabView(checkGroupMenuItems);
  }
  function checkGroupMenuItems() {
    openMoveToGroupPopup();
    is(tvMenuPopup.childNodes.length, 3, "Validate group item count in move to group popup.");
    hideMoveToGroupPopup();
    group2.setTitle("empty group with title");
    openMoveToGroupPopup();
    is(tvMenuPopup.childNodes.length, 4, "Validate group item count in move to group popup.");
    hideMoveToGroupPopup();
    closeGroupItem(group1, function() { closeGroupItem(group2, finish); });
  }
  showTabView(createGroups);
}
function test ( ) { waitForExplicitFinish ( ) ; let tContextMenu = document . getElementById ( "tabContextMenu" ) ; let tvMenuPopup = document . getElementById ( "context_tabViewMenuPopup" ) ; let group1 ; let group2 ; function openMoveToGroupPopup ( ) { let tab = gBrowser . selectedTab ; let tvMenu = document . getElementById ( "context_tabViewMenu" ) ; let tvMenuPopup = document . getElementById ( "context_tabViewMenuPopup" ) ; let tvEvent = new Event ( "" ) ; tab . dispatchEvent ( tvEvent ) ; tContextMenu . openPopup ( tab , "end_after" , 0 , 0 , true , false , tvEvent ) ; tvMenuPopup . openPopup ( tvMenu , "end_after" , 0 , 0 , true , false ) ; } function hideMoveToGroupPopup ( ) { tvMenuPopup . hidePopup ( ) ; tContextMenu . hidePopup ( ) ; } function createGroups ( ) { let cw = TabView . getContentWindow ( ) ; group1 = createGroupItemWithTabs ( window , 200 , 200 , 20 , [ "about:blank" ] ) ; group1 . setTitle ( "group with items and title" ) ; group2 = createEmptyGroupItem ( cw , 200 , 200 , 20 ) ; cw . UI . setActive ( cw . GroupItems . groupItems [ 0 ] ) ; is ( cw . GroupItems . groupItems . length , 3 , "Validate group count in tab view." ) ; hideTabView ( checkGroupMenuItems ) ; } function checkGroupMenuItems ( ) { openMoveToGroupPopup ( ) ; is ( tvMenuPopup . childNodes . length , 3 , "Validate group item count in move to group popup." ) ; hideMoveToGroupPopup ( ) ; group2 . setTitle ( "empty group with title" ) ; openMoveToGroupPopup ( ) ; is ( tvMenuPopup . childNodes . length , 4 , "Validate group item count in move to group popup." ) ; hideMoveToGroupPopup ( ) ; closeGroupItem ( group1 , function ( ) { closeGroupItem ( group2 , finish ) ; } ) ; } showTabView ( createGroups ) ; }
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .
// Check the group count. // The group count includes the separator and the 'new group' menu item. // First test with an empty untitled group. // Then test with an empty but titled group. // Clean 