Skip to content

Commit

Permalink
Merge pull request #254 from Turbo87/assert
Browse files Browse the repository at this point in the history
Use `assert()` for "read-only attributeBindings" warning
  • Loading branch information
Turbo87 authored Oct 12, 2018
2 parents a0cf13a + 4ea3704 commit c65ae33
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 c65ae33

Please sign in to comment.