aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/compileSpec.js
diff options
context:
space:
mode:
authorPete Bacon Darwin2012-10-24 11:06:36 +0100
committerMisko Hevery2013-02-14 21:36:59 -0800
commit2ed53087d7dd06d728e333a449265f7685275548 (patch)
treeac6c1782b17ea9f86408db78740e39cef8eef0dc /test/ng/compileSpec.js
parent0af172040e03811c59d01682968241e3df226774 (diff)
downloadangular.js-2ed53087d7dd06d728e333a449265f7685275548.tar.bz2
fix(compile): Interpolate @ locals before the link function runs
Do a one-off interpolation of @ locals to ensure that the link fn receives attributes that are already interpolated.
Diffstat (limited to 'test/ng/compileSpec.js')
-rw-r--r--test/ng/compileSpec.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index a7707cf9..3b69f609 100644
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -1812,27 +1812,21 @@ describe('$compile', function() {
describe('attribute', function() {
it('should copy simple attribute', inject(function() {
compile('<div><span my-component attr="some text">');
- expect(componentScope.attr).toEqual(undefined);
- expect(componentScope.attrAlias).toEqual(undefined);
-
- $rootScope.$apply();
expect(componentScope.attr).toEqual('some text');
expect(componentScope.attrAlias).toEqual('some text');
expect(componentScope.attrAlias).toEqual(componentScope.attr);
}));
-
- it('should update when interpolated attribute updates', inject(function() {
- compile('<div><span my-component attr="hello {{name}}">');
- expect(componentScope.attr).toEqual(undefined);
- expect(componentScope.attrAlias).toEqual(undefined);
-
+ it('should set up the interpolation before it reaches the link function', inject(function() {
$rootScope.name = 'misko';
- $rootScope.$apply();
-
+ compile('<div><span my-component attr="hello {{name}}">');
expect(componentScope.attr).toEqual('hello misko');
expect(componentScope.attrAlias).toEqual('hello misko');
+ }));
+
+ it('should update when interpolated attribute updates', inject(function() {
+ compile('<div><span my-component attr="hello {{name}}">');
$rootScope.name = 'igor';
$rootScope.$apply();