Skip to content

Commit

Permalink
WIP Failing test of collection scope
Browse files Browse the repository at this point in the history
  • Loading branch information
san650 committed Sep 30, 2015
1 parent 4b04853 commit b09dd00
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/unit/components/collection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ test('does not mutate collection definition after been used', function(assert) {

test('throws an error when trying to access to element 0', function(assert) {
let attribute = buildProperty(
collection({
collection({
itemScope: 'span',

item: {
Expand All @@ -189,3 +189,21 @@ test('throws an error when trying to access to element 0', function(assert) {

assert.throws(function() { attribute(0); }, /collections are 1-based arrays/, 'throws error');
});

test('assigns the correct scope to item sub components', function(assert) {
fixture('<span><p>Lorem</p></span><span><p>Ipsum</p></span>');

let attribute = buildProperty(
collection({
itemScope: 'span',
item: {
anotherComponent: {
scope: 'p',
text: text()
}
}
})
).toFunction();

assert.equal(attribute(1).anotherComponent().text(), 'Ipsum');
});

0 comments on commit b09dd00

Please sign in to comment.