Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

Commit

Permalink
fix(draggable): Remove the z-index from events once they aren't being…
Browse files Browse the repository at this point in the history
… dragged
  • Loading branch information
Matt Lewis committed Nov 30, 2015
1 parent af7e26b commit 26087c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/directives/mwlDraggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ angular

$timeout(function() {
translateElement(elm, '')
.css('z-index', 'auto')
.removeAttr('data-x')
.removeAttr('data-y')
.removeClass('dragging-active');
Expand Down
6 changes: 5 additions & 1 deletion test/unit/directives/mwlDraggable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('mwlDraggable directive', function() {
elementTarget,
$window,
$compile,
$timeout,
template =
'<div ' +
'mwl-draggable="draggable" ' +
Expand Down Expand Up @@ -40,10 +41,11 @@ describe('mwlDraggable directive', function() {
$provide.constant('interact', interact);
}));

beforeEach(angular.mock.inject(function(_$compile_, _$rootScope_, _$window_) {
beforeEach(angular.mock.inject(function(_$compile_, _$rootScope_, _$window_, _$timeout_) {
$window = _$window_;
$compile = _$compile_;
$rootScope = _$rootScope_;
$timeout = _$timeout_;
scope = $rootScope.$new();
prepareScope(scope);

Expand Down Expand Up @@ -104,11 +106,13 @@ describe('mwlDraggable directive', function() {
draggableOptions.onstart(event);
draggableOptions.onmove(event);
draggableOptions.onend(event);
$timeout.flush();
expect(angular.element(event.target).hasClass('dragging-active')).to.be.false;
expect(angular.element(event.target).css('pointerEvents')).to.equal('auto');
expect(angular.element(event.target).css('transform')).to.equal('');
expect(angular.element(event.target).css('-webkit-transform')).to.equal('');
expect(angular.element(event.target).css('-ms-transform')).to.equal('');
expect(angular.element(event.target).css('z-index')).to.equal('auto');
expect(scope.onDragEnd).to.have.been.calledWith(0, 6);
});

Expand Down
5 changes: 4 additions & 1 deletion test/unit/directives/mwlResizable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('mwlresizable directive', function() {
interactInstance,
resizableOptions,
$compile,
$timeout,
template =
'<div ' +
'mwl-resizable="resizable" ' +
Expand Down Expand Up @@ -37,9 +38,10 @@ describe('mwlresizable directive', function() {
$provide.constant('interact', interact);
}));

beforeEach(angular.mock.inject(function(_$compile_, _$rootScope_) {
beforeEach(angular.mock.inject(function(_$compile_, _$rootScope_, _$timeout_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
$timeout = _$timeout_;
scope = $rootScope.$new();
prepareScope(scope);

Expand Down Expand Up @@ -119,6 +121,7 @@ describe('mwlresizable directive', function() {
resizableOptions.onstart(event);
resizableOptions.onmove(event);
resizableOptions.onend(event);
$timeout.flush();
expect(scope.onResizeEnd).to.have.been.calledWith(0, 4);
expect(angular.element(event.target).css('transform')).to.eql('');
expect(angular.element(event.target).css('width')).to.eql('30px');
Expand Down

0 comments on commit 26087c4

Please sign in to comment.