');
- var first = jqLite(c.view[0].childNodes[0]);
- var second = jqLite(c.view[0].childNodes[1]);
- var errorLogs = c.scope.$service('$log').error.logs;
+ var first = jqLite(scope.$element[0].childNodes[0]);
+ var second = jqLite(scope.$element[0].childNodes[1]);
+ var errorLogs = scope.$service('$log').error.logs;
browserTrigger(first, 'click');
- assertEquals("ABC", c.scope.greeting);
+ assertEquals("ABC", scope.greeting);
expect(errorLogs).toEqual([]);
browserTrigger(second, 'click');
@@ -587,70 +585,70 @@ describe('Binder', function(){
});
it('ItShouldSelectTheCorrectRadioBox', function(){
- var c = this.compile('
' +
+ var scope = this.compile('
' +
' ' +
'
');
- var female = jqLite(c.view[0].childNodes[0]);
- var male = jqLite(c.view[0].childNodes[1]);
+ var female = jqLite(scope.$element[0].childNodes[0]);
+ var male = jqLite(scope.$element[0].childNodes[1]);
browserTrigger(female);
- assertEquals("female", c.scope.sex);
+ assertEquals("female", scope.sex);
assertEquals(true, female[0].checked);
assertEquals(false, male[0].checked);
assertEquals("female", female.val());
browserTrigger(male);
- assertEquals("male", c.scope.sex);
+ assertEquals("male", scope.sex);
assertEquals(false, female[0].checked);
assertEquals(true, male[0].checked);
assertEquals("male", male.val());
});
it('ItShouldRepeatOnHashes', function(){
- var x = this.compile('
');
- x.scope.$eval();
+ var scope = this.compile('
');
+ scope.$eval();
assertEquals('
' +
'<#comment>#comment>' +
'a0 ' +
'b1 ' +
' ',
- sortedHtml(x.view));
+ sortedHtml(scope.$element));
});
it('ItShouldFireChangeListenersBeforeUpdate', function(){
- var x = this.compile('
');
- x.scope.$set("name", "");
- x.scope.$watch("watched", "name=123");
- x.scope.$set("watched", "change");
- x.scope.$eval();
- assertEquals(123, x.scope.$get("name"));
+ var scope = this.compile('
');
+ scope.$set("name", "");
+ scope.$watch("watched", "name=123");
+ scope.$set("watched", "change");
+ scope.$eval();
+ assertEquals(123, scope.$get("name"));
assertEquals(
'
123
',
- sortedHtml(x.view));
+ sortedHtml(scope.$element));
});
it('ItShouldHandleMultilineBindings', function(){
- var x = this.compile('
{{\n 1 \n + \n 2 \n}}
');
- x.scope.$eval();
- assertEquals("3", x.view.text());
+ var scope = this.compile('
{{\n 1 \n + \n 2 \n}}
');
+ scope.$eval();
+ assertEquals("3", scope.$element.text());
});
it('ItBindHiddenInputFields', function(){
- var x = this.compile('
');
- x.scope.$eval();
- assertEquals("abc", x.scope.$get("myName"));
+ var scope = this.compile('
');
+ scope.$eval();
+ assertEquals("abc", scope.$get("myName"));
});
it('ItShouldUseFormaterForText', function(){
- var x = this.compile('
');
- x.scope.$eval();
- assertEquals(['a','b'], x.scope.$get('a'));
- var input = x.view;
+ var scope = this.compile('
');
+ scope.$eval();
+ assertEquals(['a','b'], scope.$get('a'));
+ var input = scope.$element;
input[0].value = ' x,,yz';
browserTrigger(input, 'change');
- assertEquals(['x','yz'], x.scope.$get('a'));
- x.scope.$set('a', [1 ,2, 3]);
- x.scope.$eval();
+ assertEquals(['x','yz'], scope.$get('a'));
+ scope.$set('a', [1 ,2, 3]);
+ scope.$eval();
assertEquals('1, 2, 3', input[0].value);
});
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("
" + html + "
");
- 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);
});
};
};
diff --git a/test/ResourceSpec.js b/test/ResourceSpec.js
index c93bdafb..76909968 100644
--- a/test/ResourceSpec.js
+++ b/test/ResourceSpec.js
@@ -180,7 +180,7 @@ describe("resource", function() {
});
it('should excersize full stack', function(){
- var scope = angular.compile('
')().scope;
+ var scope = angular.compile('
')();
var $browser = scope.$service('$browser');
var $resource = scope.$service('$resource');
var Person = $resource('/Person/:id');
@@ -192,7 +192,7 @@ describe("resource", function() {
});
it('should return the same object when verifying the cache', function(){
- var scope = angular.compile('
')().scope;
+ var scope = angular.compile('
')();
var $browser = scope.$service('$browser');
var $resource = scope.$service('$resource');
var Person = $resource('/Person/:id', null, {query: {method:'GET', isArray: true, verifyCache: true}});
diff --git a/test/ScenarioSpec.js b/test/ScenarioSpec.js
index ce8ce69c..14ab82ce 100644
--- a/test/ScenarioSpec.js
+++ b/test/ScenarioSpec.js
@@ -12,25 +12,25 @@ describe("ScenarioSpec: Compilation", function(){
describe('compilation', function(){
it("should compile dom node and return scope", function(){
var node = jqLite('
{{b=a+1}}
')[0];
- scope = angular.compile(node)().scope;
+ scope = angular.compile(node)();
expect(scope.a).toEqual(1);
expect(scope.b).toEqual(2);
});
it("should compile jQuery node and return scope", function(){
- scope = compile(jqLite('
{{a=123}}
'))().scope;
+ scope = compile(jqLite('
{{a=123}}
'))();
expect(jqLite(scope.$element).text()).toEqual('123');
});
it("should compile text node and return scope", function(){
- scope = angular.compile('
{{a=123}}
')().scope;
+ scope = angular.compile('
{{a=123}}
')();
expect(jqLite(scope.$element).text()).toEqual('123');
});
});
describe('scope', function(){
it("should have $set, $get, $eval, $updateView methods", function(){
- scope = angular.compile('
{{a}}
')().scope;
+ scope = angular.compile('
{{a}}
')();
scope.$eval("$invalidWidgets.push({})");
expect(scope.$set("a", 2)).toEqual(2);
expect(scope.$get("a")).toEqual(2);
@@ -40,7 +40,7 @@ describe("ScenarioSpec: Compilation", function(){
});
it("should have $ objects", function(){
- scope = angular.compile('
')(angular.scope({$config: {a:"b"}})).scope;
+ scope = angular.compile('
')(angular.scope({$config: {a:"b"}}));
expect(scope.$service('$location')).toBeDefined();
expect(scope.$get('$eval')).toBeDefined();
expect(scope.$get('$config')).toBeDefined();
@@ -51,7 +51,7 @@ describe("ScenarioSpec: Compilation", function(){
describe("configuration", function(){
it("should take location object", function(){
var url = "http://server/#?book=moby";
- scope = angular.compile("
{{$location}}
")().scope;
+ scope = angular.compile("
{{$location}}
")();
var $location = scope.$service('$location');
var $browser = scope.$service('$browser');
expect($location.hashSearch.book).toBeUndefined();
diff --git a/test/ValidatorsSpec.js b/test/ValidatorsSpec.js
index 2d4fca98..773ac7d0 100644
--- a/test/ValidatorsSpec.js
+++ b/test/ValidatorsSpec.js
@@ -7,7 +7,7 @@ describe('ValidatorTest', function(){
validator.last = last;
validator._this = this;
};
- var scope = compile('
')().scope;
+ var scope = compile('
')();
scope.name = 'misko';
scope.$eval();
assertEquals('misko', validator.first);
@@ -95,7 +95,7 @@ describe('ValidatorTest', function(){
beforeEach(function(){
value = null;
fn = null;
- self = angular.compile('
')().scope;
+ self = angular.compile('
')();
jqLite(document.body).append(self.$element);
self.$element.data('$validate', noop);
self.$root = self;
@@ -108,7 +108,7 @@ describe('ValidatorTest', function(){
it('should make a request and show spinner', function(){
var value, fn;
var scope = angular.compile(
- '
')().scope;
+ '
')();
jqLite(document.body).append(scope.$element);
var input = scope.$element;
scope.asyncFn = function(v,f){
@@ -151,7 +151,7 @@ describe('ValidatorTest', function(){
it("should handle update function", function(){
var scope = angular.compile(
- '
')().scope;
+ '
')();
scope.asyncFn = jasmine.createSpy();
scope.updateFn = jasmine.createSpy();
scope.name = 'misko';
diff --git a/test/directivesSpec.js b/test/directivesSpec.js
index c02eb025..4b2e7055 100644
--- a/test/directivesSpec.js
+++ b/test/directivesSpec.js
@@ -5,7 +5,7 @@ describe("directive", function(){
beforeEach(function() {
compile = function(html) {
element = jqLite(html);
- return model = angular.compile(element)().scope;
+ return model = angular.compile(element)();
};
});
diff --git a/test/markupSpec.js b/test/markupSpec.js
index a4a1a923..765c3108 100644
--- a/test/markupSpec.js
+++ b/test/markupSpec.js
@@ -7,7 +7,7 @@ describe("markups", function(){
element = null;
compile = function(html) {
element = jqLite(html);
- scope = angular.compile(element)().scope;
+ scope = angular.compile(element)();
};
});
diff --git a/test/service/invalidWidgetsSpec.js b/test/service/invalidWidgetsSpec.js
index 4a18dcf8..de9ed14b 100644
--- a/test/service/invalidWidgetsSpec.js
+++ b/test/service/invalidWidgetsSpec.js
@@ -14,7 +14,7 @@ describe('$invalidWidgets', function() {
it("should count number of invalid widgets", function(){
var element = jqLite('
')
jqLite(document.body).append(element);
- scope = compile(element)().scope;
+ scope = compile(element)();
var $invalidWidgets = scope.$service('$invalidWidgets');
expect($invalidWidgets.length).toEqual(1);
diff --git a/test/service/routeSpec.js b/test/service/routeSpec.js
index 4dfa546c..ccdf19ec 100644
--- a/test/service/routeSpec.js
+++ b/test/service/routeSpec.js
@@ -18,7 +18,7 @@ describe('$route', function() {
function BookChapter() {
this.log = '
';
}
- scope = compile('
')().scope;
+ scope = compile('
')();
$location = scope.$service('$location');
$route = scope.$service('$route');
$route.when('/Book/:book/Chapter/:chapter', {controller: BookChapter, template:'Chapter.html'});
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index 183fbe6a..dc7ffa77 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -11,7 +11,7 @@ describe("widget", function(){
} else {
element = jqLite(html);
}
- return scope = angular.compile(element)().scope;
+ return scope = angular.compile(element)();
};
});
@@ -592,7 +592,7 @@ describe("widget", function(){
});
it('should call change on switch', function(){
- var scope = angular.compile('{{name}}
')().scope;
+ var scope = angular.compile('{{name}}
')();
scope.url = 'a';
scope.$eval();
expect(scope.name).toEqual(undefined);
@@ -604,7 +604,7 @@ describe("widget", function(){
describe('ng:include', function(){
it('should include on external file', function() {
var element = jqLite(' ');
- var scope = angular.compile(element)().scope;
+ var scope = angular.compile(element)();
scope.childScope = createScope();
scope.childScope.name = 'misko';
scope.url = 'myUrl';
@@ -617,7 +617,7 @@ describe("widget", function(){
it('should remove previously included text if a falsy value is bound to src', function() {
var element = jqLite(' ');
- var scope = angular.compile(element)().scope;
+ var scope = angular.compile(element)();
scope.childScope = createScope();
scope.childScope.name = 'igor';
scope.url = 'myUrl';
@@ -636,7 +636,7 @@ describe("widget", function(){
it('should allow this for scope', function(){
var element = jqLite(' ');
- var scope = angular.compile(element)().scope;
+ var scope = angular.compile(element)();
scope.url = 'myUrl';
scope.$service('$xhr.cache').data.myUrl = {value:'{{c=c+1}}'};
scope.$eval();
@@ -650,7 +650,7 @@ describe("widget", function(){
it('should evaluate onload expression when a partial is loaded', function() {
var element = jqLite(' ');
- var scope = angular.compile(element)().scope;
+ var scope = angular.compile(element)();
expect(scope.loaded).not.toBeDefined();
@@ -801,7 +801,7 @@ describe("widget", function(){
var rootScope, rootScope, $route, $location, $browser;
beforeEach(function() {
- rootScope = angular.compile(' ')().scope;
+ rootScope = angular.compile(' ')();
$route = rootScope.$service('$route');
$location = rootScope.$service('$location');
$browser = rootScope.$service('$browser');
@@ -880,7 +880,7 @@ describe("widget", function(){
rootScope = angular.compile(
'' +
'include: ' +
- '
')(myApp).scope;
+ ' ')(myApp);
$browser.xhr.expectGET('viewPartial.html').respond('content');
$browser.xhr.flush();
--
cgit v1.2.3