Skip to content

Commit ff676cd

Browse files
committed
Add test
1 parent 2289a37 commit ff676cd

File tree

1 file changed

+23
-0
lines changed
  • core/engine/src/builtins/intl/date_time_format

1 file changed

+23
-0
lines changed

core/engine/src/builtins/intl/date_time_format/tests.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,26 @@ fn dtf_basic() {
6565
TestAction::assert_eq("result === 'Sunday, 20 December 2020 at 14:23:16'", true),
6666
]);
6767
}
68+
69+
#[cfg(feature = "intl_bundled")]
70+
#[test]
71+
fn date_to_locale_string() {
72+
run_test_actions([
73+
TestAction::run(indoc! {"
74+
// Setup date
75+
const date = new Date(Date.UTC(2021, 3, 12, 6, 7));
76+
77+
let result = date.toLocaleString('en-US', { dateStyle: 'short' });
78+
"}),
79+
TestAction::assert_eq("result === '4/12/21'", true),
80+
]);
81+
run_test_actions([
82+
TestAction::run(indoc! {"
83+
// Setup date
84+
const date = new Date(Date.UTC(2021, 3, 12, 6, 7));
85+
86+
let result = date.toLocaleString('en-US', { timeStyle: 'short' });
87+
"}),
88+
TestAction::assert_eq("result === '6:07\u{202f}AM'", true),
89+
]);
90+
}

0 commit comments

Comments
 (0)