constructor-options-numeric-undefined.js (1904B)
1 // Copyright 2018 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.locale 6 description: Verifies the behavior of an undefined numeric option to the Locale constructor. 7 info: | 8 Intl.Locale( tag [, options] ) 9 10 ... 11 24. Let kn be ? GetOption(options, "numeric", "boolean", undefined, undefined). 12 25. If kn is not undefined, set kn to ! ToString(kn). 13 ... 14 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys). 15 ... 16 17 ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys ) 18 19 ... 20 8. Let locale be the String value that is tag with all Unicode locale extension sequences removed. 21 9. Let newExtension be ! CanonicalizeUnicodeExtension(attributes, keywords). 22 10. If newExtension is not the empty String, then 23 a. Let locale be ! InsertUnicodeExtension(locale, newExtension). 24 ... 25 26 CanonicalizeUnicodeExtension( attributes, keywords ) 27 ... 28 4. Repeat for each element entry of keywords in List order, 29 a. Let keyword be entry.[[Key]]. 30 b. If entry.[[Value]] is not the empty String, then 31 i. Let keyword be the string-concatenation of keyword, "-", and entry.[[Value]]. 32 c. Append keyword to fullKeywords. 33 ... 34 features: [Intl.Locale] 35 ---*/ 36 37 const options = { numeric: undefined }; 38 assert.sameValue( 39 new Intl.Locale('en', options).toString(), 40 "en", 41 'new Intl.Locale("en", {numeric: undefined}).toString() returns "en"' 42 ); 43 44 assert.sameValue( 45 new Intl.Locale('en-u-kn-true', options).toString(), 46 "en-u-kn", 47 'new Intl.Locale("en-u-kn-true", {numeric: undefined}).toString() returns "en-u-kn"' 48 ); 49 50 assert.sameValue( 51 new Intl.Locale('en-u-kf-lower', options).numeric, 52 false, 53 'The value of new Intl.Locale("en-u-kf-lower", {numeric: undefined}).numeric equals `false`' 54 ); 55 56 reportCompare(0, 0);