forked from mirrors/gecko-dev
		
	 353adda9a7
			
		
	
	
		353adda9a7
		
	
	
	
	
		
			
			Automatic update from web-platform-testsMerge pull request #12465 from ewilligers/support-parsing-testcommon Move parsing-testcommon.js to support/ -- wpt-commits: 7bab3e962564f8cb9f85692b74ebb1f3c8c382af wpt-pr: 12465 --HG-- rename : testing/web-platform/tests/css/compositing/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/compositing/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-backgrounds/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-backgrounds/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-box/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-box/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-cascade/parsing/support/parsing-testcommon.js => testing/web-platform/tests/css/css-cascade/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-color/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-color/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-images/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-images/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-masking/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-masking/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-shapes/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-shapes/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-transforms/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-transforms/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-ui/parsing/support/parsing-testcommon.js => testing/web-platform/tests/css/css-ui/support/parsing-testcommon.js rename : testing/web-platform/tests/css/css-writing-modes/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/css-writing-modes/support/parsing-testcommon.js rename : testing/web-platform/tests/css/filter-effects/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/filter-effects/support/parsing-testcommon.js rename : testing/web-platform/tests/css/motion/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/motion/support/parsing-testcommon.js rename : testing/web-platform/tests/css/compositing/parsing/resources/parsing-testcommon.js => testing/web-platform/tests/css/support/parsing-testcommon.js
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| // serializedValue can be the expected serialization of value,
 | |
| // or an array of permitted serializations,
 | |
| // or omitted if value should serialize as value.
 | |
| function test_valid_value(property, value, serializedValue) {
 | |
|     if (arguments.length < 3)
 | |
|         serializedValue = value;
 | |
| 
 | |
|     var stringifiedValue = JSON.stringify(value);
 | |
| 
 | |
|     test(function(){
 | |
|         var div = document.createElement('div');
 | |
|         div.style[property] = value;
 | |
|         assert_not_equals(div.style.getPropertyValue(property), "", "property should be set");
 | |
| 
 | |
|         var div = document.createElement('div');
 | |
|         div.style[property] = value;
 | |
|         var readValue = div.style.getPropertyValue(property);
 | |
|         if (serializedValue instanceof Array)
 | |
|             assert_in_array(readValue, serializedValue, "serialization should be sound");
 | |
|         else
 | |
|             assert_equals(readValue, serializedValue, "serialization should be canonical");
 | |
| 
 | |
|         div.style[property] = readValue;
 | |
|         assert_equals(div.style.getPropertyValue(property), readValue, "serialization should round-trip");
 | |
| 
 | |
|     }, "e.style['" + property + "'] = " + stringifiedValue + " should set the property value");
 | |
| }
 | |
| 
 | |
| function test_invalid_value(property, value) {
 | |
|     var stringifiedValue = JSON.stringify(value);
 | |
| 
 | |
|     test(function(){
 | |
|         var div = document.createElement('div');
 | |
|         div.style[property] = value;
 | |
|         assert_equals(div.style.getPropertyValue(property), "");
 | |
|     }, "e.style['" + property + "'] = " + stringifiedValue + " should not set the property value");
 | |
| }
 |