mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-05 21:54:42 +00:00
test(ngApp): add missing test for [ng-app] bootstrap
This commit is contained in:
parent
bb9badeb2a
commit
4f0be2ae4e
1 changed files with 14 additions and 3 deletions
|
|
@ -331,6 +331,12 @@ describe('angular', function() {
|
||||||
return element.getElementById[id] || [];
|
return element.getElementById[id] || [];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
querySelectorAll: function(arg) {
|
||||||
|
return element.querySelectorAll[arg] || [];
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
getAttribute: function(name) {
|
getAttribute: function(name) {
|
||||||
return element[name];
|
return element[name];
|
||||||
}
|
}
|
||||||
|
|
@ -345,6 +351,14 @@ describe('angular', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should look for ngApp directive as attr', function() {
|
||||||
|
var appElement = jqLite('<div ng-app="ABC"></div>')[0];
|
||||||
|
element.querySelectorAll['[ng-app]'] = [appElement];
|
||||||
|
angularInit(element, bootstrap);
|
||||||
|
expect(bootstrap).toHaveBeenCalledOnceWith(appElement, ['ABC']);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should look for ngApp directive in id', function() {
|
it('should look for ngApp directive in id', function() {
|
||||||
var appElement = jqLite('<div id="ng-app" data-ng-app="ABC"></div>')[0];
|
var appElement = jqLite('<div id="ng-app" data-ng-app="ABC"></div>')[0];
|
||||||
jqLite(document.body).append(appElement);
|
jqLite(document.body).append(appElement);
|
||||||
|
|
@ -355,7 +369,6 @@ describe('angular', function() {
|
||||||
|
|
||||||
it('should look for ngApp directive in className', function() {
|
it('should look for ngApp directive in className', function() {
|
||||||
var appElement = jqLite('<div data-ng-app="ABC"></div>')[0];
|
var appElement = jqLite('<div data-ng-app="ABC"></div>')[0];
|
||||||
element.querySelectorAll = function(arg) { return element.querySelectorAll[arg] || []; }
|
|
||||||
element.querySelectorAll['.ng\\:app'] = [appElement];
|
element.querySelectorAll['.ng\\:app'] = [appElement];
|
||||||
angularInit(element, bootstrap);
|
angularInit(element, bootstrap);
|
||||||
expect(bootstrap).toHaveBeenCalledOnceWith(appElement, ['ABC']);
|
expect(bootstrap).toHaveBeenCalledOnceWith(appElement, ['ABC']);
|
||||||
|
|
@ -364,7 +377,6 @@ describe('angular', function() {
|
||||||
|
|
||||||
it('should look for ngApp directive using querySelectorAll', function() {
|
it('should look for ngApp directive using querySelectorAll', function() {
|
||||||
var appElement = jqLite('<div x-ng-app="ABC"></div>')[0];
|
var appElement = jqLite('<div x-ng-app="ABC"></div>')[0];
|
||||||
element.querySelectorAll = function(arg) { return element.querySelectorAll[arg] || []; }
|
|
||||||
element.querySelectorAll['[ng\\:app]'] = [ appElement ];
|
element.querySelectorAll['[ng\\:app]'] = [ appElement ];
|
||||||
angularInit(element, bootstrap);
|
angularInit(element, bootstrap);
|
||||||
expect(bootstrap).toHaveBeenCalledOnceWith(appElement, ['ABC']);
|
expect(bootstrap).toHaveBeenCalledOnceWith(appElement, ['ABC']);
|
||||||
|
|
@ -380,7 +392,6 @@ describe('angular', function() {
|
||||||
|
|
||||||
it('should bootstrap anonymously', function() {
|
it('should bootstrap anonymously', function() {
|
||||||
var appElement = jqLite('<div x-ng-app></div>')[0];
|
var appElement = jqLite('<div x-ng-app></div>')[0];
|
||||||
element.querySelectorAll = function(arg) { return element.querySelectorAll[arg] || []; }
|
|
||||||
element.querySelectorAll['[x-ng-app]'] = [ appElement ];
|
element.querySelectorAll['[x-ng-app]'] = [ appElement ];
|
||||||
angularInit(element, bootstrap);
|
angularInit(element, bootstrap);
|
||||||
expect(bootstrap).toHaveBeenCalledOnceWith(appElement, []);
|
expect(bootstrap).toHaveBeenCalledOnceWith(appElement, []);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue