Skip to content

Commit 562406d

Browse files
committed
Fix web-sys Location test
1 parent e66d01f commit 562406d

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

crates/web-sys/tests/wasm/location.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,60 @@
11
use wasm_bindgen_test::*;
2-
use web_sys::Window;
2+
use web_sys::{self, Location};
3+
4+
fn location() -> Location {
5+
web_sys::window().unwrap().location()
6+
}
37

48
#[wasm_bindgen_test]
59
fn href() {
6-
let loc = Window::location();
10+
let loc = location();
711
loc.href().unwrap();
812
}
913

1014
#[wasm_bindgen_test]
1115
fn origin() {
12-
let loc = Window::location();
16+
let loc = location();
1317
loc.origin().unwrap();
1418
}
1519

1620
#[wasm_bindgen_test]
1721
fn protocol() {
18-
let loc = Window::location();
22+
let loc = location();
1923
loc.protocol().unwrap();
2024
}
2125

2226
#[wasm_bindgen_test]
2327
fn host() {
24-
let loc = Window::location();
28+
let loc = location();
2529
loc.host().unwrap();
2630
}
2731

2832
#[wasm_bindgen_test]
2933
fn hostname() {
30-
let loc = Window::location();
34+
let loc = location();
3135
loc.hostname().unwrap();
3236
}
3337

3438
#[wasm_bindgen_test]
3539
fn port() {
36-
let loc = Window::location();
40+
let loc = location();
3741
loc.port().unwrap();
3842
}
3943

4044
#[wasm_bindgen_test]
4145
fn pathname() {
42-
let loc = Window::location();
46+
let loc = location();
4347
loc.pathname().unwrap();
4448
}
4549

4650
#[wasm_bindgen_test]
4751
fn search() {
48-
let loc = Window::location();
52+
let loc = location();
4953
loc.search().unwrap();
5054
}
5155

5256
#[wasm_bindgen_test]
5357
fn hash() {
54-
let loc = Window::location();
58+
let loc = location();
5559
loc.hash().unwrap();
5660
}

0 commit comments

Comments
 (0)