From 4ea37048b094ecc12880339990e334d927228319 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Fri, 12 Oct 2018 14:02:22 +0200 Subject: [PATCH] Use `assert()` for "read-only attributeBindings" warning --- addon/utils/bind-data-test-attributes.js | 4 ++-- tests/unit/utils/bind-data-test-attributes-test.js | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/addon/utils/bind-data-test-attributes.js b/addon/utils/bind-data-test-attributes.js index d7c49bc7..c2bfd0be 100644 --- a/addon/utils/bind-data-test-attributes.js +++ b/addon/utils/bind-data-test-attributes.js @@ -1,4 +1,4 @@ -import { assert, warn } from '@ember/debug'; +import { assert } from '@ember/debug'; import { isArray } from '@ember/array'; const TEST_SELECTOR_PREFIX = /data-test-.*/; @@ -40,7 +40,7 @@ export default function bindDataTestAttributes(component) { let message = `ember-test-selectors could not bind data-test-* properties on ${component} ` + `automatically because "attributeBindings" is a read-only property.`; - warn(message, false, { + assert(message, false, { id: 'ember-test-selectors.computed-attribute-bindings', }); } diff --git a/tests/unit/utils/bind-data-test-attributes-test.js b/tests/unit/utils/bind-data-test-attributes-test.js index 7ed68146..c25e2cba 100644 --- a/tests/unit/utils/bind-data-test-attributes-test.js +++ b/tests/unit/utils/bind-data-test-attributes-test.js @@ -96,7 +96,7 @@ test('it does not add a data-test property', function(assert) { assert.deepEqual(instance.get('attributeBindings'), undefined); }); -test('it skips if attributeBindings is a computed property', function(assert) { +test('it breaks if attributeBindings is a computed property', function(assert) { let Fixture = EmberObject.extend({ attributeBindings: computed('prop', function() { return [this.get('prop')]; @@ -112,11 +112,7 @@ test('it skips if attributeBindings is a computed property', function(assert) { 'data-test-from-invocation': 'bar', }); - assert.deepEqual(instance.get('attributeBindings'), ['foo']); - - bindDataTestAttributes(instance); - - assert.deepEqual(instance.get('attributeBindings'), ['foo']); + assert.throws(() => bindDataTestAttributes(instance)); }); test('it breaks if tagName is empty', function(assert) {