diff --git a/index.js b/index.js
index dbc3739a..3c53f96b 100644
--- a/index.js
+++ b/index.js
@@ -30,16 +30,16 @@ module.exports = {
},
_setupPreprocessorRegistry(registry) {
- let pluginFnName = this._stripTestSelectors ? '_buildStripPlugin' : '_buildHashParamPlugin';
-
- let plugin = this[pluginFnName]();
- plugin.parallelBabel = {
- requireFile: __filename,
- buildUsing: pluginFnName,
- params: {},
- };
-
- registry.add('htmlbars-ast-plugin', plugin);
+ if (this._stripTestSelectors) {
+ let plugin = this._buildStripPlugin();
+ plugin.parallelBabel = {
+ requireFile: __filename,
+ buildUsing: '_buildStripPlugin',
+ params: {},
+ };
+
+ registry.add('htmlbars-ast-plugin', plugin);
+ }
},
included(appOrParent) {
@@ -119,15 +119,4 @@ module.exports = {
cacheKey: StripTestSelectorsTransform.cacheKey,
};
},
-
- _buildHashParamPlugin() {
- let TransformTestSelectorParamsToHashPairs = require('./transform-test-selector-params-to-hash-pairs');
-
- return {
- name: 'transform-test-selector-params-to-hash-pairs',
- plugin: TransformTestSelectorParamsToHashPairs,
- baseDir: TransformTestSelectorParamsToHashPairs.baseDir,
- cacheKey: TransformTestSelectorParamsToHashPairs.cacheKey,
- };
- },
};
diff --git a/tests/acceptance/bind-data-test-attributes-in-components-test.js b/tests/acceptance/bind-data-test-attributes-in-components-test.js
index 23f007f4..b0c4fa27 100644
--- a/tests/acceptance/bind-data-test-attributes-in-components-test.js
+++ b/tests/acceptance/bind-data-test-attributes-in-components-test.js
@@ -1,9 +1,8 @@
-import { module, test, skip } from 'qunit';
+import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import config from 'dummy/config/environment';
-import { hasPositionalParams } from 'dummy/version-checks';
if (!config.stripTestSelectors) {
@@ -54,22 +53,6 @@ if (!config.stripTestSelectors) {
assert.dom('.test7 div[data-test-with-boolean-value]').exists('data-test-with-boolean-value exists');
});
- test('it binds data-test-* attributes without values on components', function(assert) {
- assert.dom('.test8 div[data-test-without-value]').exists('data-test-without-value exists');
- });
-
- test('it binds data-test-* attributes without values on block components', function(assert) {
- assert.dom('.test9 div[data-test-without-value]').exists('data-test-without-value exists');
- });
-
- (hasPositionalParams ? test : skip)('it leaves data-test attribute without value untouched on components', function(assert) {
- assert.dom('.test10 div[data-test]').doesNotExist('data-test does not exists');
- });
-
- test('it transforms data-test params to hash pairs on components', function(assert) {
- assert.dom('.test11 div[data-test-something]').exists('data-test-something exists');
- });
-
test('it binds data-test attributes on {{link-to}} components', function(assert) {
assert.dom('.test-link-to-block a').hasAttribute('data-test-foo', 'bar');
assert.dom('.test-link-to-inline a').hasAttribute('data-test-foo', 'bar');
diff --git a/tests/dummy/app/controllers/bind-test.js b/tests/dummy/app/controllers/bind-test.js
deleted file mode 100644
index 08394341..00000000
--- a/tests/dummy/app/controllers/bind-test.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import Controller from '@ember/controller';
-import { hasPositionalParams } from 'dummy/version-checks';
-
-export default Controller.extend({
- hasPositionalParams,
-});
diff --git a/tests/dummy/app/templates/bind-test.hbs b/tests/dummy/app/templates/bind-test.hbs
index ab4759ff..ac37ac64 100644
--- a/tests/dummy/app/templates/bind-test.hbs
+++ b/tests/dummy/app/templates/bind-test.hbs
@@ -12,16 +12,6 @@
{{data-test-component data-test-with-boolean-value=true}}
-{{data-test-component data-test-without-value}}
-
-{{#data-test-component data-test-without-value}}foo{{/data-test-component}}
-
-{{#if hasPositionalParams}}
- {{data-test-component data-test}}
-{{/if}}
-
-{{data-test-component data-test-something some-prop="prop"}}
-
{{#link-to "index" data-test-foo="bar"}}Label{{/link-to}}
{{link-to "Label" "index" data-test-foo="bar"}}
diff --git a/tests/dummy/app/version-checks.js b/tests/dummy/app/version-checks.js
deleted file mode 100644
index 40e30225..00000000
--- a/tests/dummy/app/version-checks.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import Ember from 'ember';
-
-const { VERSION } = Ember;
-
-export const hasPositionalParams = hasEmberVersion(1, 13);
-export const hasReliablePositionalParams = hasEmberVersion(2, 3);
-
-/**
- Checks if the currently running Ember version is greater than or equal to the
- specified major and minor version numbers.
- @private
- @param {number} major the major version number to compare
- @param {number} minor the minor version number to compare
- @returns {boolean} true if the Ember version is >= MAJOR.MINOR specified, false otherwise
-*/
-export function hasEmberVersion(major, minor) {
- let numbers = VERSION.split('-')[0].split('.');
- let actualMajor = parseInt(numbers[0], 10);
- let actualMinor = parseInt(numbers[1], 10);
- return actualMajor > major || (actualMajor === major && actualMinor >= minor);
-}
diff --git a/tests/integration/strip-data-test-attributes-from-components-test.js b/tests/integration/strip-data-test-attributes-from-components-test.js
index 5cdcb08c..21939ac7 100644
--- a/tests/integration/strip-data-test-attributes-from-components-test.js
+++ b/tests/integration/strip-data-test-attributes-from-components-test.js
@@ -1,42 +1,14 @@
-import { module, test, skip } from 'qunit';
+import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import config from 'dummy/config/environment';
-import {
- hasReliablePositionalParams,
- hasEmberVersion
-} from 'dummy/version-checks';
module('StripTestSelectorsTransform plugin', function(hooks) {
setupRenderingTest(hooks);
if (config.stripTestSelectors) {
- (hasReliablePositionalParams ? test : skip)('it strips data-test-* attributes from components with single positional params', async function(assert) {
- await render(hbs`{{print-test-attributes data-test-should-not-be}}`);
-
- assert.dom('.data-test-positional-params').hasText(hasEmberVersion(2, 10) || !hasEmberVersion(2, 3) ? '' : '0', 'there should be no params');
- });
-
- (hasReliablePositionalParams ? test : skip)('it strips data-test-* attributes from components with positional params data-test-* as first param', async function(assert) {
- await render(hbs`{{print-test-attributes data-test-should-not-be "param1"}}`);
-
- assert.dom('.data-test-positional-params').hasText('1', 'there should be only one param');
- });
-
- (hasReliablePositionalParams ? test : skip)('it strips data-test-* attributes from components with multiple positional params', async function(assert) {
- await render(hbs`{{print-test-attributes "param1" data-test-should-not-be}}`);
-
- assert.dom('.data-test-positional-params').hasText('1', 'there should be only one param');
- });
-
- (hasReliablePositionalParams ? test : skip)('it strips data-test-* attributes from components with block and multiple positional params', async function(assert) {
- await render(hbs`{{#print-test-attributes "param1" data-test-should-not-be}}{{/print-test-attributes}}`);
-
- assert.dom('.data-test-positional-params').hasText('1', 'there should be only one param');
- });
-
test('it strips data-test-* attributes from components', async function(assert) {
await render(hbs`{{print-test-attributes data-test-first="foobar"}}`);
diff --git a/transform-test-selector-params-to-hash-pairs.js b/transform-test-selector-params-to-hash-pairs.js
deleted file mode 100644
index 04711461..00000000
--- a/transform-test-selector-params-to-hash-pairs.js
+++ /dev/null
@@ -1,67 +0,0 @@
-'use strict';
-
-/* eslint-env node */
-
-let TEST_SELECTOR_PREFIX = /data-test-.*/;
-let shownDeprecationWarning = false;
-
-function isTestSelectorParam(param) {
- return param.type === 'PathExpression'
- && TEST_SELECTOR_PREFIX.test(param.original);
-}
-
-module.exports = function(env) {
- let b = env.syntax.builders;
- let transform = (node) => {
- if ('sexpr' in node) {
- node = node.sexpr;
- }
-
- let testSelectorParams = [];
- let otherParams = [];
-
- node.params.forEach(function(param) {
- if (isTestSelectorParam(param)) {
- testSelectorParams.push(param);
- if (!shownDeprecationWarning) {
- // eslint-disable-next-line no-console
- console.warn(
- '\n\n[ember-test-selectors] DEPRECATION: Using data-test ' +
- 'parameters without values in curly component invocations is ' +
- 'deprecated. You can use https://github.com/simplabs/ember-test-selectors-params-codemod ' +
- 'to migrate away from this pattern. See https://github.com/simplabs/ember-test-selectors/issues/151 ' +
- 'for more details.\n'
- );
-
- shownDeprecationWarning = true;
- }
- } else {
- otherParams.push(param);
- }
- });
-
- node.params = otherParams;
-
- testSelectorParams.forEach(function(param) {
- let pair = b.pair(param.original, b.boolean(true));
- node.hash.pairs.push(pair);
- });
- };
-
- return {
- name: 'TransformTestSelectorParamsToHashPairs',
-
- visitor: {
- MustacheStatement: transform,
- BlockStatement: transform,
- },
- };
-};
-
-module.exports.baseDir = function() {
- return __dirname;
-};
-
-module.exports.cacheKey = function() {
- return 'transform-test-selector-params-to-hash-pairs';
-};