Skip to content

Commit 0c3c2bb

Browse files
committed
address comments
1 parent 514003e commit 0c3c2bb

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/lib/autocomplete/autocomplete.spec.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {MdAutocomplete} from './autocomplete';
1515
import {MdInputContainer} from '../input/input-container';
1616
import {Observable} from 'rxjs/Observable';
1717
import {dispatchFakeEvent} from '../core/testing/dispatch-events';
18+
import {typeInElement} from '../core/testing/type-in-element';
1819

1920
import 'rxjs/add/operator/map';
2021

@@ -781,7 +782,7 @@ describe('MdAutocomplete', () => {
781782
fixture.whenStable().then(() => {
782783
fixture.detectChanges();
783784
expect(input.getAttribute('aria-expanded'))
784-
.toBe('false', 'Expected aria-expanded to be false when panel hides itself.');
785+
.toBe('false', 'Expected aria-expanded to be false when panel hides itself.');
785786
});
786787
});
787788
});
@@ -1025,18 +1026,6 @@ class AutocompleteWithoutForms {
10251026

10261027
}
10271028

1028-
/**
1029-
* Focuses an input, sets its value and dispatches
1030-
* the `input` event, simulating the user typing.
1031-
* @param value Value to be set on the input.
1032-
* @param element Element onto which to set the value.
1033-
*/
1034-
function typeInElement(value: string, element: HTMLInputElement, autoFocus = true) {
1035-
element.focus();
1036-
element.value = value;
1037-
dispatchFakeEvent(element, 'input');
1038-
}
1039-
10401029
/** This is a mock keyboard event to test keyboard events in the autocomplete. */
10411030
class MockKeyboardEvent {
10421031
constructor(public keyCode: number) {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {dispatchFakeEvent} from './dispatch-events';
2+
3+
/**
4+
* Focuses an input, sets its value and dispatches
5+
* the `input` event, simulating the user typing.
6+
* @param value Value to be set on the input.
7+
* @param element Element onto which to set the value.
8+
*/
9+
export function typeInElement(value: string, element: HTMLInputElement, autoFocus = true) {
10+
element.focus();
11+
element.value = value;
12+
dispatchFakeEvent(element, 'input');
13+
}

0 commit comments

Comments
 (0)