Skip to content

Commit

Permalink
WIP: Fix remaining unit test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
acdvorak committed Feb 8, 2019
1 parent cb8620a commit cea3fad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/mdc-textfield/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,11 @@ class MDCTextFieldFoundation extends MDCFoundation<MDCTextFieldAdapter> {
* @return The native text input from the host environment, or a dummy if none exists.
*/
private getNativeInput_(): HTMLInputElement | NativeInputType {
return this.adapter_.getNativeInput() || {
// adapter_ can be undefined in foundation unit tests. This happens when testdouble is creating a mock object and
// invokes the shouldShake/shouldFloat getters (which in turn call getValue(), which calls this method) before
// init() has been called in the MDCTextField constructor.
const nativeInput = this.adapter_ ? this.adapter_.getNativeInput() : null;
return nativeInput || {
disabled: false,
maxLength: -1,
type: 'input',
Expand Down

0 comments on commit cea3fad

Please sign in to comment.