tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

overflow-undefined.js (2265B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2021 Igalia, S.L. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-temporal.plainmonthday.from
      7 description: Fallback value for overflow option
      8 info: |
      9    sec-getoption step 3:
     10      3. If _value_ is *undefined*, return _fallback_.
     11    sec-temporal-totemporaloverflow step 1:
     12      1. Return ? GetOption(_normalizedOptions_, *"overflow"*, « String », « *"constrain"*, *"reject"* », *"constrain"*).
     13    sec-temporal-totemporalmonthday steps 3–4:
     14      3. If Type(_item_) is Object, then
     15        ...
     16        j. Return ? MonthDayFromFields(_calendar_, _fields_, _options_).
     17      4. Perform ? ToTemporalOverflow(_options_).
     18    sec-temporal.plainmonthday.from steps 2–3:
     19      2. If Type(_item_) is Object and _item_ has an [[InitializedTemporalMonthDay]] internal slot, then
     20        a. Perform ? ToTemporalOverflow(_options_).
     21        b. Return ...
     22      3. Return ? ToTemporalMonthDay(_item_, _options_).
     23 includes: [temporalHelpers.js]
     24 features: [Temporal]
     25 ---*/
     26 
     27 const validValues = [
     28  new Temporal.PlainMonthDay(5, 2),
     29  "05-02",
     30 ];
     31 validValues.forEach((value) => {
     32  const explicit = Temporal.PlainMonthDay.from(value, { overflow: undefined });
     33  TemporalHelpers.assertPlainMonthDay(explicit, "M05", 2, "overflow is ignored");
     34  const implicit = Temporal.PlainMonthDay.from(value, {});
     35  TemporalHelpers.assertPlainMonthDay(implicit, "M05", 2, "overflow is ignored");
     36  const lambda = Temporal.PlainMonthDay.from(value, () => {});
     37  TemporalHelpers.assertPlainMonthDay(lambda, "M05", 2, "overflow is ignored");
     38 });
     39 
     40 const propertyBag = { year: 2000, month: 13, day: 34 };
     41 const explicit = Temporal.PlainMonthDay.from(propertyBag, { overflow: undefined });
     42 TemporalHelpers.assertPlainMonthDay(explicit, "M12", 31, "default overflow is constrain");
     43 const implicit = Temporal.PlainMonthDay.from(propertyBag, {});
     44 TemporalHelpers.assertPlainMonthDay(implicit, "M12", 31, "default overflow is constrain");
     45 const lambda = Temporal.PlainMonthDay.from(propertyBag, () => {});
     46 TemporalHelpers.assertPlainMonthDay(lambda, "M12", 31, "default overflow is constrain");
     47 
     48 reportCompare(0, 0);