mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-06 22:35:22 +08:00
doc($filter): added $filter documentation
This commit is contained in:
@@ -41,8 +41,8 @@ describe("directive", function() {
|
||||
expect(lowercase(element.html())).toEqual('<div onclick="">hello</div>');
|
||||
}));
|
||||
|
||||
it('should set element element', inject(function($rootScope, $compile, $provide) {
|
||||
$provide.filter('myElement', valueFn(function() {
|
||||
it('should set element element', inject(function($rootScope, $compile, $filterProvider) {
|
||||
$filterProvider.register('myElement', valueFn(function() {
|
||||
return jqLite('<a>hello</a>');
|
||||
}));
|
||||
var element = $compile('<div ng:bind="0|myElement"></div>')($rootScope);
|
||||
@@ -73,9 +73,9 @@ describe("directive", function() {
|
||||
expect(element.text()).toEqual('Hello Misko!');
|
||||
}));
|
||||
|
||||
it('should have $element set to current bind element', inject(function($rootScope, $compile, $provide) {
|
||||
it('should have $element set to current bind element', inject(function($rootScope, $compile, $filterProvider) {
|
||||
var innerText;
|
||||
$provide.filter('myFilter', valueFn(function(text) {
|
||||
$filterProvider.register('myFilter', valueFn(function(text) {
|
||||
innerText = innerText || this.$element.text();
|
||||
return text;
|
||||
}));
|
||||
|
||||
@@ -8,9 +8,9 @@ describe('filters', function() {
|
||||
filter = $filter;
|
||||
}));
|
||||
|
||||
it('should called the filter when evaluating expression', inject(function($rootScope, $provide) {
|
||||
it('should called the filter when evaluating expression', inject(function($rootScope, $filterProvider) {
|
||||
var filter = jasmine.createSpy('myFilter');
|
||||
$provide.filter('myFilter', valueFn(filter));
|
||||
$filterProvider.register('myFilter', valueFn(filter));
|
||||
|
||||
$rootScope.$eval('10|myFilter');
|
||||
expect(filter).toHaveBeenCalledWith(10);
|
||||
|
||||
@@ -191,8 +191,8 @@ describe('parser', function() {
|
||||
expect(scope.$eval("'a' + 'b c'")).toEqual("ab c");
|
||||
});
|
||||
|
||||
it('should parse filters', inject(function($provide) {
|
||||
$provide.filter('substring', valueFn(function(input, start, end) {
|
||||
it('should parse filters', inject(function($filterProvider) {
|
||||
$filterProvider.register('substring', valueFn(function(input, start, end) {
|
||||
return input.substring(start, end);
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user