Welcome to mirror list, hosted at ThFree Co, Russian Federation.

regress-10438.js « intl « test « v8 « deps - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 81419180cf11c737a5ae4167255e9a438cdf5eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --harmony_intl_dateformat_fractional_second_digits

assertEquals(
    0,
    (new Intl.DateTimeFormat("en", {fractionalSecondDigits: 0}))
        .resolvedOptions().fractionalSecondDigits);

assertEquals(
    1,
    (new Intl.DateTimeFormat("en", {fractionalSecondDigits: 1}))
        .resolvedOptions().fractionalSecondDigits);

assertEquals(
    2,
    (new Intl.DateTimeFormat("en", {fractionalSecondDigits: 2}))
        .resolvedOptions().fractionalSecondDigits);

assertEquals(
    3,
    (new Intl.DateTimeFormat("en", {fractionalSecondDigits: 3}))
        .resolvedOptions().fractionalSecondDigits);

// When timeStyle and dateStyle is not present, GetNumberOption will fallback
// to 0 as default regardless fractionalSecondDigits is present in the option or
// not.
assertEquals(
    0,
    (new Intl.DateTimeFormat()).resolvedOptions().fractionalSecondDigits);

assertEquals(
    0,
    (new Intl.DateTimeFormat("en", {fractionalSecondDigits: undefined}))
        .resolvedOptions().fractionalSecondDigits);

// When timeStyle or dateStyle is present, the code should not read
// fractionalSecondDigits from the option.
assertEquals(
    undefined,
    (new Intl.DateTimeFormat(
        "en", {timeStyle: "short", fractionalSecondDigits: 3}))
        .resolvedOptions().fractionalSecondDigits);

assertEquals(
    undefined,
    (new Intl.DateTimeFormat(
        "en", {dateStyle: "short", fractionalSecondDigits: 3}))
        .resolvedOptions().fractionalSecondDigits);