gecko/browser/metro/base/tests/mochitest/browser_context_ui.js
Jim Mathies 334c23eeee Bug 855090 - Move mochitests into a sub dir within browser/metro/base/tests. r=mbrubeck
--HG--
rename : browser/metro/base/tests/browser_canonizeURL.js => browser/metro/base/tests/mochitest/browser_canonizeURL.js
rename : browser/metro/base/tests/browser_context_menu_tests.js => browser/metro/base/tests/mochitest/browser_context_menu_tests.js
rename : browser/metro/base/tests/browser_context_menu_tests_01.html => browser/metro/base/tests/mochitest/browser_context_menu_tests_01.html
rename : browser/metro/base/tests/browser_context_menu_tests_02.html => browser/metro/base/tests/mochitest/browser_context_menu_tests_02.html
rename : browser/metro/base/tests/browser_context_menu_tests_03.html => browser/metro/base/tests/mochitest/browser_context_menu_tests_03.html
rename : browser/metro/base/tests/browser_context_ui.js => browser/metro/base/tests/mochitest/browser_context_ui.js
rename : browser/metro/base/tests/browser_downloads.js => browser/metro/base/tests/mochitest/browser_downloads.js
rename : browser/metro/base/tests/browser_onscreen_keyboard.html => browser/metro/base/tests/mochitest/browser_onscreen_keyboard.html
rename : browser/metro/base/tests/browser_onscreen_keyboard.js => browser/metro/base/tests/mochitest/browser_onscreen_keyboard.js
rename : browser/metro/base/tests/browser_plugin_input.html => browser/metro/base/tests/mochitest/browser_plugin_input.html
rename : browser/metro/base/tests/browser_plugin_input_keyboard.js => browser/metro/base/tests/mochitest/browser_plugin_input_keyboard.js
rename : browser/metro/base/tests/browser_plugin_input_mouse.js => browser/metro/base/tests/mochitest/browser_plugin_input_mouse.js
rename : browser/metro/base/tests/browser_remotetabs.js => browser/metro/base/tests/mochitest/browser_remotetabs.js
rename : browser/metro/base/tests/browser_sanitize_ui.js => browser/metro/base/tests/mochitest/browser_sanitize_ui.js
rename : browser/metro/base/tests/browser_test.js => browser/metro/base/tests/mochitest/browser_test.js
rename : browser/metro/base/tests/browser_tilegrid.xul => browser/metro/base/tests/mochitest/browser_tilegrid.xul
rename : browser/metro/base/tests/browser_tiles.js => browser/metro/base/tests/mochitest/browser_tiles.js
rename : browser/metro/base/tests/browser_topsites.js => browser/metro/base/tests/mochitest/browser_topsites.js
rename : browser/metro/base/tests/head.js => browser/metro/base/tests/mochitest/head.js
rename : browser/metro/base/tests/res/image01.png => browser/metro/base/tests/mochitest/res/image01.png
rename : browser/metro/base/tests/text-block.html => browser/metro/base/tests/mochitest/text-block.html
2013-03-31 15:35:18 -05:00

94 lines
3.6 KiB
JavaScript

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
runTests();
}
gTests.push({
desc: "Context UI on about:start",
run: function testAboutStart() {
yield addTab("about:start");
is(StartUI.isVisible, true, "Start UI is displayed on about:start");
is(ContextUI.isVisible, true, "Toolbar is displayed on about:start");
is(ContextUI.isExpanded, false, "Tab bar is not displayed initially");
is(Elements.appbar.isShowing, false, "Appbar is not displayed initially");
// toggle on
doEdgeUIGesture();
is(ContextUI.isVisible, true, "Toolbar is still visible after one swipe");
is(ContextUI.isExpanded, true, "Tab bar is visible after one swipe");
is(Elements.appbar.isShowing, true, "Appbar is visible after one swipe");
// toggle off
doEdgeUIGesture();
is(ContextUI.isVisible, true, "Toolbar is still visible after second swipe");
is(ContextUI.isExpanded, false, "Tab bar is hidden after second swipe");
is(Elements.appbar.isShowing, false, "Appbar is hidden after second swipe");
// sanity check - toggle on again
doEdgeUIGesture();
is(ContextUI.isVisible, true, "Toolbar is still visible after third swipe");
is(ContextUI.isExpanded, true, "Tab bar is visible after third swipe");
is(Elements.appbar.isShowing, true, "Appbar is visible after third swipe");
is(StartUI.isVisible, true, "Start UI is still visible");
}
});
gTests.push({
desc: "Context UI on a web page (about:)",
run: function testAbout() {
yield addTab("about:");
ContextUI.dismiss();
is(StartUI.isVisible, false, "Start UI is not visible on about:");
is(ContextUI.isVisible, false, "Toolbar is not initially visible on about:");
is(ContextUI.isExpanded, false, "Tab bar is not initially visible on about:");
is(Elements.appbar.isShowing, false, "Appbar is not initially visible on about on about::");
doEdgeUIGesture();
is(ContextUI.isVisible, true, "Toolbar is visible after one swipe");
is(ContextUI.isExpanded, true, "Tab bar is visble after one swipe");
is(Elements.appbar.isShowing, true, "Appbar is visible after one swipe");
doEdgeUIGesture();
is(ContextUI.isVisible, false, "Toolbar is not visible after second swipe");
is(ContextUI.isExpanded, false, "Tab bar is not visible after second swipe");
is(Elements.appbar.isShowing, false, "Appbar is hidden after second swipe");
is(StartUI.isVisible, false, "Start UI is still not visible");
}
});
gTests.push({
desc: "Control-L keyboard shortcut",
run: function testAbout() {
let tab = yield addTab("about:");
ContextUI.dismiss();
is(ContextUI.isVisible, false, "Navbar is not initially visible");
is(ContextUI.isExpanded, false, "Tab bar is not initially visible");
EventUtils.synthesizeKey('l', { accelKey: true });
is(ContextUI.isVisible, true, "Navbar is visible");
is(ContextUI.isExpanded, false, "Tab bar is not visible");
let edit = document.getElementById("urlbar-edit");
is(edit.value, "about:", "Location field contains the page URL");
ok(document.commandDispatcher.focusedElement, edit.inputField, "Location field is focused");
is(edit.selectionStart, 0, "Location field is selected");
is(edit.selectionEnd, edit.value.length, "Location field is selected");
Browser.closeTab(tab);
}
});
function doEdgeUIGesture() {
let event = document.createEvent("Events");
event.initEvent("MozEdgeUIGesture", true, false);
window.dispatchEvent(event);
}