summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_jsterm_helper_keys_values.js
blob: ed06c181ce7031899f0a2b62135ac6e809dc7f37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

const TEST_URI =
  "data:text/html,<!DOCTYPE html>Test <code>keys()</code> & <code>values()</code> jsterm helper";

add_task(async function () {
  const hud = await openNewTabAndConsole(TEST_URI);

  let message = await executeAndWaitForResultMessage(
    hud,
    "keys({a: 2, b:1})",
    `Array [ "a", "b" ]`
  );
  ok(message, "`keys()` worked");

  message = await executeAndWaitForResultMessage(
    hud,
    "values({a: 2, b:1})",
    "Array [ 2, 1 ]"
  );
  ok(message, "`values()` worked");

  message = await executeAndWaitForResultMessage(hud, "keys(window)", "Array");
  ok(message, "`keys(window)` worked");
});