Files
palemoon27/toolkit/devtools/shared/test/browser_toolbar_tooltip.js
T
roytam1 d43d81d5ab import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1194905 - Build libvpx neon code without -mthumb and -mfloat-abi=softfp. r=mshal (24098bdb7)
- Remove spurious commandline.css from AF tree. (49cf2bb5c)
- Bug 969914 - Make developer toolbar match the light devtools theme when applied;r=jwalker,r=pbrosset (4047862bd)
- Bug 1152304 - Add displaying of block notes to dis() in the JS shell. (r=jimb) (9c1d7fa30)
- Bug 1126987 - Fix _lastEventSize initialization in stack.js. r=vporof (2083cb437)
- Bug 1140569 - Show async stacks attached to timeline markers. r=vporof (f05e1b60c)
- Bug 1141553 - Give function name the devtools-monospace class in the profiler r=vporof (0ca698ea2)
- Bug 1150112 - Markers overview should react to theme change, and other marker views now use CSS to automatically use theme change. r=vporof (6f72cde25)
- Bug 1050500 - Add entry reason to timeline marker. r=jsantell, r=smaug (db9cf8191)
- Bug 922221 - implement console.timeStamp(label) to create profile timeline markers. r=khuey (73e513562)
- Bug 1059908 - Merge FunctionType and FunctionSyntaxKind. r=efaust (2d765bde5)
- Bug 1059908 - Introduce a CONSTRUCTOR flag and make getter/setter/method non-constructable. r=efaust (fddb15f13)
- Bug 1162310 - Do not use nonexistent macro when XGILL_PLUGIN is defined, r=bhackett (57a5c2861)
- pointer style (55ec84b3b)
- Bug 1164602 - Replace js::NullPtr and JS::NullPtr with nullptr_t; r=sfink (9ae473e29)
- pointer style (7d735a2b9)
- pointer style (987c0128b)
- Bug 1135629 - Rename Register::code to Register::encoding for Assembler functions. r=jandem (cf915c814)
- pointer style (ac97f0d0b)
- Bug 1150337 - OdinMonkey: Optimize the full range of immediate offsets on x64. r=luke (fffb82aa6)
- fix typos (511e17002)
- pointer style (c1b54384c)
- Bug 1135707 - Fix interaction between Arm NOP fill and calculation of IonCache rejoin label r=jandem (306365ec4)
- pointer style (a8fe90ade)
- Bug 1166809 - Remove DispatchIonCache and RepatchIonCache. r=bhackett (9b8b02bf1)
- Bug 1147403 part 3 - Make IonSpewer work during off-thread compilation. r=h4writer Bug 1147403 part 3.1 - Replace newly added IonSpewPass after KeepAlive transform. r=KWierso (01bd66aa3)
- Bug 1147403 part 4 - Extract the printer from the serializer. r=h4writer (290a8887e)
- pointer style (fc70e6a1a)
- Bug 1147403 part 0 - Replace contextual information of dispatchHook by lambdas. r=shu (e177990e5)
- Bug 1065657 - Allow multiple Debuggers to track allocations at the same time. r=shu (66b5a3ba9)
- pointer style (bb317bb87)
- Bug 1147403 part 5 - Add Debugger::onIonCompilation hook. r=shu (c14a28de1)
- Bug 1147403 part 6 - Remove GetJitContext from serializing functions. r=h4writer (6d3d605a5)
- pointer style (b2ec50945)
- Bug 1147403 part 7 - Fix inIon, only reset the counter when the function is executed. r=jandem (cb6c180ef)
- Bug 1165392, Bug 1165463 - Various unboxed array fixes and optimizations, r=jandem. (28ec85004)
2020-09-16 21:57:22 +08:00

93 lines
3.3 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the developer toolbar works properly
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Protocol error (unknownError): Error: Got an invalid root window in DocumentWalker");
const TEST_URI = "data:text/html;charset=utf-8,<p>Tooltip Tests</p>";
const PREF_DEVTOOLS_THEME = "devtools.theme";
registerCleanupFunction(() => {
// Set preferences back to their original values
Services.prefs.clearUserPref(PREF_DEVTOOLS_THEME);
});
add_task(function* showToolbar() {
yield promiseTab(TEST_URI);
info("Starting browser_toolbar_tooltip.js");
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in runTest");
let showPromise = observeOnce(DeveloperToolbar.NOTIFICATIONS.SHOW);
document.getElementById("Tools:DevToolbar").doCommand();
yield showPromise;
});
add_task(function* testDimensions() {
let tooltipPanel = DeveloperToolbar.tooltipPanel;
DeveloperToolbar.focusManager.helpRequest();
yield DeveloperToolbar.inputter.setInput('help help');
DeveloperToolbar.inputter.setCursor({ start: 'help help'.length });
is(tooltipPanel._dimensions.start, 'help '.length,
'search param start, when cursor at end');
ok(getLeftMargin() > 30, 'tooltip offset, when cursor at end')
DeveloperToolbar.inputter.setCursor({ start: 'help'.length });
is(tooltipPanel._dimensions.start, 0,
'search param start, when cursor at end of command');
ok(getLeftMargin() > 9, 'tooltip offset, when cursor at end of command')
DeveloperToolbar.inputter.setCursor({ start: 'help help'.length - 1 });
is(tooltipPanel._dimensions.start, 'help '.length,
'search param start, when cursor at penultimate position');
ok(getLeftMargin() > 30, 'tooltip offset, when cursor at penultimate position')
DeveloperToolbar.inputter.setCursor({ start: 0 });
is(tooltipPanel._dimensions.start, 0,
'search param start, when cursor at start');
ok(getLeftMargin() > 9, 'tooltip offset, when cursor at start')
});
add_task(function* testThemes() {
let tooltipPanel = DeveloperToolbar.tooltipPanel;
ok(tooltipPanel.document, "Tooltip panel is initialized");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
yield DeveloperToolbar.display.inputter.setInput("");
yield DeveloperToolbar.display.inputter.setInput("help help");
is(tooltipPanel.document.documentElement.getAttribute("devtoolstheme"),
"dark", "Tooltip panel has correct theme");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
yield DeveloperToolbar.display.inputter.setInput("");
yield DeveloperToolbar.display.inputter.setInput("help help");
is(tooltipPanel.document.documentElement.getAttribute("devtoolstheme"),
"light", "Tooltip panel has correct theme");
});
function getLeftMargin() {
let style = DeveloperToolbar.tooltipPanel._panel.style.marginLeft;
return parseInt(style.slice(0, -2), 10);
}
function observeOnce(topic, ownsWeak=false) {
return new Promise(function(resolve, reject) {
let resolver = function(subject) {
Services.obs.removeObserver(resolver, topic);
resolve(subject);
};
Services.obs.addObserver(resolver, topic, ownsWeak);
}.bind(this));
}