constructor-options-order.js (1201B)
1 // Copyright 2022 Igalia, S.L. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-Intl.DurationFormat 6 description: Checks the order of operations on the options argument to the DurationFormat constructor. 7 info: | 8 Intl.DurationFormat ( [ locales [ , options ] ] ) 9 (...) 10 5. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit"). 11 6. Let numberingSystem be ? GetOption(options, "numberingSystem", "string", undefined, undefined). 12 13. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow", "digital" », "long"). 13 includes: [compareArray.js] 14 features: [Intl.DurationFormat] 15 ---*/ 16 17 var actual = []; 18 19 const options = { 20 get localeMatcher() { 21 actual.push("localeMatcher"); 22 return undefined; 23 }, 24 get numberingSystem() { 25 actual.push("numberingSystem"); 26 return undefined; 27 }, 28 get style() { 29 actual.push("style"); 30 return undefined; 31 }, 32 }; 33 34 const expected = [ 35 "localeMatcher", 36 "numberingSystem", 37 "style" 38 ]; 39 40 let nf = new Intl.DurationFormat(undefined, options); 41 assert.compareArray(actual, expected); 42 43 reportCompare(0, 0);