From 001b11eeca0ecca4dd66363d0972371114c04949 Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Tue, 24 Jan 2017 11:18:35 -0800 Subject: [PATCH] attributeBindings is frozen, slice it before push As noted in the Ember v2.11 release notes, concatenated properties such as attributeBindings are frozen in debug builds. This means we cannot push directly onto the attributeBindings array without first copying it via slice. Without this change, users may see errors like this when the `attributeBindings.push()` call is made: Uncaught TypeError: Can't add property 2, object is not extensible References: https://github.com/emberjs/ember.js/pull/14389 https://github.com/emberjs/ember.js/issues/14601 --- addon/utils/bind-data-test-attributes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addon/utils/bind-data-test-attributes.js b/addon/utils/bind-data-test-attributes.js index 906f871a..4d012098 100644 --- a/addon/utils/bind-data-test-attributes.js +++ b/addon/utils/bind-data-test-attributes.js @@ -37,6 +37,8 @@ export default function bindDataTestAttributes(component) { let attributeBindings = component.getWithDefault('attributeBindings', []); if (!Ember.isArray(attributeBindings)) { attributeBindings = [attributeBindings]; + } else { + attributeBindings = attributeBindings.slice(); } dataTestProperties.forEach(it => attributeBindings.push(it));