tor-browser

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

argument-propertybag-optional-properties.js (968B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2025 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.duration.prototype.from
      7 description: >
      8  A property bag missing optional properties is equivalent to a property bag
      9  with all the optional properties having their default values
     10 includes: [temporalHelpers.js]
     11 features: [Temporal]
     12 ---*/
     13 
     14 const oneProperty = {
     15  hours: 1,
     16 };
     17 const allProperties = {
     18  years: 0,
     19  months: 0,
     20  weeks: 0,
     21  days: 0,
     22  hours: 1,
     23  minutes: 0,
     24  seconds: 0,
     25  milliseconds: 0,
     26  microseconds: 0,
     27  nanoseconds: 0,
     28 };
     29 const resultWithout = Temporal.Duration.from(oneProperty);
     30 const resultWith = Temporal.Duration.from(allProperties);
     31 TemporalHelpers.assertDurationsEqual(resultWithout, resultWith, "results should be the same with and without optional properties");
     32 
     33 reportCompare(0, 0);