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

Commit

Permalink
feat(position): remove deprecated code
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove deprecated non-prefixed service

Closes #4721
  • Loading branch information
Foxandxss authored and wesleycho committed Oct 23, 2015
1 parent 75e493a commit 42fa28f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 72 deletions.
14 changes: 0 additions & 14 deletions src/position/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,3 @@ angular.module('ui.bootstrap.position', [])
}
};
}]);

/* Deprecated position below */

angular.module('ui.bootstrap.position')

.value('$positionSuppressWarning', false)

.service('$position', ['$log', '$positionSuppressWarning', '$uibPosition', function($log, $positionSuppressWarning, $uibPosition) {
if (!$positionSuppressWarning) {
$log.warn('$position is now deprecated. Use $uibPosition instead.');
}

angular.extend(this, $uibPosition);
}]);
58 changes: 0 additions & 58 deletions src/position/test/position.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,61 +104,3 @@ describe('position elements', function () {
});
});
});

/* Deprecation tests below */

describe('position deprecation', function() {
var TargetElMock = function(width, height) {
this.width = width;
this.height = height;

this.prop = function(propName) {
return propName === 'offsetWidth' ? width : height;
};
};
beforeEach(module('ui.bootstrap.position'));

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

inject(function($log, $position) {
spyOn($log, 'warn');
//mock position info normally queried from the DOM
$position.position = function() {
return {
width: 20,
height: 20,
top: 100,
left: 100
};
};

$position.positionElements({}, new TargetElMock(10, 10), 'other');

expect($log.warn.calls.count()).toBe(0);
});
});

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

inject(function($position) {
//mock position info normally queried from the DOM
$position.position = function() {
return {
width: 20,
height: 20,
top: 100,
left: 100
};
};

$position.positionElements({}, new TargetElMock(10, 10), 'other');

expect($log.warn.calls.count()).toBe(1);
expect($log.warn.calls.argsFor(0)).toEqual(['$position is now deprecated. Use $uibPosition instead.']);
});
}));
});

0 comments on commit 42fa28f

Please sign in to comment.