diff --git a/src/cdk/keyboard/index.ts b/src/cdk/keyboard/index.ts new file mode 100644 index 000000000000..e486715ffd5e --- /dev/null +++ b/src/cdk/keyboard/index.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +export * from './keycodes'; diff --git a/src/cdk/public_api.ts b/src/cdk/public_api.ts index 91fb8910ff6b..8c771e4938f4 100644 --- a/src/cdk/public_api.ts +++ b/src/cdk/public_api.ts @@ -14,4 +14,4 @@ export * from './platform/index'; export * from './portal/index'; export * from './rxjs/index'; export * from './observe-content/index'; -export * from './keyboard/keycodes'; +export * from './keyboard/index'; diff --git a/src/cdk/testing/index.ts b/src/cdk/testing/index.ts new file mode 100644 index 000000000000..d0b8f467c650 --- /dev/null +++ b/src/cdk/testing/index.ts @@ -0,0 +1,12 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +export * from './dispatch-events'; +export * from './event-objects'; +export * from './type-in-element'; +export * from './wrapped-error-message'; diff --git a/src/lib/core/testing/type-in-element.ts b/src/cdk/testing/type-in-element.ts similarity index 100% rename from src/lib/core/testing/type-in-element.ts rename to src/cdk/testing/type-in-element.ts diff --git a/src/lib/core/testing/wrapped-error-message.ts b/src/cdk/testing/wrapped-error-message.ts similarity index 100% rename from src/lib/core/testing/wrapped-error-message.ts rename to src/cdk/testing/wrapped-error-message.ts diff --git a/src/cdk/tsconfig-tests.json b/src/cdk/tsconfig-tests.json index e02c0320f908..be799bf85115 100644 --- a/src/cdk/tsconfig-tests.json +++ b/src/cdk/tsconfig-tests.json @@ -10,8 +10,11 @@ "types": ["jasmine"], "experimentalDecorators": true }, + "files": [ + "./index.ts", + "./testing/index.ts" + ], "include": [ - "**/*.spec.ts", - "index.ts" + "**/*.spec.ts" ] } diff --git a/src/lib/autocomplete/autocomplete.spec.ts b/src/lib/autocomplete/autocomplete.spec.ts index 1ec919562190..0cf4f8fd8c6d 100644 --- a/src/lib/autocomplete/autocomplete.spec.ts +++ b/src/lib/autocomplete/autocomplete.spec.ts @@ -26,9 +26,7 @@ import {MdOption} from '../core/option/option'; import {MdInputContainer} from '../input/input-container'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; -import {createKeyboardEvent} from '../core/testing/event-objects'; -import {typeInElement} from '../core/testing/type-in-element'; +import {createKeyboardEvent, dispatchFakeEvent, typeInElement} from '@angular/cdk/testing'; import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; import {RxChain, map, startWith, filter} from '../core/rxjs/index'; diff --git a/src/lib/checkbox/checkbox.spec.ts b/src/lib/checkbox/checkbox.spec.ts index 6c993e3a1c33..14e7cc4498f8 100644 --- a/src/lib/checkbox/checkbox.spec.ts +++ b/src/lib/checkbox/checkbox.spec.ts @@ -12,7 +12,7 @@ import {By} from '@angular/platform-browser'; import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './index'; import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent} from '@angular/cdk/testing'; import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '../core/ripple/ripple-renderer'; diff --git a/src/lib/chips/chip-list.spec.ts b/src/lib/chips/chip-list.spec.ts index 20bd46fc2208..aa87a8807e0b 100644 --- a/src/lib/chips/chip-list.spec.ts +++ b/src/lib/chips/chip-list.spec.ts @@ -4,7 +4,7 @@ import {By} from '@angular/platform-browser'; import {MdChip, MdChipList, MdChipsModule} from './index'; import {FocusKeyManager} from '../core/a11y/focus-key-manager'; import {SPACE, LEFT_ARROW, RIGHT_ARROW, TAB} from '../core/keyboard/keycodes'; -import {createKeyboardEvent} from '../core/testing/event-objects'; +import {createKeyboardEvent} from '@angular/cdk/testing'; describe('MdChipList', () => { diff --git a/src/lib/core/compatibility/compatibility.spec.ts b/src/lib/core/compatibility/compatibility.spec.ts index 8f63f5df74c1..091dad452dfd 100644 --- a/src/lib/core/compatibility/compatibility.spec.ts +++ b/src/lib/core/compatibility/compatibility.spec.ts @@ -7,7 +7,7 @@ import { MD_ELEMENTS_SELECTOR, getMdCompatibilityInvalidPrefixError, } from './compatibility'; -import {wrappedErrorMessage} from '../testing/wrapped-error-message'; +import {wrappedErrorMessage} from '@angular/cdk/testing'; describe('Style compatibility', () => { diff --git a/src/lib/core/overlay/overlay-directives.spec.ts b/src/lib/core/overlay/overlay-directives.spec.ts index 89af575e58fc..babd63dc991f 100644 --- a/src/lib/core/overlay/overlay-directives.spec.ts +++ b/src/lib/core/overlay/overlay-directives.spec.ts @@ -6,7 +6,7 @@ import {OverlayContainer} from './overlay-container'; import {ConnectedPositionStrategy} from './position/connected-position-strategy'; import {ConnectedOverlayPositionChange} from './position/connected-position'; import {Directionality} from '../bidi/index'; -import {dispatchKeyboardEvent} from '../testing/dispatch-events'; +import {dispatchKeyboardEvent} from '@angular/cdk/testing'; import {ESCAPE} from '../keyboard/keycodes'; diff --git a/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts b/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts index e39650882130..692a7c39c4f2 100644 --- a/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts +++ b/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts @@ -1,7 +1,7 @@ import {inject, TestBed, async, fakeAsync, ComponentFixture, tick} from '@angular/core/testing'; import {NgModule, Component, ViewChild, ElementRef} from '@angular/core'; import {OverlayModule, Scrollable, ScrollDispatcher} from '../index'; -import {dispatchFakeEvent} from '../../testing/dispatch-events'; +import {dispatchFakeEvent} from '@angular/cdk/testing'; describe('Scroll Dispatcher', () => { diff --git a/src/lib/core/ripple/ripple.spec.ts b/src/lib/core/ripple/ripple.spec.ts index d41b3e5a646f..190a54dc151c 100644 --- a/src/lib/core/ripple/ripple.spec.ts +++ b/src/lib/core/ripple/ripple.spec.ts @@ -2,7 +2,7 @@ import {TestBed, ComponentFixture, fakeAsync, tick, inject} from '@angular/core/ import {Component, ViewChild} from '@angular/core'; import {ViewportRuler} from '../overlay/position/viewport-ruler'; import {RIPPLE_FADE_OUT_DURATION, RIPPLE_FADE_IN_DURATION} from './ripple-renderer'; -import {dispatchMouseEvent} from '../testing/dispatch-events'; +import {dispatchMouseEvent} from '@angular/cdk/testing'; import { MdRipple, MdRippleModule, MD_RIPPLE_GLOBAL_OPTIONS, RippleState, RippleGlobalOptions } from './index'; diff --git a/src/lib/core/style/focus-origin-monitor.spec.ts b/src/lib/core/style/focus-origin-monitor.spec.ts index 031659b6949f..95f02f38267c 100644 --- a/src/lib/core/style/focus-origin-monitor.spec.ts +++ b/src/lib/core/style/focus-origin-monitor.spec.ts @@ -4,9 +4,7 @@ import {StyleModule} from './index'; import {By} from '@angular/platform-browser'; import {TAB} from '../keyboard/keycodes'; import {FocusOrigin, FocusOriginMonitor, TOUCH_BUFFER_MS} from './focus-origin-monitor'; -import { - dispatchFakeEvent, dispatchKeyboardEvent, dispatchMouseEvent -} from '../testing/dispatch-events'; +import {dispatchFakeEvent, dispatchKeyboardEvent, dispatchMouseEvent} from '@angular/cdk/testing'; describe('FocusOriginMonitor', () => { diff --git a/src/lib/core/testing/dispatch-events.ts b/src/lib/core/testing/dispatch-events.ts deleted file mode 100644 index 6e7739c22454..000000000000 --- a/src/lib/core/testing/dispatch-events.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {createFakeEvent, createKeyboardEvent, createMouseEvent} from './event-objects'; - -/** Utility to dispatch any event on a Node. */ -export function dispatchEvent(node: Node | Window, event: Event): Event { - node.dispatchEvent(event); - return event; -} - -/** Shorthand to dispatch a fake event on a specified node. */ -export function dispatchFakeEvent(node: Node | Window, type: string): Event { - return dispatchEvent(node, createFakeEvent(type)); -} - -/** Shorthand to dispatch a keyboard event with a specified key code. */ -export function dispatchKeyboardEvent(node: Node, type: string, keyCode: number): KeyboardEvent { - return dispatchEvent(node, createKeyboardEvent(type, keyCode)) as KeyboardEvent; -} - -/** Shorthand to dispatch a mouse event on the specified coordinates. */ -export function dispatchMouseEvent(node: Node, type: string, x = 0, y = 0): MouseEvent { - return dispatchEvent(node, createMouseEvent(type, x, y)) as MouseEvent; -} diff --git a/src/lib/core/testing/event-objects.ts b/src/lib/core/testing/event-objects.ts deleted file mode 100644 index 6b47eb916633..000000000000 --- a/src/lib/core/testing/event-objects.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** Creates a browser MouseEvent with the specified options. */ -export function createMouseEvent(type: string, x = 0, y = 0) { - let event = document.createEvent('MouseEvent'); - - event.initMouseEvent(type, - false, /* canBubble */ - false, /* cancelable */ - window, /* view */ - 0, /* detail */ - x, /* screenX */ - y, /* screenY */ - x, /* clientX */ - y, /* clientY */ - false, /* ctrlKey */ - false, /* altKey */ - false, /* shiftKey */ - false, /* metaKey */ - 0, /* button */ - null /* relatedTarget */); - - return event; -} - -/** Dispatches a keydown event from an element. */ -export function createKeyboardEvent(type: string, keyCode: number, target?: Element) { - let event = document.createEvent('KeyboardEvent') as any; - // Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`. - let initEventFn = (event.initKeyEvent || event.initKeyboardEvent).bind(event); - let originalPreventDefault = event.preventDefault; - - initEventFn(type, true, true, window, 0, 0, 0, 0, 0, keyCode); - - // Webkit Browsers don't set the keyCode when calling the init function. - // See related bug https://bugs.webkit.org/show_bug.cgi?id=16735 - Object.defineProperties(event, { - keyCode: { get: () => keyCode }, - target: { get: () => target } - }); - - // IE won't set `defaultPrevented` on synthetic events so we need to do it manually. - event.preventDefault = function() { - Object.defineProperty(event, 'defaultPrevented', { get: () => true }); - return originalPreventDefault.apply(this, arguments); - }; - - return event; -} - -/** Creates a fake event object with any desired event type. */ -export function createFakeEvent(type: string) { - let event = document.createEvent('Event'); - event.initEvent(type, true, true); - return event; -} diff --git a/src/lib/core/testing/jasmine-matchers.ts b/src/lib/core/testing/jasmine-matchers.ts deleted file mode 100644 index 444e7290a72a..000000000000 --- a/src/lib/core/testing/jasmine-matchers.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * Collection of useful custom jasmine matchers for tests. - */ -export const customMatchers: jasmine.CustomMatcherFactories = { - toBeRole: () => { - return { - compare: function (element: Element, expectedRole: string) { - const result: jasmine.CustomMatcherResult = {pass: false}; - const actualRole = element.getAttribute('role'); - - result.pass = actualRole === expectedRole; - result.message = `Expected role for ${element.tagName} to be ${expectedRole}`; - - if (!result.pass) { - result.message += ` but was ${actualRole}`; - } - - return result; - } - }; - } -}; diff --git a/src/lib/datepicker/calendar.spec.ts b/src/lib/datepicker/calendar.spec.ts index 58a346d7112e..42fd8699ecb6 100644 --- a/src/lib/datepicker/calendar.spec.ts +++ b/src/lib/datepicker/calendar.spec.ts @@ -5,11 +5,7 @@ import {By} from '@angular/platform-browser'; import {MdMonthView} from './month-view'; import {MdYearView} from './year-view'; import {MdCalendarBody} from './calendar-body'; -import { - dispatchFakeEvent, - dispatchKeyboardEvent, - dispatchMouseEvent -} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent, dispatchKeyboardEvent, dispatchMouseEvent} from '@angular/cdk/testing'; import { DOWN_ARROW, END, diff --git a/src/lib/datepicker/datepicker.spec.ts b/src/lib/datepicker/datepicker.spec.ts index d27d1da059fc..42a60c43e125 100644 --- a/src/lib/datepicker/datepicker.spec.ts +++ b/src/lib/datepicker/datepicker.spec.ts @@ -9,11 +9,7 @@ import {MdDatepickerInput} from './datepicker-input'; import {MdInputModule} from '../input/index'; import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index'; import {ESCAPE} from '../core'; -import { - dispatchFakeEvent, - dispatchMouseEvent, - dispatchKeyboardEvent, -} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent, dispatchMouseEvent, dispatchKeyboardEvent} from '@angular/cdk/testing'; // When constructing a Date, the month is zero-based. This can be confusing, since people are diff --git a/src/lib/dialog/dialog.spec.ts b/src/lib/dialog/dialog.spec.ts index c387739be2c4..b8c843a5b515 100644 --- a/src/lib/dialog/dialog.spec.ts +++ b/src/lib/dialog/dialog.spec.ts @@ -25,7 +25,7 @@ import {MdDialog, MD_DIALOG_DATA} from './dialog'; import {MdDialogContainer} from './dialog-container'; import {OverlayContainer, ESCAPE} from '../core'; import {MdDialogRef} from './dialog-ref'; -import {dispatchKeyboardEvent} from '../core/testing/dispatch-events'; +import {dispatchKeyboardEvent} from '@angular/cdk/testing'; describe('MdDialog', () => { diff --git a/src/lib/icon/icon.spec.ts b/src/lib/icon/icon.spec.ts index 7c7c01876800..1ae567cf825f 100644 --- a/src/lib/icon/icon.spec.ts +++ b/src/lib/icon/icon.spec.ts @@ -6,7 +6,7 @@ import {Component} from '@angular/core'; import {MdIconModule} from './index'; import {MdIconRegistry, getMdIconNoHttpProviderError} from './icon-registry'; import {getFakeSvgHttpResponse} from './fake-svgs'; -import {wrappedErrorMessage} from '../core/testing/wrapped-error-message'; +import {wrappedErrorMessage} from '@angular/cdk/testing'; /** Returns the CSS classes assigned to an element as a sorted array. */ diff --git a/src/lib/input/input-container.spec.ts b/src/lib/input/input-container.spec.ts index 089d3b259958..c8f70cbe91f7 100644 --- a/src/lib/input/input-container.spec.ts +++ b/src/lib/input/input-container.spec.ts @@ -15,8 +15,7 @@ import {MdInputModule} from './index'; import {MdInputContainer, MdInputDirective} from './input-container'; import {Platform} from '../core/platform/platform'; import {PlatformModule} from '../core/platform/index'; -import {wrappedErrorMessage} from '../core/testing/wrapped-error-message'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; +import {wrappedErrorMessage, dispatchFakeEvent} from '@angular/cdk/testing'; import { getMdInputContainerDuplicatedHintError, getMdInputContainerMissingMdInputError, diff --git a/src/lib/menu/menu.spec.ts b/src/lib/menu/menu.spec.ts index d5f86b544b9e..9ec4f7684d75 100644 --- a/src/lib/menu/menu.spec.ts +++ b/src/lib/menu/menu.spec.ts @@ -21,7 +21,7 @@ import {OverlayContainer} from '../core/overlay/overlay-container'; import {Directionality, Direction} from '../core/bidi/index'; import {extendObject} from '../core/util/object-extend'; import {ESCAPE} from '../core/keyboard/keycodes'; -import {dispatchKeyboardEvent} from '../core/testing/dispatch-events'; +import {dispatchKeyboardEvent} from '@angular/cdk/testing'; describe('MdMenu', () => { diff --git a/src/lib/paginator/paginator.spec.ts b/src/lib/paginator/paginator.spec.ts index c00d8ad20ad5..72af2fbc8065 100644 --- a/src/lib/paginator/paginator.spec.ts +++ b/src/lib/paginator/paginator.spec.ts @@ -4,8 +4,7 @@ import {MdPaginator, PageEvent} from './paginator'; import {Component, ElementRef, ViewChild} from '@angular/core'; import {MdPaginatorIntl} from './paginator-intl'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {customMatchers} from '../core/testing/jasmine-matchers'; -import {dispatchMouseEvent} from '../core/testing/dispatch-events'; +import {dispatchMouseEvent} from '@angular/cdk/testing'; describe('MdPaginator', () => { @@ -14,8 +13,6 @@ describe('MdPaginator', () => { let paginator: MdPaginator; beforeEach(async(() => { - jasmine.addMatchers(customMatchers); - TestBed.configureTestingModule({ imports: [ MdPaginatorModule, diff --git a/src/lib/radio/radio.spec.ts b/src/lib/radio/radio.spec.ts index c2ca92e57f80..f14449a63e61 100644 --- a/src/lib/radio/radio.spec.ts +++ b/src/lib/radio/radio.spec.ts @@ -5,7 +5,7 @@ import {By} from '@angular/platform-browser'; import {MdRadioGroup, MdRadioButton, MdRadioChange, MdRadioModule} from './index'; import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent} from '@angular/cdk/testing'; import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '../core/ripple/ripple-renderer'; diff --git a/src/lib/select/select.spec.ts b/src/lib/select/select.spec.ts index 55a43089a3bd..54ffa6c2785f 100644 --- a/src/lib/select/select.spec.ts +++ b/src/lib/select/select.spec.ts @@ -22,8 +22,7 @@ import { } from '@angular/forms'; import {Subject} from 'rxjs/Subject'; import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {dispatchFakeEvent, dispatchKeyboardEvent} from '../core/testing/dispatch-events'; -import {wrappedErrorMessage} from '../core/testing/wrapped-error-message'; +import {dispatchFakeEvent, dispatchKeyboardEvent, wrappedErrorMessage} from '@angular/cdk/testing'; import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; import { FloatPlaceholderType, diff --git a/src/lib/slide-toggle/slide-toggle.spec.ts b/src/lib/slide-toggle/slide-toggle.spec.ts index b15dae727061..cfe7466b30ce 100644 --- a/src/lib/slide-toggle/slide-toggle.spec.ts +++ b/src/lib/slide-toggle/slide-toggle.spec.ts @@ -4,7 +4,7 @@ import {async, ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/t import {NgModel, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms'; import {MdSlideToggle, MdSlideToggleChange, MdSlideToggleModule} from './index'; import {TestGestureConfig} from '../slider/test-gesture-config'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent} from '@angular/cdk/testing'; import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '../core/ripple/ripple-renderer'; describe('MdSlideToggle', () => { diff --git a/src/lib/slider/slider.spec.ts b/src/lib/slider/slider.spec.ts index c8757de94b3b..f77a85367d46 100644 --- a/src/lib/slider/slider.spec.ts +++ b/src/lib/slider/slider.spec.ts @@ -15,7 +15,7 @@ import { RIGHT_ARROW, UP_ARROW } from '../core/keyboard/keycodes'; -import {dispatchKeyboardEvent, dispatchMouseEvent} from '../core/testing/dispatch-events'; +import {dispatchKeyboardEvent, dispatchMouseEvent} from '@angular/cdk/testing'; describe('MdSlider', () => { diff --git a/src/lib/sort/sort.spec.ts b/src/lib/sort/sort.spec.ts index a7ce91fe68c9..aaee0bf6b98a 100644 --- a/src/lib/sort/sort.spec.ts +++ b/src/lib/sort/sort.spec.ts @@ -3,13 +3,13 @@ import {Component, ElementRef, ViewChild} from '@angular/core'; import {MdSort, MdSortHeader, Sort, SortDirection, MdSortModule} from './index'; import {CdkTableModule, DataSource, CollectionViewer} from '@angular/cdk'; import {Observable} from 'rxjs/Observable'; -import {dispatchMouseEvent} from '../core/testing/dispatch-events'; +import {dispatchMouseEvent} from '@angular/cdk/testing'; import { getMdSortDuplicateMdSortableIdError, getMdSortHeaderMissingIdError, getMdSortHeaderNotContainedWithinMdSortError } from './sort-errors'; -import {wrappedErrorMessage} from '../core/testing/wrapped-error-message'; +import {wrappedErrorMessage} from '@angular/cdk/testing'; import {map} from '../core/rxjs/index'; describe('MdSort', () => { diff --git a/src/lib/tabs/tab-group.spec.ts b/src/lib/tabs/tab-group.spec.ts index 984209fdb835..d3b3b0843901 100644 --- a/src/lib/tabs/tab-group.spec.ts +++ b/src/lib/tabs/tab-group.spec.ts @@ -9,7 +9,7 @@ import {Observable} from 'rxjs/Observable'; import {MdTab} from './tab'; import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent} from '@angular/cdk/testing'; describe('MdTabGroup', () => { diff --git a/src/lib/tabs/tab-header.spec.ts b/src/lib/tabs/tab-header.spec.ts index 731b6c4ccade..1d39fc749a21 100644 --- a/src/lib/tabs/tab-header.spec.ts +++ b/src/lib/tabs/tab-header.spec.ts @@ -10,8 +10,7 @@ import {MdTabLabelWrapper} from './tab-label-wrapper'; import {RIGHT_ARROW, LEFT_ARROW, ENTER} from '../core/keyboard/keycodes'; import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {dispatchKeyboardEvent} from '../core/testing/dispatch-events'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent, dispatchKeyboardEvent} from '@angular/cdk/testing'; import {Subject} from 'rxjs/Subject'; import {By} from '@angular/platform-browser'; diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts index 91a9be1357e7..92427a06c58e 100644 --- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts +++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts @@ -5,7 +5,7 @@ import {Component, ViewChild} from '@angular/core'; import {By} from '@angular/platform-browser'; import {ViewportRuler} from '../../core/overlay/position/viewport-ruler'; import {FakeViewportRuler} from '../../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent, dispatchMouseEvent} from '../../core/testing/dispatch-events'; +import {dispatchFakeEvent, dispatchMouseEvent} from '@angular/cdk/testing'; import {Direction, Directionality} from '../../core/bidi/index'; import {Subject} from 'rxjs/Subject'; diff --git a/src/lib/tooltip/tooltip.spec.ts b/src/lib/tooltip/tooltip.spec.ts index 773808eb25fb..cf164fec5753 100644 --- a/src/lib/tooltip/tooltip.spec.ts +++ b/src/lib/tooltip/tooltip.spec.ts @@ -19,7 +19,7 @@ import {TooltipPosition, MdTooltip, MdTooltipModule, SCROLL_THROTTLE_MS} from '. import {Directionality, Direction} from '../core/bidi/index'; import {OverlayModule, Scrollable, OverlayContainer} from '../core/overlay/index'; import {Platform} from '../core/platform/platform'; -import {dispatchFakeEvent} from '../core/testing/dispatch-events'; +import {dispatchFakeEvent} from '@angular/cdk/testing'; const initialTooltipMessage = 'initial tooltip message'; diff --git a/src/lib/tsconfig-tests.json b/src/lib/tsconfig-tests.json index 92eb3d94d4fb..f360edc75b8a 100644 --- a/src/lib/tsconfig-tests.json +++ b/src/lib/tsconfig-tests.json @@ -9,7 +9,11 @@ "target": "es5", "types": ["jasmine"], "experimentalDecorators": true, - "strictNullChecks": true + "strictNullChecks": true, + "paths": { + "@angular/cdk": ["../../dist/packages/cdk"], + "@angular/cdk/testing": ["../../dist/packages/cdk/testing"] + } }, "include": [ "**/*.spec.ts", diff --git a/src/tsconfig.json b/src/tsconfig.json index a36291be9772..16ab41cbf40c 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -16,7 +16,8 @@ "baseUrl": ".", "paths": { "@angular/material": ["./lib/public_api.ts"], - "@angular/cdk": ["./cdk/public_api.ts"] + "@angular/cdk": ["./cdk/public_api.ts"], + "@angular/cdk/testing": ["./cdk/testing"] } }, "exclude": [ diff --git a/test/karma-test-shim.js b/test/karma-test-shim.js index a93a6de91af4..42939bf1f96e 100644 --- a/test/karma-test-shim.js +++ b/test/karma-test-shim.js @@ -49,6 +49,7 @@ System.config({ // TODO(devversion): replace once the index.ts file for the Material package has been added. '@angular/material': 'dist/packages/material/public_api.js', '@angular/cdk': 'dist/packages/cdk/index.js', + '@angular/cdk/testing': 'dist/packages/cdk/testing/index.js', }, packages: { // Thirdparty barrels.