• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"use strict";
2// https://heycam.github.io/webidl/#es-namespaces
3// https://console.spec.whatwg.org/#console-namespace
4
5test(() => {
6  assert_true(self.hasOwnProperty("console"));
7}, "console exists on the global object");
8
9test(() => {
10  const propDesc = Object.getOwnPropertyDescriptor(self, "console");
11  assert_equals(propDesc.writable, true, "must be writable");
12  assert_equals(propDesc.enumerable, false, "must not be enumerable");
13  assert_equals(propDesc.configurable, true, "must be configurable");
14  assert_equals(propDesc.value, console, "must have the right value");
15}, "console has the right property descriptors");
16
17test(() => {
18  assert_false("Console" in self);
19}, "Console (uppercase, as if it were an interface) must not exist");
20
21test(() => {
22  const prototype1 = Object.getPrototypeOf(console);
23  const prototype2 = Object.getPrototypeOf(prototype1);
24
25  assert_equals(Object.getOwnPropertyNames(prototype1).length, 0, "The [[Prototype]] must have no properties");
26  assert_equals(prototype2, Object.prototype, "The [[Prototype]]'s [[Prototype]] must be %ObjectPrototype%");
27}, "The prototype chain must be correct");
28