Skip to content

Commit 8ad650b

Browse files
committed
address comments
1 parent 448e01e commit 8ad650b

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

@@ -786,7 +787,7 @@ describe('MdAutocomplete', () => {
786787
fixture.whenStable().then(() => {
787788
fixture.detectChanges();
788789
expect(input.getAttribute('aria-expanded'))
789-
.toBe('false', 'Expected aria-expanded to be false when panel hides itself.');
790+
.toBe('false', 'Expected aria-expanded to be false when panel hides itself.');
790791
});
791792
});
792793
});
@@ -1072,18 +1073,6 @@ class AutocompleteWithNgModel {
10721073

10731074
}
10741075

1075-
/**
1076-
* Focuses an input, sets its value and dispatches
1077-
* the `input` event, simulating the user typing.
1078-
* @param value Value to be set on the input.
1079-
* @param element Element onto which to set the value.
1080-
*/
1081-
function typeInElement(value: string, element: HTMLInputElement, autoFocus = true) {
1082-
element.focus();
1083-
element.value = value;
1084-
dispatchFakeEvent(element, 'input');
1085-
}
1086-
10871076
/** This is a mock keyboard event to test keyboard events in the autocomplete. */
10881077
class MockKeyboardEvent {
10891078
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)