Skip to content

Commit 40e48e4

Browse files
committed
address comments
1 parent e50d0ef commit 40e48e4

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/lib/autocomplete/autocomplete.spec.ts

+2-13
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

@@ -807,7 +808,7 @@ describe('MdAutocomplete', () => {
807808
fixture.whenStable().then(() => {
808809
fixture.detectChanges();
809810
expect(input.getAttribute('aria-expanded'))
810-
.toBe('false', 'Expected aria-expanded to be false when panel hides itself.');
811+
.toBe('false', 'Expected aria-expanded to be false when panel hides itself.');
811812
});
812813
});
813814
});
@@ -1114,18 +1115,6 @@ class AutocompleteWithNgModel {
11141115

11151116
}
11161117

1117-
/**
1118-
* Focuses an input, sets its value and dispatches
1119-
* the `input` event, simulating the user typing.
1120-
* @param value Value to be set on the input.
1121-
* @param element Element onto which to set the value.
1122-
*/
1123-
function typeInElement(value: string, element: HTMLInputElement, autoFocus = true) {
1124-
element.focus();
1125-
element.value = value;
1126-
dispatchFakeEvent(element, 'input');
1127-
}
1128-
11291118
/** This is a mock keyboard event to test keyboard events in the autocomplete. */
11301119
class MockKeyboardEvent {
11311120
constructor(public keyCode: number) {}
+13
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)