diff --git a/index.js b/index.js index 4fe22377..df329ac4 100644 --- a/index.js +++ b/index.js @@ -35,6 +35,14 @@ module.exports = { plugin: StripTestSelectorsTransform, baseDir: function() { return __dirname; } }); + } else { + var TransformTestSelectorParamsToHashPairs = require('./transform-test-selector-params-to-hash-pairs'); + + registry.add('htmlbars-ast-plugin', { + name: 'transform-test-selector-params-to-hash-pairs', + plugin: TransformTestSelectorParamsToHashPairs, + baseDir: function() { return __dirname; } + }); } } }, 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 3562f661..9043c002 100644 --- a/tests/acceptance/bind-data-test-attributes-in-components-test.js +++ b/tests/acceptance/bind-data-test-attributes-in-components-test.js @@ -39,7 +39,7 @@ if (!config.stripTestSelectors) { assert.equal(find('.test4').find('div[data-non-test]').length, 0, 'data-non-test does not exists'); }); - test('it leaves data-test attributes untouched on components', function (assert) { + test('it leaves data-test attribute untouched on components', function (assert) { assert.equal(find('.test5').find('div[data-test]').length, 0, 'data-test does not exists'); }); @@ -47,5 +47,20 @@ if (!config.stripTestSelectors) { assert.equal(find('.test6').find('div[data-non-test]').length, 0, 'data-non-test does not exists'); }); -} + test('it binds data-test-* attributes with boolean values on components', function (assert) { + assert.equal(find('.test7').find('div[data-test-with-boolean-value]').length, 1, 'data-test-with-boolean-value exists'); + }); + test('it binds data-test-* attributes without values on components', function (assert) { + assert.equal(find('.test8').find('div[data-test-without-value]').length, 1, 'data-test-without-value exists'); + }); + + test('it binds data-test-* attributes without values on block components', function (assert) { + assert.equal(find('.test9').find('div[data-test-without-value]').length, 1, 'data-test-without-value exists'); + }); + + test('it leaves data-test attribute without value untouched on components', function (assert) { + assert.equal(find('.test10').find('div[data-test]').length, 0, 'data-test does not exists'); + }); + +} diff --git a/tests/dummy/app/templates/bind-test.hbs b/tests/dummy/app/templates/bind-test.hbs index 98364b18..533f59da 100644 --- a/tests/dummy/app/templates/bind-test.hbs +++ b/tests/dummy/app/templates/bind-test.hbs @@ -9,3 +9,11 @@