Menu System Test

# This page has a menu bar and context menu

### Popup opening tests

- Right clicking on the client area of the page (ctrl-click for opera) should make a popup menu appear.
- Right clicking near the righthand window border should open the menu to the left of the pointer.
- Right clicking near the bottom window border should open the menu above the pointer.
- Scrolling the contents of this scrollable area and right-clicking should make the menu appear at the pointer.
- When the popup menu appears, it should not have any items pre-selected (blue background by default - ymmv).
- In IE, test bleed through here

### Popup hover tests

- Hovering over the first item with the pointer should highlight it.
- Hovering over the second (disabled) item should also highlight it.
- Seperator items should not highlight on hover - no items should highlight in this case.
- Removing the pointer from the menu should de-highlight all items.

### Popup click tests

- Clicking on the first menu item should alert with the message "Hello world". The menu should dissapear.
- Clicking on the second menu item (disabled) should not do anything - focus should remain on the disabled item.
- Clicking anywhere outside the menu should hide the menu.

### Popup submenu tests

- Hovering over item three (enabled submenu) should highlight the item and then pop open a submenu after a short (500ms) delay
- Hovering over either of the first two items should close the submenu immediately and deselect the submenu parent item. The newly hovered item should become selected.
- Hovering over item four (disabled submenu) should highlight the item, but no submenu should appear.
- Clicking on item 3 before the submenu has opened (you'll have to be quick!) should immediatley open the submenu.
- Clicking on item 3 after the submenu has opened should have no effect - the item is still selected and the submenu still open.
- Clicking on item 4 should do nothing - the item remains selected and the menu remains open.
- Hovering over submenu item 1 should select it - the parent menu item should stay selected also.
- Hovering over submenu item 2 should select it - the parent menu item should stay selected also.
- Removing the pointer from both menus should de-highlight all items in the submenu and keep the parent menu item highlighted. The submenu should remain open.
- While the submenu is open, hovering over the parent menu item should keep the submenu open with no items selected, while the parent menu item stays selected.

### Menubar hover tests (1 error)

- Hovering over any of the four menu bar items should highlight them to state 1 (raised 3D). No submenus should appear.
- Removing the mouse from all menu bar items should de-highlight all items.
- Clicking on the disabled item (item 3) should change it's highlight to state 2 (sunken 3D).
- Removing the mouse from all menu bar items should leave item 3 highlighted in state 2.
- Hovering over item 2 should cause its popups to open and it's highlight state to change to 2 - item 3 should become de-highlighted.
- Hovering over item 3 again should hide the popup menu, de-highlight item 2 and change item 3's highlight to state 2.
- Removing the pointer from item 3 should leave item 3 in highlighted state 2 with no submenu showing.
- Clicking elsewhere on the page should de-highlight all items (currently broken - disabled item stays in state 2).
- Clicking on the first item should open a submenu below the item. The parent item should be highlighted in state 2 (sunken 3D) with none of the submenu items highlighted.
- Hovering the pointer over the second item should hide the first submenu and show a new submenu under the newly selected item. The first parent item should become de-selected while the second parent item should be highlighted in state 2.
- Removing the mouse from all menu bar items again should leave the submenu open and the parent item selected in state 2.
- Clicking elsewhere on the page should close the submenu and deselect all menu bar items.
- Hovering over any menu bar items again should highlight them in state 1.

### Menubar click tests

- Clicking on bar item 1 should open up a submenu.
- Click on item 1 in the submenu - an alert should say "hello world". The submenu should dissapear and the menu bar items should all be deselected.
- Clicking on bar item 1 should open up a submenu.
- Click on item 3 in the submenu to open a subsubmenu. Item 1 in the menu bar should remain depressed and item 3 in the submenu should remain highlighted.
- Hover over item 1 in the subsubmenu. Item 1 in the menu bar should remain depressed and item 3 in the submenu should remain highlighted.
- Click on item 1 in the subsubmenu - an alert should say "submenu 1!". The submenu and subsubmenu should dissapear and the menu bar items should all be deselected.
- Click on bar item 1 and then submenu item 3 to expand the subsubmenu as before.
- Hover over bar item 2. The subsubmenu and submenu should close immediately and a new submenu open under bar item 2.
- Hover over bar item 1. The submenu should appear, while item 2's submenu should vanish.
- Click on submenu item 3 to expand the subsubmenu as before.
- Click elsewhere on the page - the submenu and subsubmenu should dissapear and the bar items should all become deselected.

### Popup key tests (mostly failing)

- Right click on the page to show the context menu. No items should be selected.
- Press the left arrow. Nothing should happen.
- Press the right arrow. Nothing should happen.
- Press escape. The menu should vanish.

- Right click on the page to show the context menu. No items should be selected.
- Press enter. The menu should vanish.

- Right click on the page to show the context menu. No items should be selected.
- Press the down arrow. The top item should become selected.
- Press escape. The menu should vanish.

- Right click on the page to show the context menu. No items should be selected.
- Press the up arrow. The bottom item should become selected.
- Press escape. The menu should vanish.

- Right click on the page to show the context menu. No items should be selected.
- Press the up arrow. The bottom item should become selected.
- Press the up arrow. The next item up should become selected.
- Press the up arrow until the top item becomes selected.
- Press the up arrow again. The bottom item should become selected.
- Press the down arrow again. The top item should become selected.
- Press the down arrow until the bottom item becomes selected.
- Press the down arrow again. The top item should become selected.
- Press escape. The menu should vanish.

- Select some text in this scrolling box.
- Right click on the page to show the context menu. No items should be selected.
- Press the up and down arrows several times. The scrolling box should not scroll when the selected menu item changes.
- Press escape. The menu should vanish.

- Right click on the page to show the context menu. No items should be selected.
- Press the down arrow. The top item should become selected.
- Press enter. An alert should fire with "hello world". The menu should vanish.

### Submenu key tests (mostly failing)

- Right click on the page to show the context menu. No items should be selected.
- Press the down arrow. The first item should become selected.
- Press the right arrow key. Nothing should happen.
- Press the left arrow key. Nothing should happen.
- Press the down arrow twice. The third item should become selected. The submenu should not appear.
- Press enter. The submenu should appear with the first item selected.
- Press escape. The submenu should vanish - item three should remain selected.
- Press the right arrow key. The submenu should appear with the first item selected.
- Press the right arrow key. Nothing should happen.
- Press the left arrow key. The submenu should vanish - item three should remain selected.
- Press the left arrow key. The context menu should not vanish and item three should remain selected.
- Press escape. The context menu should vanish.

- Right click on the page to show the context menu. No items should be selected.
- Press the down arrow three times. The third item should become selected. The submenu should not appear.
- Press enter. The submenu should appear with the first item selected.
- Press the down arrow. The second item in the submenu should be selected.
- Press the up arrow. The first item in the submenu should be selected.
- Press the up arrow. The last item in the submenu should be selected.
- Press escape. The submenu should vanish, leaving item three selected.
- Press escape. The context menu should vanish.

### Menubar key tests (mostly failing)

- Hover the pointer over bar item one. It should highlight in state 1.
- Press the left, right, up and down arrows - the menu should be unaffected (the window may scroll, if focused).
- Click on menu bar item 1. The popup should appear with no items selected. The bar item should highlight in state 2.
- Press the right arrow. The bar selection should change to item 2. Bar item 1's popup should vanish and bar item 2's popup should appear with item 1 selected.
- Press the left arrow. The bar selection should change to item 1. Bar item 2's popup should vanish and bar item 1's popup should appear with item 1 selected.
- Press the left arrow. The bar selection should change to item 4. Bar item 1's popup should vanish and bar item 4's popup should appear with item 1 selected.
- Press the right arrow. The bar selection should change to item 1. Bar item 4's popup should vanish and bar item 1's popup should appear with item 1 selected.
- Press the down arrow repeatedly - the selection within the popup should move down until it hits the bottom item, after which the top item should become selected.
- Press the up arrow repeatedly - the selection within the popup should move up until it hits the top item, after which the bottom item should become selected.
- Press escape. The popup should vanish but the bar item should stay highlighted in mode 2 (windows does this, but maybe we should forget it?)
- Press escape. The bar item should become unhighlighted.

### TODO tests

- TODO: left and right with no popups open and bar item selected (only if we allow this)
- TODO: popup submenu opening tests
- TODO: left and right within submenus testing
- TODO: key/mouse switchover tests (these get complicated)