mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-31 11:44:31 +01:00 
			
		
		
		
	* Unified Intl.NumberFormat: Test compact notation with various locales. * Unified Intl.NumberFormat: Test compactDisplay constructor option. * Unified Intl.NumberFormat: Test signDisplay constructor option. * Unified Intl.NumberFormat: Test signDisplay with various locales. * Unified Intl.NumberFormat: Test signDisplay with accounting currencySign in various locales. * Unified Intl.NumberFormat: Test engineering and scientific notations in various locales. * Unified Intl.NumberFormat: Test unit handling. * Unified Intl.NumberFormat: Test notation constructor option. * Unified Intl.NumberFormat: Test engineering and scientific notations with negative exponents. * Unified Intl.NumberFormat: Test near-zero arguments with signDisplay. * Unified Intl.NumberFormat: Test units. * Unified Intl.NumberFormat: Test unit arguments. * Unified Intl.NumberFormat: Add a generic test for unit arguments. * Unified Intl.NumberFormat: Test the unitDisplay argument.
		
			
				
	
	
		
			32 lines
		
	
	
		
			951 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			951 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // Copyright 2019 Igalia, S.L. All rights reserved.
 | |
| // This code is governed by the BSD license found in the LICENSE file.
 | |
| 
 | |
| /*---
 | |
| esid: sec-initializenumberformat
 | |
| description: Checks handling of the notation option to the NumberFormat constructor.
 | |
| info: |
 | |
|     InitializeNumberFormat ( numberFormat, locales, options )
 | |
| 
 | |
|     16. Let notation be ? GetOption(options, "notation", "string", « "standard", "scientific", "engineering", "compact" », "standard").
 | |
|     17. Set numberFormat.[[Notation]] to notation.
 | |
| 
 | |
| features: [Intl.NumberFormat-unified]
 | |
| ---*/
 | |
| 
 | |
| const values = [
 | |
|   [undefined, "standard"],
 | |
|   ["standard"],
 | |
|   ["scientific"],
 | |
|   ["engineering"],
 | |
|   ["compact"],
 | |
| ];
 | |
| 
 | |
| for (const [value, expected = value] of values) {
 | |
|   const nf = new Intl.NumberFormat([], {
 | |
|     notation: value,
 | |
|   });
 | |
|   const resolvedOptions = nf.resolvedOptions();
 | |
|   assert.sameValue("notation" in resolvedOptions, true);
 | |
|   assert.sameValue(resolvedOptions.notation, expected);
 | |
| }
 |