mirror of
				https://github.com/videojs/video.js.git
				synced 2025-10-31 00:08:01 +02:00 
			
		
		
		
	fix: Replace Object.values with ponyfill (#8267)
Unpin Firefox in BrowserStack tests, which fixes test failures as well. Fixes #8266.
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							1491d71b26
						
					
				
				
					commit
					866ef24b79
				
			| @@ -1,6 +1,7 @@ | ||||
| import Component from './component'; | ||||
| import * as Dom from './utils/dom'; | ||||
| import * as Guid from './utils/guid'; | ||||
| import * as Obj from './utils/obj'; | ||||
|  | ||||
| /** | ||||
|  * Displays an element over the player which contains an optional title and | ||||
| @@ -39,7 +40,7 @@ class TitleBar extends Component { | ||||
|  | ||||
|     return Dom.createEl('div', { | ||||
|       className: 'vjs-title-bar' | ||||
|     }, {}, Object.values(this.els)); | ||||
|     }, {}, Obj.values(this.els)); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|   | ||||
| @@ -148,6 +148,26 @@ export function merge(...sources) { | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Returns an array of values for a given object | ||||
|  * | ||||
|  * @param  {Object} source - target object | ||||
|  * @return {Array<unknown>} - object values | ||||
|  */ | ||||
| export function values(source = {}) { | ||||
|   const result = []; | ||||
|  | ||||
|   for (const key in source) { | ||||
|     if (source.hasOwnProperty(key)) { | ||||
|       const value = source[key]; | ||||
|  | ||||
|       result.push(value); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Object.defineProperty but "lazy", which means that the value is only set after | ||||
|  * it is retrieved the first time, rather than being set right away. | ||||
|   | ||||
| @@ -50,13 +50,6 @@ module.exports = function(config) { | ||||
|  | ||||
|   config.browserStack.project = 'Video.js'; | ||||
|  | ||||
|   // pin Browserstack Firefox version to 64 | ||||
|   /* eslint-disable camelcase */ | ||||
|   if (config.customLaunchers && config.customLaunchers.bsFirefox) { | ||||
|     config.customLaunchers.bsFirefox.browser_version = '64.0'; | ||||
|   } | ||||
|   /* eslint-enable camelcase */ | ||||
|  | ||||
|   // uncomment the section below to re-enable all browserstack video recording | ||||
|   // it is off by default because it slows the build | ||||
|   /* | ||||
|   | ||||
| @@ -176,4 +176,30 @@ QUnit.module('utils/obj', function() { | ||||
|     assert.strictEqual(b, 2, 'the value was retrieved correctly'); | ||||
|     assert.strictEqual(descriptor.value, 2, 'descriptor has a value'); | ||||
|   }); | ||||
|  | ||||
|   QUnit.module('values', () => { | ||||
|     QUnit.test('returns an array of values for a given object', (assert) => { | ||||
|       const source = { a: 1, b: 2, c: 3 }; | ||||
|       const expectedResult = [1, 2, 3]; | ||||
|  | ||||
|       assert.deepEqual(Obj.values(source), expectedResult, 'All values are extracted correctly'); | ||||
|     }); | ||||
|  | ||||
|     QUnit.test('returns an empty array for an empty object', (assert) => { | ||||
|       const source = {}; | ||||
|       const expectedResult = []; | ||||
|  | ||||
|       assert.deepEqual(Obj.values(source), expectedResult, 'Empty array is returned for an empty object'); | ||||
|     }); | ||||
|  | ||||
|     QUnit.test('ignores prototype properties', (assert) => { | ||||
|       const source = Object.create({ a: 1 }); | ||||
|  | ||||
|       source.b = 2; | ||||
|  | ||||
|       const expectedResult = [2]; | ||||
|  | ||||
|       assert.deepEqual(Obj.values(source), expectedResult, 'Only own properties are included in the result'); | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user