From 93b0bc9da74723ba65fb6250df432dad39f1a5a6 Mon Sep 17 00:00:00 2001 From: Kara Date: Wed, 4 Jan 2017 11:31:29 -0800 Subject: [PATCH] chore(input): fix selector on mdInput (#2514) --- src/demo-app/baseline/baseline-demo.html | 4 +- src/demo-app/chips/chips-demo.html | 2 +- src/demo-app/input/input-container-demo.html | 60 ++++++++++---------- src/demo-app/ripple/ripple-demo.html | 6 +- src/demo-app/snack-bar/snack-bar-demo.html | 2 +- src/demo-app/tabs/tabs-demo.html | 6 +- src/demo-app/tooltip/tooltip-demo.html | 2 +- src/lib/input/README.md | 32 +++++------ src/lib/input/input-container-errors.ts | 2 +- src/lib/input/input-container.spec.ts | 28 ++++----- src/lib/input/input-container.ts | 6 +- 11 files changed, 77 insertions(+), 73 deletions(-) diff --git a/src/demo-app/baseline/baseline-demo.html b/src/demo-app/baseline/baseline-demo.html index e28173d99f94..3b2e6a47aaf5 100644 --- a/src/demo-app/baseline/baseline-demo.html +++ b/src/demo-app/baseline/baseline-demo.html @@ -13,7 +13,7 @@ | Text 5 | - + | Text After @@ -35,7 +35,7 @@

| Text 5 | - + | Text After

diff --git a/src/demo-app/chips/chips-demo.html b/src/demo-app/chips/chips-demo.html index 086903316aca..f6932b772fc9 100644 --- a/src/demo-app/chips/chips-demo.html +++ b/src/demo-app/chips/chips-demo.html @@ -44,7 +44,7 @@

Input Container

- +

Stacked Chips

diff --git a/src/demo-app/input/input-container-demo.html b/src/demo-app/input/input-container-demo.html index 617a000e5c78..381403f7c67d 100644 --- a/src/demo-app/input/input-container-demo.html +++ b/src/demo-app/input/input-container-demo.html @@ -3,43 +3,43 @@
- +
- + - +

- + - +

@@ -52,7 +52,7 @@ Prefix + Suffix - + .00 @@ -64,24 +64,24 @@

Input

- + - + - +

Textarea

- + - + - +
@@ -118,33 +118,33 @@

Textarea

Hello  - + , how are you?

- + - +

- +

- + {{input.value.length}} / 100

- +

@@ -161,14 +161,14 @@

Textarea

- + {{hintLabelWithCharCount.value.length}}

Check to change the divider color: - +

@@ -182,23 +182,23 @@

Textarea

Check to make floating label: - +

- +

Example: 
- + .00 €
Both: - + email   @@ -252,8 +252,8 @@

Textarea

Forms - - + + @@ -263,7 +263,7 @@

Textarea

- diff --git a/src/demo-app/ripple/ripple-demo.html b/src/demo-app/ripple/ripple-demo.html index dc156317bb0b..5c9cf2bd8004 100644 --- a/src/demo-app/ripple/ripple-demo.html +++ b/src/demo-app/ripple/ripple-demo.html @@ -28,13 +28,13 @@
- + - + - diff --git a/src/demo-app/snack-bar/snack-bar-demo.html b/src/demo-app/snack-bar/snack-bar-demo.html index bbfefec80e4c..de6ed632bfdb 100644 --- a/src/demo-app/snack-bar/snack-bar-demo.html +++ b/src/demo-app/snack-bar/snack-bar-demo.html @@ -1,7 +1,7 @@

SnackBar demo

- Message: + Message:
diff --git a/src/demo-app/tabs/tabs-demo.html b/src/demo-app/tabs/tabs-demo.html index 26f9455ab1a1..d2e8c16dea1f 100644 --- a/src/demo-app/tabs/tabs-demo.html +++ b/src/demo-app/tabs/tabs-demo.html @@ -126,7 +126,7 @@

Tab Group Demo - Dynamic Height



- + @@ -170,7 +170,7 @@

Tab Group Demo - Fixed Height



- + @@ -195,7 +195,7 @@

Async Tabs



- + diff --git a/src/demo-app/tooltip/tooltip-demo.html b/src/demo-app/tooltip/tooltip-demo.html index 5266f2eaeb3c..2951e4421f3e 100644 --- a/src/demo-app/tooltip/tooltip-demo.html +++ b/src/demo-app/tooltip/tooltip-demo.html @@ -26,7 +26,7 @@

Tooltip Demo

Message: - +

diff --git a/src/lib/input/README.md b/src/lib/input/README.md index 5d0787efe35f..95a5be865ee3 100644 --- a/src/lib/input/README.md +++ b/src/lib/input/README.md @@ -6,19 +6,19 @@ used instead.** Inputs are the basic input component of Material 2. The spec can be found [here](https://www.google.com/design/spec/components/text-fields.html). `md-input-container` acts as a wrapper for native `input` and `textarea` elements. The native element wrapped by the -`md-input-container` must be marked with the `md-input` directive. +`md-input-container` must be marked with the `mdInput` directive. Simple `input` example: ```html - + ``` Simple `textarea` example: ```html - + ``` @@ -73,7 +73,7 @@ To add a prefix, use the `md-prefix` attribute on the element. Similarly, to add ```html - + .00 @@ -94,7 +94,7 @@ Specifying a side twice will result in an exception during initialization. For example, a simple character counter can be made like the following: ```html - - + - + - + ``` @@ -133,36 +133,36 @@ You can make a full form using inputs, and they will support autofill natively. ```html - +

- + - + - + {{postalCode.value.length}} / 5
- + - +

- + - +

- + - + - + {{postalCode.value.length}} / 5
diff --git a/src/lib/input/input-container-errors.ts b/src/lib/input/input-container-errors.ts index 08dc690ddadf..90a9337b2a65 100644 --- a/src/lib/input/input-container-errors.ts +++ b/src/lib/input/input-container-errors.ts @@ -24,7 +24,7 @@ export class MdInputContainerDuplicatedHintError extends MdError { /** @docs-private */ export class MdInputContainerMissingMdInputError extends MdError { constructor() { - super('md-input-container must contain an md-input directive. Did you forget to add md-input ' + + super('md-input-container must contain an mdInput directive. Did you forget to add mdInput ' + 'to the native input or textarea element?'); } } diff --git a/src/lib/input/input-container.spec.ts b/src/lib/input/input-container.spec.ts index 335acfaf3c40..f94227041189 100644 --- a/src/lib/input/input-container.spec.ts +++ b/src/lib/input/input-container.spec.ts @@ -188,7 +188,7 @@ describe('MdInputContainer', function () { angularWrappedErrorMessage(new MdInputContainerPlaceholderConflictError())); }); - it('validates that md-input child is present', () => { + it('validates that mdInput child is present', () => { let fixture = TestBed.createComponent(MdInputContainerMissingMdInputTestController); expect(() => fixture.detectChanges()).toThrowError( @@ -298,20 +298,20 @@ describe('MdInputContainer', function () { @Component({ template: ` - + ` }) class MdInputContainerWithId {} @Component({ - template: `` + template: `` }) class MdInputContainerWithDisabled { disabled: boolean; } @Component({ - template: `` + template: `` }) class MdInputContainerPlaceholderRequiredTestComponent {} @@ -327,7 +327,7 @@ class MdInputContainerPlaceholderElementTestComponent { } @Component({ - template: `` + template: `` }) class MdInputContainerPlaceholderAttrTestComponent { placeholder: string = ''; @@ -348,14 +348,14 @@ class MdInputContainerHintLabelTestController { } @Component({ - template: `` + template: `` }) class MdInputContainerInvalidTypeTestController {} @Component({ template: ` - + World ` }) @@ -381,7 +381,7 @@ class MdInputContainerInvalidHint2TestController {} class MdInputContainerInvalidHintTestController {} @Component({ - template: `` + template: `` }) class MdInputContainerBaseTestController { model: any = ''; @@ -390,7 +390,7 @@ class MdInputContainerBaseTestController { @Component({ template: ` - + ` }) class MdInputContainerDateTestController {} @@ -398,7 +398,7 @@ class MdInputContainerDateTestController {} @Component({ template: ` - + ` }) class MdInputContainerTextTestController {} @@ -406,7 +406,7 @@ class MdInputContainerTextTestController {} @Component({ template: ` - + ` }) class MdInputContainerPasswordTestController {} @@ -414,7 +414,7 @@ class MdInputContainerPasswordTestController {} @Component({ template: ` - + ` }) class MdInputContainerNumberTestController {} @@ -422,7 +422,7 @@ class MdInputContainerNumberTestController {} @Component({ template: ` - + ` }) class MdInputContainerZeroTestController { @@ -432,7 +432,7 @@ class MdInputContainerZeroTestController { @Component({ template: ` - + ` }) class MdTextareaWithBindings { diff --git a/src/lib/input/input-container.ts b/src/lib/input/input-container.ts index 37d18f2ff0db..58b80dc72846 100644 --- a/src/lib/input/input-container.ts +++ b/src/lib/input/input-container.ts @@ -68,7 +68,11 @@ export class MdHint { /** The input directive, used to mark the input that `MdInputContainer` is wrapping. */ @Directive({ - selector: 'input[md-input], textarea[md-input], input[mat-input], textarea[mat-input]', + // TODO: remove the md-input selector after next version + selector: ` + input[mdInput], textarea[mdInput], input[matInput], textarea[matInput], + input[md-input], textarea[md-input], input[mat-input], textarea[mat-input] + `, host: { 'class': 'md-input-element', '[id]': 'id',