constructor-calendar-numberingSystem-order.js (1370B)
1 // Copyright 2019 Google Inc. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-createdatetimeformat 6 description: > 7 Checks the order of getting "calendar" and "numberingSystem" options in the 8 DateTimeFormat is between "localeMatcher" and "hour12" options. 9 info: | 10 5. Let _matcher_ be ? GetOption(_options_, `"localeMatcher"`, ~string~, « `"lookup"`, `"best fit"` », `"best fit"`). 11 ... 12 7. Let _calendar_ be ? GetOption(_options_, `"calendar"`, ~string~ , ~empty~, *undefined*). 13 ... 14 10. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`, ~string~, ~empty~, *undefined*). 15 ... 16 13. Let _hour12_ be ? GetOption(_options_, `"hour12"`, ~boolean~, ~empty~, *undefined*). 17 includes: [compareArray.js] 18 ---*/ 19 20 const actual = []; 21 22 const options = { 23 get localeMatcher() { 24 actual.push("localeMatcher"); 25 return undefined; 26 }, 27 get calendar() { 28 actual.push("calendar"); 29 return undefined; 30 }, 31 get numberingSystem() { 32 actual.push("numberingSystem"); 33 return undefined; 34 }, 35 get hour12() { 36 actual.push("hour12"); 37 return undefined; 38 }, 39 }; 40 41 const expected = [ 42 "localeMatcher", 43 "calendar", 44 "numberingSystem", 45 "hour12" 46 ]; 47 48 let df = new Intl.DateTimeFormat(undefined, options); 49 assert.compareArray(actual, expected); 50 51 reportCompare(0, 0);