From 44acddc4cf8525d5bfaa11a009cf53ffd0170480 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Fri, 23 Jul 2021 10:19:24 +0200 Subject: [PATCH] fix ember-test-selectors custom adapter for 6.x --- .../src/compat-adapters/ember-test-selectors.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/compat/src/compat-adapters/ember-test-selectors.ts b/packages/compat/src/compat-adapters/ember-test-selectors.ts index 83bb4aa77..a8161e938 100644 --- a/packages/compat/src/compat-adapters/ember-test-selectors.ts +++ b/packages/compat/src/compat-adapters/ember-test-selectors.ts @@ -1,12 +1,14 @@ import V1Addon from '../v1-addon'; import { forceIncludeModule } from '../compat-utils'; +import semver from 'semver'; export default class extends V1Addon { + // v6.0.0 of ember-test-selectors dropped the attribute binding for classic components + static shouldApplyAdapter(addonInstance: any) { + return semver.lt(addonInstance.pkg.version, '6.0.0') && !addonInstance._stripTestSelectors; + } + get packageMeta() { - if (this.addonInstance._stripTestSelectors) { - return super.packageMeta; - } else { - return forceIncludeModule(super.packageMeta, './utils/bind-data-test-attributes'); - } + return forceIncludeModule(super.packageMeta, './utils/bind-data-test-attributes'); } }