mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
chore(tests): rename all directive names to the normalized form
This commit is contained in:
@@ -345,7 +345,7 @@ describe('angular', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should look for ng-app 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];
|
||||
jqLite(document.body).append(appElement);
|
||||
angularInit(element, bootstrap);
|
||||
@@ -353,7 +353,7 @@ describe('angular', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should look for ng-app directive in className', function() {
|
||||
it('should look for ngApp directive in className', function() {
|
||||
var appElement = jqLite('<div data-ng-app="ABC"></div>')[0];
|
||||
element.querySelectorAll = function(arg) { return element.querySelectorAll[arg] || []; }
|
||||
element.querySelectorAll['.ng\\:app'] = [appElement];
|
||||
@@ -362,7 +362,7 @@ describe('angular', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should look for ng-app directive using querySelectorAll', function() {
|
||||
it('should look for ngApp directive using querySelectorAll', function() {
|
||||
var appElement = jqLite('<div x-ng-app="ABC"></div>')[0];
|
||||
element.querySelectorAll = function(arg) { return element.querySelectorAll[arg] || []; }
|
||||
element.querySelectorAll['[ng\\:app]'] = [ appElement ];
|
||||
|
||||
@@ -470,7 +470,7 @@ describe('$compile', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should merge interpolated css class with ng-repeat',
|
||||
it('should merge interpolated css class with ngRepeat',
|
||||
inject(function($compile, $rootScope) {
|
||||
element = $compile(
|
||||
'<div>' +
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('boolean attr directives', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-src', function() {
|
||||
describe('ngSrc', function() {
|
||||
|
||||
it('should interpolate the expression and bind to src', inject(function($compile, $rootScope) {
|
||||
var element = $compile('<div ng-src="some/{{id}}"></div>')($rootScope)
|
||||
@@ -94,7 +94,7 @@ describe('ng-src', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-href', function() {
|
||||
describe('ngHref', function() {
|
||||
var element;
|
||||
|
||||
afterEach(function() {
|
||||
|
||||
@@ -53,7 +53,7 @@ describe('form', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should use ng-form as form name', function() {
|
||||
it('should use ngForm value as form name', function() {
|
||||
doc = $compile(
|
||||
'<div ng-form="myForm">' +
|
||||
'<input type="text" name="alias" ng-model="value"/>' +
|
||||
|
||||
@@ -233,7 +233,7 @@ describe('NgModelController', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('ng-model', function() {
|
||||
describe('ngModel', function() {
|
||||
|
||||
it('should set css classes (ng-valid, ng-invalid, ng-pristine, ng-dirty)',
|
||||
inject(function($compile, $rootScope, $sniffer) {
|
||||
@@ -376,7 +376,7 @@ describe('input', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should ignore input without ng-model attr', function() {
|
||||
it('should ignore input without ngModel directive', function() {
|
||||
compileInput('<input type="text" name="whatever" required />');
|
||||
|
||||
changeInputValueTo('');
|
||||
@@ -750,7 +750,7 @@ describe('input', function() {
|
||||
|
||||
describe('checkbox', function() {
|
||||
|
||||
it('should ignore checkbox without ng-model attr', function() {
|
||||
it('should ignore checkbox without ngModel directive', function() {
|
||||
compileInput('<input type="checkbox" name="whatever" required />');
|
||||
|
||||
changeInputValueTo('');
|
||||
@@ -847,7 +847,7 @@ describe('input', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should ignore textarea without ng-model attr', function() {
|
||||
it('should ignore textarea without ngModel directive', function() {
|
||||
compileInput('<textarea name="whatever" required></textarea>');
|
||||
inputElm = formElm.find('textarea');
|
||||
|
||||
@@ -860,7 +860,7 @@ describe('input', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-list', function() {
|
||||
describe('ngList', function() {
|
||||
|
||||
it('should parse text into an array', function() {
|
||||
compileInput('<input type="text" ng-model="list" ng-list />');
|
||||
@@ -941,7 +941,7 @@ describe('input', function() {
|
||||
|
||||
describe('required', function() {
|
||||
|
||||
it('should allow bindings on ng-required', function() {
|
||||
it('should allow bindings via ngRequired', function() {
|
||||
compileInput('<input type="text" ng-model="value" ng-required="required" />');
|
||||
|
||||
scope.$apply(function() {
|
||||
@@ -1015,7 +1015,7 @@ describe('input', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-change', function() {
|
||||
describe('ngChange', function() {
|
||||
|
||||
it('should $eval expression after new value is set in the model', function() {
|
||||
compileInput('<input type="text" ng-model="value" ng-change="change()" />');
|
||||
@@ -1040,7 +1040,7 @@ describe('input', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should $eval ng-change expression on checkbox', function() {
|
||||
it('should $eval ngChange expression on checkbox', function() {
|
||||
compileInput('<input type="checkbox" ng-model="foo" ng-change="changeFn()">');
|
||||
|
||||
scope.changeFn = jasmine.createSpy('changeFn');
|
||||
@@ -1053,7 +1053,7 @@ describe('input', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-value', function() {
|
||||
describe('ngValue', function() {
|
||||
|
||||
it('should evaluate and set constant expressions', function() {
|
||||
compileInput('<input type="radio" ng-model="selected" ng-value="true">' +
|
||||
@@ -1090,7 +1090,7 @@ describe('input', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should work inside ng-repeat', function() {
|
||||
it('should work inside ngRepeat', function() {
|
||||
compileInput(
|
||||
'<input type="radio" ng-repeat="i in items" ng-model="$parent.selected" ng-value="i.id">');
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-bind-*', function() {
|
||||
describe('ngBind*', function() {
|
||||
var element;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('ng-bind-*', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-bind', function() {
|
||||
describe('ngBind', function() {
|
||||
|
||||
it('should set text', inject(function($rootScope, $compile) {
|
||||
element = $compile('<div ng-bind="a"></div>')($rootScope);
|
||||
@@ -55,9 +55,9 @@ describe('ng-bind-*', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-bind-template', function() {
|
||||
describe('ngBindTemplate', function() {
|
||||
|
||||
it('should ng-bind-template', inject(function($rootScope, $compile) {
|
||||
it('should ngBindTemplate', inject(function($rootScope, $compile) {
|
||||
element = $compile('<div ng-bind-template="Hello {{name}}!"></div>')($rootScope);
|
||||
$rootScope.name = 'Misko';
|
||||
$rootScope.$digest();
|
||||
@@ -74,7 +74,7 @@ describe('ng-bind-*', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-bind-html', function() {
|
||||
describe('ngBindHtml', function() {
|
||||
|
||||
it('should set html', inject(function($rootScope, $compile) {
|
||||
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
|
||||
@@ -100,7 +100,7 @@ describe('ng-bind-*', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-bind-html-unsafe', function() {
|
||||
describe('ngBindHtmlUnsafe', function() {
|
||||
|
||||
it('should set unsafe html', inject(function($rootScope, $compile) {
|
||||
element = $compile('<div ng-bind-html-unsafe="html"></div>')($rootScope);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-class', function() {
|
||||
describe('ngClass', function() {
|
||||
var element;
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ describe('ng-class', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should ng-class odd/even', inject(function($rootScope, $compile) {
|
||||
it('should ngClass odd/even', inject(function($rootScope, $compile) {
|
||||
element = $compile('<ul><li ng-repeat="i in [0,1]" class="existing" ng-class-odd="\'odd\'" ng-class-even="\'even\'"></li><ul>')($rootScope);
|
||||
$rootScope.$digest();
|
||||
var e1 = jqLite(element[0].childNodes[1]);
|
||||
@@ -160,7 +160,7 @@ describe('ng-class', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should allow both ng-class and ng-class-odd/even on the same element', inject(function($rootScope, $compile) {
|
||||
it('should allow both ngClass and ngClassOdd/Even on the same element', inject(function($rootScope, $compile) {
|
||||
element = $compile('<ul>' +
|
||||
'<li ng-repeat="i in [0,1]" ng-class="\'plainClass\'" ' +
|
||||
'ng-class-odd="\'odd\'" ng-class-even="\'even\'"></li>' +
|
||||
@@ -178,7 +178,7 @@ describe('ng-class', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should allow both ng-class and ng-class-odd/even with multiple classes', inject(function($rootScope, $compile) {
|
||||
it('should allow both ngClass and ngClassOdd/Even with multiple classes', inject(function($rootScope, $compile) {
|
||||
element = $compile('<ul>' +
|
||||
'<li ng-repeat="i in [0,1]" ng-class="[\'A\', \'B\']" ' +
|
||||
'ng-class-odd="[\'C\', \'D\']" ng-class-even="[\'E\', \'F\']"></li>' +
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-click', function() {
|
||||
describe('ngClick', function() {
|
||||
var element;
|
||||
|
||||
afterEach(function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-cloak', function() {
|
||||
describe('ngCloak', function() {
|
||||
var element;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('ng-cloak', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should remove ng-cloak class from a compiled element with attribute', inject(
|
||||
it('should remove ngCloak class from a compiled element with attribute', inject(
|
||||
function($rootScope, $compile) {
|
||||
element = jqLite('<div ng-cloak class="foo ng-cloak bar"></div>');
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('ng-cloak', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should remove ng-cloak class from a compiled element', inject(function($rootScope, $compile) {
|
||||
it('should remove ngCloak class from a compiled element', inject(function($rootScope, $compile) {
|
||||
element = jqLite('<div class="foo ng-cloak bar"></div>');
|
||||
|
||||
expect(element.hasClass('foo')).toBe(true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-controller', function() {
|
||||
describe('ngController', function() {
|
||||
var element;
|
||||
|
||||
beforeEach(inject(function($window) {
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('event directives', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-submit', function() {
|
||||
describe('ngSubmit', function() {
|
||||
|
||||
it('should get called on form submit', inject(function($rootScope, $compile) {
|
||||
element = $compile('<form action="" ng-submit="submitted = true">' +
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-include', function() {
|
||||
describe('ngInclude', function() {
|
||||
var element;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-init', function() {
|
||||
describe('ngInit', function() {
|
||||
var element;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('ng-init', function() {
|
||||
});
|
||||
|
||||
|
||||
it("should ng-init", inject(function($rootScope, $compile) {
|
||||
it("should init model", inject(function($rootScope, $compile) {
|
||||
element = $compile('<div ng-init="a=123"></div>')($rootScope);
|
||||
expect($rootScope.a).toEqual(123);
|
||||
}));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
describe('ng-non-bindable', function() {
|
||||
describe('ngNonBindable', function() {
|
||||
var element;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-pluralize', function() {
|
||||
describe('ngPluralize', function() {
|
||||
var element;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-repeat', function() {
|
||||
describe('ngRepeat', function() {
|
||||
var element;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('ng-repeat', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should ng-repeat over array', inject(function($rootScope, $compile) {
|
||||
it('should ngRepeat over array', inject(function($rootScope, $compile) {
|
||||
element = $compile(
|
||||
'<ul>' +
|
||||
'<li ng-repeat="item in items" ng-init="suffix = \';\'" ng-bind="item + suffix"></li>' +
|
||||
@@ -37,7 +37,7 @@ describe('ng-repeat', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should ng-repeat over object', inject(function($rootScope, $compile) {
|
||||
it('should ngRepeat over object', inject(function($rootScope, $compile) {
|
||||
element = $compile(
|
||||
'<ul>' +
|
||||
'<li ng-repeat="(key, value) in items" ng-bind="key + \':\' + value + \';\' "></li>' +
|
||||
@@ -48,7 +48,7 @@ describe('ng-repeat', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should not ng-repeat over parent properties', inject(function($rootScope, $compile) {
|
||||
it('should not ngRepeat over parent properties', inject(function($rootScope, $compile) {
|
||||
var Class = function() {};
|
||||
Class.prototype.abc = function() {};
|
||||
Class.prototype.value = 'abc';
|
||||
@@ -64,14 +64,14 @@ describe('ng-repeat', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should error on wrong parsing of ng-repeat', inject(function($rootScope, $compile) {
|
||||
it('should error on wrong parsing of ngRepeat', inject(function($rootScope, $compile) {
|
||||
expect(function() {
|
||||
element = $compile('<ul><li ng-repeat="i dont parse"></li></ul>')($rootScope);
|
||||
}).toThrow("Expected ngRepeat in form of '_item_ in _collection_' but got 'i dont parse'.");
|
||||
}));
|
||||
|
||||
|
||||
it("should throw error when left-hand-side of ng-repeat can't be parsed", inject(
|
||||
it("should throw error when left-hand-side of ngRepeat can't be parsed", inject(
|
||||
function($rootScope, $compile) {
|
||||
expect(function() {
|
||||
element = $compile('<ul><li ng-repeat="i dont parse in foo"></li></ul>')($rootScope);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-show / ng-hide', function() {
|
||||
describe('ngShow / ngHide', function() {
|
||||
var element;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('ng-show / ng-hide', function() {
|
||||
dealoc(element);
|
||||
});
|
||||
|
||||
describe('ng-show', function() {
|
||||
describe('ngShow', function() {
|
||||
it('should show and hide an element', inject(function($rootScope, $compile) {
|
||||
element = jqLite('<div ng-show="exp"></div>');
|
||||
element = $compile(element)($rootScope);
|
||||
@@ -30,7 +30,7 @@ describe('ng-show / ng-hide', function() {
|
||||
}));
|
||||
});
|
||||
|
||||
describe('ng-hide', function() {
|
||||
describe('ngHide', function() {
|
||||
it('should hide an element', inject(function($rootScope, $compile) {
|
||||
element = jqLite('<div ng-hide="exp"></div>');
|
||||
element = $compile(element)($rootScope);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-style', function() {
|
||||
describe('ngStyle', function() {
|
||||
var element;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-switch', function() {
|
||||
describe('ngSwitch', function() {
|
||||
var element;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe('ng-view', function() {
|
||||
describe('ngView', function() {
|
||||
var element;
|
||||
|
||||
beforeEach(module(function() {
|
||||
@@ -137,7 +137,7 @@ describe('ng-view', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should be possible to nest ng-view in ng-include', function() {
|
||||
it('should be possible to nest ngView in ngInclude', function() {
|
||||
|
||||
module(function($routeProvider) {
|
||||
$routeProvider.when('/foo', {template: 'viewPartial.html'});
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('select', function() {
|
||||
|
||||
describe('select-one', function() {
|
||||
|
||||
it('should compile children of a select without a ng-model, but not create a model for it',
|
||||
it('should compile children of a select without a ngModel, but not create a model for it',
|
||||
function() {
|
||||
compile('<select>' +
|
||||
'<option selected="true">{{a}}</option>' +
|
||||
@@ -144,7 +144,7 @@ describe('select', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-options', function() {
|
||||
describe('ngOptions', function() {
|
||||
function createSelect(attrs, blank, unknown) {
|
||||
var html = '<select';
|
||||
forEach(attrs, function(value, key) {
|
||||
@@ -600,7 +600,7 @@ describe('select', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should support binding via ng-bind-template attribute', function () {
|
||||
it('should support binding via ngBindTemplate directive', function () {
|
||||
var option;
|
||||
createSingleSelect('<option value="" ng-bind-template="blank is {{blankVal}}"></option>');
|
||||
|
||||
@@ -617,7 +617,7 @@ describe('select', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should support biding via ng-bind attribute', function () {
|
||||
it('should support biding via ngBind attribute', function () {
|
||||
var option;
|
||||
createSingleSelect('<option value="" ng-bind="blankVal"></option>');
|
||||
|
||||
@@ -774,9 +774,9 @@ describe('select', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('ng-required', function() {
|
||||
describe('ngRequired', function() {
|
||||
|
||||
it('should allow bindings on ng-required', function() {
|
||||
it('should allow bindings on ngRequired', function() {
|
||||
createSelect({
|
||||
'ng-model': 'value',
|
||||
'ng-options': 'item.name for item in values',
|
||||
|
||||
@@ -784,7 +784,7 @@ describe('$location', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should not rewrite ng-ext-link', function() {
|
||||
it('should not rewrite ngExtLink', function() {
|
||||
configureService('#new', true, true, 'ng-ext-link');
|
||||
inject(
|
||||
initBrowser(),
|
||||
|
||||
Reference in New Issue
Block a user