Skip to content

Commit

Permalink
Merge pull request #318 from mgechev/issue-315
Browse files Browse the repository at this point in the history
test: add additional tests
  • Loading branch information
mgechev committed Jun 9, 2017
2 parents 4193d17 + 6546dcb commit 6323d2c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
33 changes: 33 additions & 0 deletions test/templatesUsePublicRule.spec.ts
Expand Up @@ -252,4 +252,37 @@ describe('templates-use-public', () => {
});
});
});

describe('binding to complex data structure', () => {

it('should work with binding to an array', () => {
const source = `
@Component({
template: '<span>{{ something["a"].b }}</span>'
})
export class DemoComponent {
public something: { a: any } = { a: { b: 1 } };
}
`;
assertSuccess('templates-use-public', source);
});

it('should work with binding to an array of specific class', () => {
const source = `
class Something {
public a = 1;
public b = 2;
}
@Component({
template: '<span>{{ something[0].a }}</span>'
})
export class DemoComponent {
public something: Something[] = [new Something()];
}
`;
assertSuccess('templates-use-public', source);
});

});
});
20 changes: 14 additions & 6 deletions yarn.lock
Expand Up @@ -2,13 +2,17 @@
# yarn lockfile v1


"@angular/compiler@^4.0.0":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.0.1.tgz#15721edb148167a2d83b6f9324817e658eac8280"
"@angular/compiler@^4.1.3":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.2.0.tgz#a21df81995b210f822ffd70b57247d474876fbed"
dependencies:
tslib "^1.7.1"

"@angular/core@^4.0.0":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.0.1.tgz#0b110a001012076ea696460ccd922707bcdf51ba"
"@angular/core@^4.1.3":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.2.0.tgz#8bf57d01379c2a9e29476ad569dec9e20d5b17dc"
dependencies:
tslib "^1.7.1"

"@types/chai@^3.4.33":
version "3.4.34"
Expand Down Expand Up @@ -1381,6 +1385,10 @@ tsconfig@^5.0.2:
strip-bom "^2.0.0"
strip-json-comments "^2.0.0"

tslib@^1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec"

tslint@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.1.0.tgz#51a47baeeb58956fcd617bd2cf00e2ef0eea2ed9"
Expand Down

0 comments on commit 6323d2c

Please sign in to comment.