From 6e74ef842b39acfbad39feacf49e7e53a451b583 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 14 Dec 2018 20:10:21 -0500 Subject: [PATCH] Avoid extended array directly in tests. Unfortunately, `class Foo extends Array{}` doesn't work well with older browsers (and would even require changes in our transpilation for production builds for modern ones). The actual test doesn't care if its running on an Array (without the fixes in this PR this modified test still fails the same way). --- .../@ember/-internals/runtime/tests/array/apply-test.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/@ember/-internals/runtime/tests/array/apply-test.js b/packages/@ember/-internals/runtime/tests/array/apply-test.js index ac277599f4a..e40068c55b1 100644 --- a/packages/@ember/-internals/runtime/tests/array/apply-test.js +++ b/packages/@ember/-internals/runtime/tests/array/apply-test.js @@ -3,8 +3,8 @@ import { AbstractTestCase, moduleFor } from 'internal-test-helpers'; class ArrayPrototypeExtensionSelfReferenceTests extends AbstractTestCase { '@test should not create non-Symbol, enumerable properties that refer to itself'() { - // Don't want to pollute Array.prototype so we make our own to extend - class ThrowAwayArray extends Array {} + // Don't want to pollute Array.prototype so we make a fake / simple prototype + function ThrowAwayArray() {} // Extend our throw-away prototype (like EXTEND_PROTOTYPES.Array would) NativeArray.apply(ThrowAwayArray.prototype); @@ -12,9 +12,6 @@ class ArrayPrototypeExtensionSelfReferenceTests extends AbstractTestCase { // Create an instance to test let obj = new ThrowAwayArray(); - // Make sure we have an array-like thing & avoid the zero assertion problem is there are no enumerable properties - this.assert.strictEqual(obj.length, 0); - // Make sure that no enumerable properties refer back to the object (creating a cyclic structure) for (let p in obj) { this.assert.notStrictEqual(