From 9d5c53379180a110e427a01a1446eada3f0fc3d6 Mon Sep 17 00:00:00 2001
From: Igor Minar
Date: Thu, 10 Mar 2011 14:26:22 -0800
Subject: ng:autobind now optionally takes element id
so it is possible to easily compile just a part of a document.
e.g.:
partially compiled doc
this part won't be compiled: {{1+2}}
Click count: {{i}}
---
test/AngularSpec.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
(limited to 'test/AngularSpec.js')
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index e9215bee..f5556f7c 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -356,6 +356,60 @@ describe('angular', function(){
});
+ describe('angularInit', function() {
+ var dom;
+
+ beforeEach(function() {
+ dom = jqLite('{{2+3}}' +
+ '
{{4+5}}
' +
+ '
')[0];
+ });
+
+
+ afterEach(function() {
+ dealoc(dom);
+ });
+
+
+ it('should not compile anything if autobind is missing or false', function() {
+ angularInit({}, dom);
+ expect(sortedHtml(dom)).toEqual('{{2+3}}' +
+ '
{{4+5}}
' +
+ '
');
+ });
+
+
+ it('should compile the document if autobind is true', function() {
+ angularInit({autobind: true}, dom);
+ expect(sortedHtml(dom)).toEqual('' +
+ '
5' +
+ '
'+
+ '9' +
+ '
' +
+ '
');
+ });
+
+
+ it('should compile only the element specified via autobind', function() {
+ dom.getElementById = function() {
+ return this.childNodes[1];
+ }
+
+ angularInit({autobind: 'child'}, dom);
+ expect(sortedHtml(dom)).toEqual('{{2+3}}' +
+ '
'+
+ '9' +
+ '
' +
+ '
');
+ });
+
+
+ xit('should add custom css when specified via css', function() {
+ //TODO
+ });
+ });
+
+
describe('angular service', function() {
it('should override services', function() {
var scope = createScope();
--
cgit v1.2.3