js-sys: Add bindings for Intl.Collator

This commit is contained in:
Nick Fitzgerald
2018-08-10 11:20:06 -07:00
parent 7f5d0a2158
commit f0444d1614
2 changed files with 58 additions and 1 deletions

View File

@ -1,4 +1,4 @@
use wasm_bindgen::JsValue;
use wasm_bindgen::{JsCast, JsValue};
use wasm_bindgen_test::*;
use js_sys::*;
@ -23,3 +23,16 @@ fn get_canonical_locales() {
assert_eq!(l, "en-US");
});
}
#[wasm_bindgen_test]
fn collator() {
let locales = Array::of1(&JsValue::from("en-US"));
let opts = Object::new();
let c = Intl::Collator::new(&locales, &opts);
assert!(c.compare().is_instance_of::<Function>());
assert!(c.resolved_options().is_instance_of::<Object>());
let a = Intl::Collator::supported_locales_of(&locales, &opts);
assert!(a.is_instance_of::<Array>());
}