diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/testdata/070_location.ts | 8 | ||||
-rw-r--r-- | cli/tests/testdata/070_location.ts.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/071_location_unset.ts | 13 | ||||
-rw-r--r-- | cli/tests/testdata/071_location_unset.ts.out | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/cli/tests/testdata/070_location.ts b/cli/tests/testdata/070_location.ts index 149de5423..05e5abdf1 100644 --- a/cli/tests/testdata/070_location.ts +++ b/cli/tests/testdata/070_location.ts @@ -1,7 +1,15 @@ +// deno-lint-ignore-file no-global-assign console.log(Location); console.log(Location.prototype); console.log(location); try { + location = {}; +} catch (error) { + if (error instanceof Error) { + console.log(error.toString()); + } +} +try { location.hostname = "bar"; } catch (error) { if (error instanceof Error) { diff --git a/cli/tests/testdata/070_location.ts.out b/cli/tests/testdata/070_location.ts.out index e05561e58..692d7c976 100644 --- a/cli/tests/testdata/070_location.ts.out +++ b/cli/tests/testdata/070_location.ts.out @@ -11,5 +11,6 @@ Location { protocol: "https:", search: "?baz" } +NotSupportedError: Cannot set "location". NotSupportedError: Cannot set "location.hostname". [WILDCARD] diff --git a/cli/tests/testdata/071_location_unset.ts b/cli/tests/testdata/071_location_unset.ts index bb60df8c4..f560d2716 100644 --- a/cli/tests/testdata/071_location_unset.ts +++ b/cli/tests/testdata/071_location_unset.ts @@ -1,3 +1,16 @@ console.log(Location); console.log(Location.prototype); console.log(location); + +globalThis.location = { + hash: "#bat", + host: "foo", + hostname: "foo", + href: "https://foo/bar?baz#bat", + origin: "https://foo", + pathname: "/bar", + port: "", + protocol: "https:", + search: "?baz", +}; +console.log(location.pathname); diff --git a/cli/tests/testdata/071_location_unset.ts.out b/cli/tests/testdata/071_location_unset.ts.out index f786d7a64..99f87a7fc 100644 --- a/cli/tests/testdata/071_location_unset.ts.out +++ b/cli/tests/testdata/071_location_unset.ts.out @@ -1,4 +1,5 @@ [WILDCARD][Function: Location] Location {} undefined +/bar [WILDCARD] |