Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
feat(typeahead): remove deprecated code
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove deprecated services/directives

Closes #4711
  • Loading branch information
wesleycho committed Oct 23, 2015
1 parent d844623 commit 606d419
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 650 deletions.
29 changes: 0 additions & 29 deletions src/typeahead/test/typeahead-highlight.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,3 @@ describe('typeaheadHighlight', function () {
expect(logSpy).toHaveBeenCalled();
});
});

/* Deprecation tests below */

describe('typeahead highlightFilter deprecated', function(){
var highlightFilter, $log, $sce, logSpy;

beforeEach(module('ui.bootstrap.typeahead'));

it('should supress the warning by default', function(){
module(function($provide) {
$provide.value('$typeaheadSuppressWarning', true);
});

inject(function($compile, $log, $rootScope, typeaheadHighlightFilter, $sce){
spyOn($log, 'warn');
var highlightFilter = typeaheadHighlightFilter;
$sce.getTrustedHtml(highlightFilter('before match after', 'match'));
expect($log.warn.calls.count()).toBe(0);
});
});

it('should decrecate typeaheadHighlightFilter', inject(function($compile, $log, $rootScope, typeaheadHighlightFilter, $sce){
spyOn($log, 'warn');
var highlightFilter = typeaheadHighlightFilter;
$sce.getTrustedHtml(highlightFilter('before match after', 'match'));
expect($log.warn.calls.count()).toBe(1);
expect($log.warn.calls.argsFor(0)).toEqual(['typeaheadHighlight is now deprecated. Use uibTypeaheadHighlight instead.']);
}));
});
4 changes: 2 additions & 2 deletions src/typeahead/test/typeahead-parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ describe('syntax parser', function() {
var typeaheadParser, scope, filterFilter;

beforeEach(module('ui.bootstrap.typeahead'));
beforeEach(inject(function(_$rootScope_, _filterFilter_, _typeaheadParser_) {
typeaheadParser = _typeaheadParser_;
beforeEach(inject(function(_$rootScope_, _filterFilter_, uibTypeaheadParser) {
typeaheadParser = uibTypeaheadParser;
scope = _$rootScope_;
filterFilter = _filterFilter_;
}));
Expand Down
44 changes: 0 additions & 44 deletions src/typeahead/test/typeahead-popup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,47 +55,3 @@ describe('typeaheadPopup - result rendering', function() {
expect($rootScope.select).toHaveBeenCalledWith(2);
});
});

/* Deprecation tests below */

describe('typeaheadPopup deprecation', function() {
beforeEach(module('ui.bootstrap.typeahead'));
beforeEach(module('ngSanitize'));
beforeEach(module('template/typeahead/typeahead-popup.html'));
beforeEach(module('template/typeahead/typeahead-match.html'));

it('should suppress warning', function() {
module(function($provide) {
$provide.value('$typeaheadSuppressWarning', true);
});

inject(function($compile, $log, $rootScope) {
var scope = $rootScope.$new();
scope.matches = ['foo', 'bar', 'baz'];
scope.active = 1;
$rootScope.select = angular.noop;
spyOn($log, 'warn');

var element = '<div><typeahead-popup matches="matches" active="active" select="select(activeIdx)"></typeahead-popup></div>';
element = $compile(element)(scope);
$rootScope.$digest();
expect($log.warn.calls.count()).toBe(0);
});
});

it('should give warning by default', inject(function($compile, $log, $rootScope) {
var scope = $rootScope.$new();
scope.matches = ['foo', 'bar', 'baz'];
scope.active = 1;
$rootScope.select = angular.noop;
spyOn($log, 'warn');

var element = '<div><typeahead-popup matches="matches" active="active" select="select(activeIdx)"></typeahead-popup></div>';
element = $compile(element)(scope);

$rootScope.$digest();

expect($log.warn.calls.count()).toBe(1);
expect($log.warn.calls.argsFor(0)).toEqual(['typeahead-popup is now deprecated. Use uib-typeahead-popup instead.']);
}));
});
48 changes: 0 additions & 48 deletions src/typeahead/test/typeahead.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,51 +1047,3 @@ describe('typeahead tests', function() {
});
});
});

/* Deprecation tests below */

describe('typeahead deprecation', function() {
beforeEach(module('ui.bootstrap.typeahead'));
beforeEach(module('ngSanitize'));
beforeEach(module('template/typeahead/typeahead-popup.html'));
beforeEach(module('template/typeahead/typeahead-match.html'));

it('should suppress warning', function() {
module(function($provide) {
$provide.value('$typeaheadSuppressWarning', true);
});

inject(function($compile, $log, $rootScope) {
spyOn($log, 'warn');

var element = '<div><input ng-model="result" typeahead="item for item in source | filter:$viewValue" typeahead-min-length="0"></div>';
element = $compile(element)($rootScope);
$rootScope.$digest();
expect($log.warn.calls.count()).toBe(0);
});
});

it('should give warning by default', inject(function($compile, $log, $rootScope) {
spyOn($log, 'warn');

var element = '<div><input ng-model="result" typeahead="item for item in source | filter:$viewValue" typeahead-min-length="0"></div>';
element = $compile(element)($rootScope);
$rootScope.$digest();

expect($log.warn.calls.count()).toBe(3);
expect($log.warn.calls.argsFor(0)).toEqual(['typeaheadParser is now deprecated. Use uibTypeaheadParser instead.']);
expect($log.warn.calls.argsFor(1)).toEqual(['typeahead is now deprecated. Use uib-typeahead instead.']);
expect($log.warn.calls.argsFor(2)).toEqual(['typeahead-popup is now deprecated. Use uib-typeahead-popup instead.']);
}));

it('should deprecate typeaheadMatch', inject(function($compile, $log, $rootScope, $templateCache, $sniffer){
spyOn($log, 'warn');

var element = '<div typeahead-match index=\"$index\" match=\"match\" query=\"query\" template-url=\"templateUrl\"></div>';
element = $compile(element)($rootScope);
$rootScope.$digest();

expect($log.warn.calls.count()).toBe(1);
expect($log.warn.calls.argsFor(0)).toEqual(['typeahead-match is now deprecated. Use uib-typeahead-match instead.']);
}));
});
Loading

0 comments on commit 606d419

Please sign in to comment.