blob: bb6b4d069aac929bec9c5521636968d2d0f12d56 [file] [log] [blame]
Sean Condon0c577f62018-11-18 22:40:05 +00001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { DraggableDirective } from './draggable.directive';
17import {inject, TestBed} from '@angular/core/testing';
18import {ElementRef} from '@angular/core';
19
20export class MockElementRef extends ElementRef {
21 nativeElement = {};
22}
23
24describe('DraggableDirective', () => {
25 let mockWindow: Window;
26
27 beforeEach(() => {
28 mockWindow = <any>{
29 navigator: {
30 userAgent: 'HeadlessChrome',
31 vendor: 'Google Inc.'
32 }
33 };
34
35 TestBed.configureTestingModule({
36 providers: [DraggableDirective,
37 { provide: 'Window', useFactory: (() => mockWindow ) },
38 { provide: ElementRef, useValue: mockWindow }
39 ]
40 });
41 });
42
43 it('should create an instance', inject([DraggableDirective], (directive: DraggableDirective) => {
44
45 expect(directive).toBeTruthy();
46 }));
47});