aboutsummaryrefslogtreecommitdiffstats
path: root/test/CompilerSpec.js
diff options
context:
space:
mode:
authorIgor Minar2011-02-25 14:03:02 -0800
committerIgor Minar2011-03-01 17:09:25 -0800
commit945056b1667a69ecc4d557cc0f03894597250ced (patch)
tree396c0ff155fe895933cbd3301874e8799fd42b65 /test/CompilerSpec.js
parent128feb267409ee45ee5225a34aab038ddf3518fa (diff)
downloadangular.js-945056b1667a69ecc4d557cc0f03894597250ced.tar.bz2
linking function should return bound scope
angular.compile()() returns {scope:scope, view:view}, this isn't useful at all and only makes tests more verbose. Instead, this change makes the linking function return scope directly and if anyone needs the linked dom there are two ways to do it documented in angular.compile. other changes: - moved angular.compile docs to the compiler so that they are closer to the compiler - fixed some typos and updated angular.compile docs with the new return value
Diffstat (limited to 'test/CompilerSpec.js')
-rw-r--r--test/CompilerSpec.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js
index b1a881fb..b9505192 100644
--- a/test/CompilerSpec.js
+++ b/test/CompilerSpec.js
@@ -1,5 +1,5 @@
describe('compiler', function(){
- var compiler, markup, directives, widgets, compile, log, scope;
+ var compiler, markup, attrMarkup, directives, widgets, compile, log, scope;
beforeEach(function(){
log = "";
@@ -27,7 +27,7 @@ describe('compiler', function(){
compiler = new Compiler(markup, attrMarkup, directives, widgets);
compile = function(html){
var e = jqLite("<div>" + html + "</div>");
- return scope = compiler.compile(e)().scope;
+ return scope = compiler.compile(e)();
};
});
@@ -47,7 +47,7 @@ describe('compiler', function(){
};
var template = compiler.compile(e);
expect(log).toEqual("found");
- scope = template(angular.scope()).scope;
+ scope = template(angular.scope());
expect(e.hasClass('ng-directive')).toEqual(true);
expect(log).toEqual("found:init");
});
@@ -78,13 +78,13 @@ describe('compiler', function(){
it('should allow creation of templates', function(){
directives.duplicate = function(expr, element){
- var parent = element.parent();
element.replaceWith(document.createComment("marker"));
element.removeAttr("duplicate");
- var template = this.compile(element);
+ var linker = this.compile(element);
return function(marker) {
this.$onEval(function() {
- marker.after(template(angular.scope(), noop).view);
+ var scope = linker(angular.scope(), noop);
+ marker.after(scope.$element);
});
};
};