Skip to content

Commit

Permalink
Add more binding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jan 23, 2017
1 parent ff661e3 commit d1cae3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
16 changes: 14 additions & 2 deletions tests/acceptance/bind-data-test-attributes-in-components-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,28 @@ 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');
});

test('it leaves other data attributes untouched on components', function (assert) {
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('.test7').find('div[data-test-without-value]').length, 1, 'data-test-without-value exists');
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');
});

}
8 changes: 7 additions & 1 deletion tests/dummy/app/templates/bind-test.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@

<div class="test6">{{data-test-component data-non-test="foo"}}</div>

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

<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="test10">{{data-test-component data-test}}</div>

0 comments on commit d1cae3c

Please sign in to comment.