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

Commit 42fa28f

Browse files
Foxandxsswesleycho
authored andcommitted
feat(position): remove deprecated code
BREAKING CHANGE: Remove deprecated non-prefixed service Closes #4721
1 parent 75e493a commit 42fa28f

File tree

2 files changed

+0
-72
lines changed

2 files changed

+0
-72
lines changed

src/position/position.js

-14
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,3 @@ angular.module('ui.bootstrap.position', [])
148148
}
149149
};
150150
}]);
151-
152-
/* Deprecated position below */
153-
154-
angular.module('ui.bootstrap.position')
155-
156-
.value('$positionSuppressWarning', false)
157-
158-
.service('$position', ['$log', '$positionSuppressWarning', '$uibPosition', function($log, $positionSuppressWarning, $uibPosition) {
159-
if (!$positionSuppressWarning) {
160-
$log.warn('$position is now deprecated. Use $uibPosition instead.');
161-
}
162-
163-
angular.extend(this, $uibPosition);
164-
}]);

src/position/test/position.spec.js

-58
Original file line numberDiff line numberDiff line change
@@ -104,61 +104,3 @@ describe('position elements', function () {
104104
});
105105
});
106106
});
107-
108-
/* Deprecation tests below */
109-
110-
describe('position deprecation', function() {
111-
var TargetElMock = function(width, height) {
112-
this.width = width;
113-
this.height = height;
114-
115-
this.prop = function(propName) {
116-
return propName === 'offsetWidth' ? width : height;
117-
};
118-
};
119-
beforeEach(module('ui.bootstrap.position'));
120-
121-
it('should suppress warning', function() {
122-
module(function($provide) {
123-
$provide.value('$positionSuppressWarning', true);
124-
});
125-
126-
inject(function($log, $position) {
127-
spyOn($log, 'warn');
128-
//mock position info normally queried from the DOM
129-
$position.position = function() {
130-
return {
131-
width: 20,
132-
height: 20,
133-
top: 100,
134-
left: 100
135-
};
136-
};
137-
138-
$position.positionElements({}, new TargetElMock(10, 10), 'other');
139-
140-
expect($log.warn.calls.count()).toBe(0);
141-
});
142-
});
143-
144-
it('should give warning by default', inject(function($log) {
145-
spyOn($log, 'warn');
146-
147-
inject(function($position) {
148-
//mock position info normally queried from the DOM
149-
$position.position = function() {
150-
return {
151-
width: 20,
152-
height: 20,
153-
top: 100,
154-
left: 100
155-
};
156-
};
157-
158-
$position.positionElements({}, new TargetElMock(10, 10), 'other');
159-
160-
expect($log.warn.calls.count()).toBe(1);
161-
expect($log.warn.calls.argsFor(0)).toEqual(['$position is now deprecated. Use $uibPosition instead.']);
162-
});
163-
}));
164-
});

0 commit comments

Comments
 (0)