Skip to content

Commit

Permalink
optionally exclude tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pzuraq committed Nov 2, 2017
1 parent 12f3ee2 commit 1ddaec0
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 171 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"ember-cli-inject-live-reload": "^1.6.1",
"ember-cli-qunit": "^4.0.0",
"ember-cli-shims": "^1.1.0",
"ember-compatibility-helpers": "^0.1.2",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.3.0",
Expand Down
34 changes: 19 additions & 15 deletions tests/acceptance/bind-data-test-attributes-in-components-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import moduleForAcceptance from '../../tests/helpers/module-for-acceptance';

import config from 'dummy/config/environment';

import { GTE_EMBER_1_13 } from 'ember-compatibility-helpers';

if (!config.stripTestSelectors) {

/*
Expand Down Expand Up @@ -47,23 +49,25 @@ 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');
});
if (GTE_EMBER_1_13) {
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 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 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');
});
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');
});

test('it transforms data-test params to hash pairs on components', function(assert) {
assert.equal(find('.test11').find('div[data-test-something]').length, 1, 'data-test-something exists');
});
test('it transforms data-test params to hash pairs on components', function(assert) {
assert.equal(find('.test11').find('div[data-test-something]').length, 1, 'data-test-something exists');
});
}
}
8 changes: 8 additions & 0 deletions tests/dummy/app/controllers/bind-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Ember from 'ember';
import { GTE_EMBER_1_13 } from 'ember-compatibility-helpers';

const { Controller } = Ember;

export default Controller.extend({
shouldRenderParamTests: GTE_EMBER_1_13
});
10 changes: 6 additions & 4 deletions tests/dummy/app/templates/bind-test.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

<div class="test7">{{data-test-component data-test-with-boolean-value=true}}</div>

<div class="test8">{{data-test-component data-test-without-value}}</div>
{{#if shouldRenderParamTests}}
<div class="test8">{{data-test-component data-test-without-value}}</div>

<div class="test9">{{#data-test-component data-test-without-value}}foo{{/data-test-component}}</div>
<div class="test9">{{#data-test-component data-test-without-value}}foo{{/data-test-component}}</div>

<div class="test10">{{data-test-component data-test}}</div>
<div class="test10">{{data-test-component data-test}}</div>

<div class="test11">{{data-test-component data-test-something some-prop="prop"}}</div>
<div class="test11">{{data-test-component data-test-something some-prop="prop"}}</div>
{{/if}}
Loading

0 comments on commit 1ddaec0

Please sign in to comment.