Skip to content

Commit

Permalink
WIP: Re-indent
Browse files Browse the repository at this point in the history
  • Loading branch information
acdvorak committed Feb 12, 2019
1 parent 01b22be commit ebbbbb9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
23 changes: 12 additions & 11 deletions packages/mdc-select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ class MDCSelect extends MDCComponent<MDCSelectFoundation> implements RippleCapab
private validationObserver_!: MutationObserver; // assigned in initialize()

initialize(
labelFactory: LabelFactory = (el) => new MDCFloatingLabel(el),
lineRippleFactory: LineRippleFactory = (el) => new MDCLineRipple(el),
outlineFactory: OutlineFactory = (el) => new MDCNotchedOutline(el),
menuFactory: MenuFactory = (el) => new MDCMenu(el),
iconFactory: IconFactory = (el) => new MDCSelectIcon(el),
helperTextFactory: HelperTextFactory = (el) => new MDCSelectHelperText(el)) {
labelFactory: LabelFactory = (el) => new MDCFloatingLabel(el),
lineRippleFactory: LineRippleFactory = (el) => new MDCLineRipple(el),
outlineFactory: OutlineFactory = (el) => new MDCNotchedOutline(el),
menuFactory: MenuFactory = (el) => new MDCMenu(el),
iconFactory: IconFactory = (el) => new MDCSelectIcon(el),
helperTextFactory: HelperTextFactory = (el) => new MDCSelectHelperText(el),
) {
this.nativeControl_ = this.root_.querySelector(strings.NATIVE_CONTROL_SELECTOR);
this.selectedText_ = this.root_.querySelector(strings.SELECTED_TEXT_SELECTOR);

Expand Down Expand Up @@ -385,12 +386,12 @@ class MDCSelect extends MDCComponent<MDCSelectFoundation> implements RippleCapab
// tslint:disable:object-literal-sort-keys
return {
getValue: () => this.nativeControl_!.value,
setValue: (value: string) => this.nativeControl_!.value = value,
setValue: (value: string) => { this.nativeControl_!.value = value; },
openMenu: () => undefined,
closeMenu: () => undefined,
isMenuOpen: () => false,
setSelectedIndex: (index: number) => this.nativeControl_!.selectedIndex = index,
setDisabled: (isDisabled: boolean) => this.nativeControl_!.disabled = isDisabled,
setSelectedIndex: (index: number) => { this.nativeControl_!.selectedIndex = index; },
setDisabled: (isDisabled: boolean) => { this.nativeControl_!.disabled = isDisabled; },
setValid: (isValid: boolean) => {
if (isValid) {
this.root_.classList.remove(cssClasses.INVALID);
Expand Down Expand Up @@ -578,8 +579,8 @@ class MDCSelect extends MDCComponent<MDCSelectFoundation> implements RippleCapab

const getAttributesList = (mutationsList: MutationRecord[]): string[] => {
return mutationsList
.map((mutation) => mutation.attributeName)
.filter((attributeName) => attributeName) as string[];
.map((mutation) => mutation.attributeName)
.filter((attributeName) => attributeName) as string[];
};
const observer = new MutationObserver((mutationsList) => observerHandler(getAttributesList(mutationsList)));
const element = this.nativeControl_ || this.selectedText_!;
Expand Down
1 change: 0 additions & 1 deletion packages/mdc-select/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export interface SelectEventDetail {
index: number;
}

// TODO(acdvorak): Every component should export its own factory and event types.
export type LineRippleFactory = (el: Element) => MDCLineRipple;
export type HelperTextFactory = (el: Element) => MDCSelectHelperText;
export type MenuFactory = (el: Element) => MDCMenu;
Expand Down

0 comments on commit ebbbbb9

Please sign in to comment.