Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Ember 3.x compatibility #172

Merged
merged 2 commits into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions addon/utils/bind-data-test-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ export default function bindDataTestAttributes(component) {
return;
}

let computedBindings = component.attributeBindings && component.attributeBindings.isDescriptor;
if (computedBindings) {
let message = `ember-test-selectors could not bind data-test-* properties on ${component} ` +
`automatically because attributeBindings is a computed property.`;

warn(message, false, {
id: 'ember-test-selectors.computed-attribute-bindings',
});

return;
}

let attributeBindings = component.getWithDefault('attributeBindings', []);
if (!isArray(attributeBindings)) {
attributeBindings = [attributeBindings];
Expand All @@ -48,5 +36,15 @@ export default function bindDataTestAttributes(component) {

dataTestProperties.forEach(it => attributeBindings.push(it));

component.set('attributeBindings', attributeBindings);
try {
component.set('attributeBindings', attributeBindings);

} catch (error) {
let message = `ember-test-selectors could not bind data-test-* properties on ${component} ` +
`automatically because "attributeBindings" is a read-only property.`;

warn(message, false, {
id: 'ember-test-selectors.computed-attribute-bindings',
});
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ember-disable-prototype-extensions": "^1.1.2",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.3.0",
"ember-source": "~2.18.0",
"ember-source": "~3.0.0",
"eslint": "^4.2.0",
"eslint-config-simplabs": "^0.4.0",
"eslint-plugin-ember": "^3.6.2",
Expand Down
7 changes: 3 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2252,9 +2252,9 @@ ember-router-generator@^1.0.0, ember-router-generator@^1.2.3:
dependencies:
recast "^0.11.3"

ember-source@~2.18.0:
version "2.18.2"
resolved "https://registry.yarnpkg.com/ember-source/-/ember-source-2.18.2.tgz#75d00eef5488bfe504044b025c752ba924eaf87f"
ember-source@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ember-source/-/ember-source-3.0.0.tgz#51811cae98d2ceec53bcfbaa876d02b2b5b2159f"
dependencies:
broccoli-funnel "^2.0.1"
broccoli-merge-trees "^2.0.0"
Expand All @@ -2263,7 +2263,6 @@ ember-source@~2.18.0:
ember-cli-normalize-entity-name "^1.0.0"
ember-cli-path-utils "^1.0.0"
ember-cli-string-utils "^1.1.0"
ember-cli-test-info "^1.0.0"
ember-cli-valid-component-name "^1.0.0"
ember-cli-version-checker "^2.1.0"
ember-router-generator "^1.2.3"
Expand Down