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

Commit 606d419

Browse files
committed
feat(typeahead): remove deprecated code
BREAKING CHANGE: Remove deprecated services/directives Closes #4711
1 parent d844623 commit 606d419

File tree

5 files changed

+2
-650
lines changed

5 files changed

+2
-650
lines changed

src/typeahead/test/typeahead-highlight.spec.js

-29
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,3 @@ describe('typeaheadHighlight', function () {
4949
expect(logSpy).toHaveBeenCalled();
5050
});
5151
});
52-
53-
/* Deprecation tests below */
54-
55-
describe('typeahead highlightFilter deprecated', function(){
56-
var highlightFilter, $log, $sce, logSpy;
57-
58-
beforeEach(module('ui.bootstrap.typeahead'));
59-
60-
it('should supress the warning by default', function(){
61-
module(function($provide) {
62-
$provide.value('$typeaheadSuppressWarning', true);
63-
});
64-
65-
inject(function($compile, $log, $rootScope, typeaheadHighlightFilter, $sce){
66-
spyOn($log, 'warn');
67-
var highlightFilter = typeaheadHighlightFilter;
68-
$sce.getTrustedHtml(highlightFilter('before match after', 'match'));
69-
expect($log.warn.calls.count()).toBe(0);
70-
});
71-
});
72-
73-
it('should decrecate typeaheadHighlightFilter', inject(function($compile, $log, $rootScope, typeaheadHighlightFilter, $sce){
74-
spyOn($log, 'warn');
75-
var highlightFilter = typeaheadHighlightFilter;
76-
$sce.getTrustedHtml(highlightFilter('before match after', 'match'));
77-
expect($log.warn.calls.count()).toBe(1);
78-
expect($log.warn.calls.argsFor(0)).toEqual(['typeaheadHighlight is now deprecated. Use uibTypeaheadHighlight instead.']);
79-
}));
80-
});

src/typeahead/test/typeahead-parser.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ describe('syntax parser', function() {
22
var typeaheadParser, scope, filterFilter;
33

44
beforeEach(module('ui.bootstrap.typeahead'));
5-
beforeEach(inject(function(_$rootScope_, _filterFilter_, _typeaheadParser_) {
6-
typeaheadParser = _typeaheadParser_;
5+
beforeEach(inject(function(_$rootScope_, _filterFilter_, uibTypeaheadParser) {
6+
typeaheadParser = uibTypeaheadParser;
77
scope = _$rootScope_;
88
filterFilter = _filterFilter_;
99
}));

src/typeahead/test/typeahead-popup.spec.js

-44
Original file line numberDiff line numberDiff line change
@@ -55,47 +55,3 @@ describe('typeaheadPopup - result rendering', function() {
5555
expect($rootScope.select).toHaveBeenCalledWith(2);
5656
});
5757
});
58-
59-
/* Deprecation tests below */
60-
61-
describe('typeaheadPopup deprecation', function() {
62-
beforeEach(module('ui.bootstrap.typeahead'));
63-
beforeEach(module('ngSanitize'));
64-
beforeEach(module('template/typeahead/typeahead-popup.html'));
65-
beforeEach(module('template/typeahead/typeahead-match.html'));
66-
67-
it('should suppress warning', function() {
68-
module(function($provide) {
69-
$provide.value('$typeaheadSuppressWarning', true);
70-
});
71-
72-
inject(function($compile, $log, $rootScope) {
73-
var scope = $rootScope.$new();
74-
scope.matches = ['foo', 'bar', 'baz'];
75-
scope.active = 1;
76-
$rootScope.select = angular.noop;
77-
spyOn($log, 'warn');
78-
79-
var element = '<div><typeahead-popup matches="matches" active="active" select="select(activeIdx)"></typeahead-popup></div>';
80-
element = $compile(element)(scope);
81-
$rootScope.$digest();
82-
expect($log.warn.calls.count()).toBe(0);
83-
});
84-
});
85-
86-
it('should give warning by default', inject(function($compile, $log, $rootScope) {
87-
var scope = $rootScope.$new();
88-
scope.matches = ['foo', 'bar', 'baz'];
89-
scope.active = 1;
90-
$rootScope.select = angular.noop;
91-
spyOn($log, 'warn');
92-
93-
var element = '<div><typeahead-popup matches="matches" active="active" select="select(activeIdx)"></typeahead-popup></div>';
94-
element = $compile(element)(scope);
95-
96-
$rootScope.$digest();
97-
98-
expect($log.warn.calls.count()).toBe(1);
99-
expect($log.warn.calls.argsFor(0)).toEqual(['typeahead-popup is now deprecated. Use uib-typeahead-popup instead.']);
100-
}));
101-
});

src/typeahead/test/typeahead.spec.js

-48
Original file line numberDiff line numberDiff line change
@@ -1047,51 +1047,3 @@ describe('typeahead tests', function() {
10471047
});
10481048
});
10491049
});
1050-
1051-
/* Deprecation tests below */
1052-
1053-
describe('typeahead deprecation', function() {
1054-
beforeEach(module('ui.bootstrap.typeahead'));
1055-
beforeEach(module('ngSanitize'));
1056-
beforeEach(module('template/typeahead/typeahead-popup.html'));
1057-
beforeEach(module('template/typeahead/typeahead-match.html'));
1058-
1059-
it('should suppress warning', function() {
1060-
module(function($provide) {
1061-
$provide.value('$typeaheadSuppressWarning', true);
1062-
});
1063-
1064-
inject(function($compile, $log, $rootScope) {
1065-
spyOn($log, 'warn');
1066-
1067-
var element = '<div><input ng-model="result" typeahead="item for item in source | filter:$viewValue" typeahead-min-length="0"></div>';
1068-
element = $compile(element)($rootScope);
1069-
$rootScope.$digest();
1070-
expect($log.warn.calls.count()).toBe(0);
1071-
});
1072-
});
1073-
1074-
it('should give warning by default', inject(function($compile, $log, $rootScope) {
1075-
spyOn($log, 'warn');
1076-
1077-
var element = '<div><input ng-model="result" typeahead="item for item in source | filter:$viewValue" typeahead-min-length="0"></div>';
1078-
element = $compile(element)($rootScope);
1079-
$rootScope.$digest();
1080-
1081-
expect($log.warn.calls.count()).toBe(3);
1082-
expect($log.warn.calls.argsFor(0)).toEqual(['typeaheadParser is now deprecated. Use uibTypeaheadParser instead.']);
1083-
expect($log.warn.calls.argsFor(1)).toEqual(['typeahead is now deprecated. Use uib-typeahead instead.']);
1084-
expect($log.warn.calls.argsFor(2)).toEqual(['typeahead-popup is now deprecated. Use uib-typeahead-popup instead.']);
1085-
}));
1086-
1087-
it('should deprecate typeaheadMatch', inject(function($compile, $log, $rootScope, $templateCache, $sniffer){
1088-
spyOn($log, 'warn');
1089-
1090-
var element = '<div typeahead-match index=\"$index\" match=\"match\" query=\"query\" template-url=\"templateUrl\"></div>';
1091-
element = $compile(element)($rootScope);
1092-
$rootScope.$digest();
1093-
1094-
expect($log.warn.calls.count()).toBe(1);
1095-
expect($log.warn.calls.argsFor(0)).toEqual(['typeahead-match is now deprecated. Use uib-typeahead-match instead.']);
1096-
}));
1097-
});

0 commit comments

Comments
 (0)