diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/specs/run/location/__test__.jsonc | 8 | ||||
-rw-r--r-- | tests/specs/run/location/location.js | 24 | ||||
-rw-r--r-- | tests/specs/run/location/location.out | 5 |
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/specs/run/location/__test__.jsonc b/tests/specs/run/location/__test__.jsonc new file mode 100644 index 000000000..551463d59 --- /dev/null +++ b/tests/specs/run/location/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "tests": { + "location_object_define_property": { + "args": "run location.js", + "output": "location.out" + } + } +} diff --git a/tests/specs/run/location/location.js b/tests/specs/run/location/location.js new file mode 100644 index 000000000..8562a3995 --- /dev/null +++ b/tests/specs/run/location/location.js @@ -0,0 +1,24 @@ +let _location = undefined; + +console.log(globalThis.location); + +Object.defineProperty(globalThis, "location", { + get() { + return _location; + }, + set(v) { + _location = v; + }, + configurable: true, +}); + +console.log(globalThis.location); + +globalThis.location = "https://deno.com"; + +console.log(_location); +console.log(location); + +delete globalThis["location"]; + +console.log(globalThis.location); diff --git a/tests/specs/run/location/location.out b/tests/specs/run/location/location.out new file mode 100644 index 000000000..bcb3ff67b --- /dev/null +++ b/tests/specs/run/location/location.out @@ -0,0 +1,5 @@ +undefined +undefined +https://deno.com +https://deno.com +undefined |