Skip to content

Commit

Permalink
Use assert() for "read-only attributeBindings" warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Oct 12, 2018
1 parent 21f2376 commit 4ea3704
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions addon/utils/bind-data-test-attributes.js
Original file line number Diff line number Diff line change
@@ -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-.*/;
Expand Down Expand Up @@ -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',
});
}
Expand Down
8 changes: 2 additions & 6 deletions tests/unit/utils/bind-data-test-attributes-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')];
Expand All @@ -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) {
Expand Down

0 comments on commit 4ea3704

Please sign in to comment.