constructor-options-script-valid-undefined.js (1557B)
1 // Copyright 2018 Rick Waldron. 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: > 7 Verify valid script option values (undefined) 8 info: | 9 Intl.Locale( tag [, options] ) 10 10. If options is undefined, then 11 11. Else 12 a. Let options be ? ToObject(options). 13 12. Set tag to ? ApplyOptionsToTag(tag, options). 14 15 ApplyOptionsToTag( tag, options ) 16 ... 17 5. Let script be ? GetOption(options, "script", "string", undefined, undefined). 18 ... 19 9. If tag matches neither the privateuse nor the grandfathered production, then 20 ... 21 c. If script is not undefined, then 22 i. If tag does not contain a script production, then 23 1. Set tag to the concatenation of the language production of tag, "-", script, and the rest of tag. 24 ii. Else, 25 1. Set tag to tag with the substring corresponding to the script production replaced by the string script. 26 27 28 features: [Intl.Locale] 29 ---*/ 30 31 assert.sameValue( 32 new Intl.Locale('en', {script: undefined}).toString(), 33 'en', 34 `new Intl.Locale('en', {script: undefined}).toString() returns "en"` 35 ); 36 37 assert.sameValue( 38 new Intl.Locale('en-DK', {script: undefined}).toString(), 39 'en-DK', 40 `new Intl.Locale('en-DK', {script: undefined}).toString() returns "en-DK"` 41 ); 42 43 assert.sameValue( 44 new Intl.Locale('en-Cyrl', {script: undefined}).toString(), 45 'en-Cyrl', 46 `new Intl.Locale('en-Cyrl', {script: undefined}).toString() returns "en-Cyrl"` 47 ); 48 49 50 reportCompare(0, 0);