mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
[ADF-573] support for toggling enabled state (#1912)
This commit is contained in:
committed by
Eugenio Romano
parent
4b5eb4bb29
commit
1ffc3cd080
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElementRef } from '@angular/core';
|
||||
import { FileDraggableDirective } from '../directives/file-draggable.directive';
|
||||
|
||||
describe('FileDraggableDirective', () => {
|
||||
@@ -22,7 +23,22 @@ describe('FileDraggableDirective', () => {
|
||||
let component: FileDraggableDirective;
|
||||
|
||||
beforeEach( () => {
|
||||
component = new FileDraggableDirective(null, null);
|
||||
let el = new ElementRef(null);
|
||||
component = new FileDraggableDirective(el, null);
|
||||
});
|
||||
|
||||
it('should always be enabled by default', () => {
|
||||
expect(component.enabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not allow drad and drop when disabled', () => {
|
||||
component.enabled = false;
|
||||
let event = new CustomEvent('custom-event');
|
||||
spyOn(event, 'preventDefault').and.stub();
|
||||
component.onDropFiles(event);
|
||||
component.onDragEnter(event);
|
||||
component.onDragLeave(event);
|
||||
expect(event.preventDefault).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user