Skip to content

Commit 178323c

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 7151d93 + 332a4a2 commit 178323c

27 files changed

+763
-53
lines changed

src/demo-app/card/card-demo.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<md-card>
1515
<md-card-subtitle>Subtitle</md-card-subtitle>
16-
<md-card-title>Card with title</md-card-title>
16+
<md-card-title>Card with title and footer</md-card-title>
1717
<md-card-content>
1818
<p>This is supporting text.</p>
1919
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
@@ -22,6 +22,9 @@
2222
<button md-button>LIKE</button>
2323
<button md-button>SHARE</button>
2424
</md-card-actions>
25+
<md-card-footer>
26+
<md-progress-bar mode="indeterminate"></md-progress-bar>
27+
</md-card-footer>
2528
</md-card>
2629

2730
<md-card>

src/demo-app/ripple/ripple-demo.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,4 @@
4949
Click me
5050
</div>
5151
</section>
52-
{{centered}} {{rounded}}
5352
</div>

src/demo-app/slide-toggle/slide-toggle-demo.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,19 @@
1111
<md-slide-toggle [disabled]="firstToggle">
1212
Disable Bound
1313
</md-slide-toggle>
14+
15+
<p>Example where the slide toggle is required inside of a form.</p>
16+
17+
<form #form="ngForm" (ngSubmit)="onFormSubmit()">
18+
19+
<md-slide-toggle name="slideToggle" required ngModel>
20+
Slide Toggle
21+
</md-slide-toggle>
22+
23+
<p>
24+
<button md-raised-button type="submit">Submit Form</button>
25+
</p>
26+
27+
</form>
28+
1429
</div>

src/demo-app/slide-toggle/slide-toggle-demo.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ import {Component} from '@angular/core';
99
})
1010
export class SlideToggleDemo {
1111
firstToggle: boolean;
12+
13+
onFormSubmit() {
14+
alert(`You submitted the form.`);
15+
}
16+
1217
}

src/lib/card/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ We also provide a number of preset sections that you can mix and match within th
2727
* `<md-card-content>`: main content section, intended for blocks of text
2828
* `<img md-card-image>`: stretches image to container width
2929
* `<md-card-actions>`: wraps and styles buttons
30-
* `<md-card-footer>`: anchors section to bottom of card
30+
* `<md-card-footer>`: anchors section to bottom of card (e.g progress bar)
3131

3232
Example markup for a card with section presets:
3333

src/lib/card/card.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ md-card-actions {
7272

7373
md-card-footer {
7474
position: absolute;
75+
width: 100%;
76+
min-height: 5px;
7577
bottom: 0;
78+
left: 0;
7679
}
7780

7881
md-card-actions {

src/lib/card/card.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ export class MdCardSubtitle {}
4040
})
4141
export class MdCardActions {}
4242

43+
/**
44+
* Footer of a card, needed as it's used as a selector in the API.
45+
*/
46+
@Directive({
47+
selector: 'md-card-footer'
48+
})
49+
export class MdCardFooter {}
50+
4351

4452
/*
4553
@@ -118,11 +126,11 @@ export class MdCardTitleGroup {}
118126
@NgModule({
119127
exports: [
120128
MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
121-
MdCardActions
129+
MdCardActions, MdCardFooter
122130
],
123131
declarations: [
124132
MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
125-
MdCardActions
133+
MdCardActions, MdCardFooter
126134
],
127135
})
128136
export class MdCardModule {

src/lib/checkbox/checkbox.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div class="md-checkbox-inner-container">
33
<input class="md-checkbox-input md-visually-hidden" type="checkbox"
44
[id]="inputId"
5+
[required]="required"
56
[checked]="checked"
67
[disabled]="disabled"
78
[name]="name"

src/lib/checkbox/checkbox.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,11 @@ md-checkbox {
402402
}
403403
}
404404

405+
.md-checkbox-input {
406+
// Move the input to the bottom and in the middle.
407+
// Visual improvement to properly show browser popups when being required.
408+
bottom: 0;
409+
left: 50%;
410+
}
411+
405412
@include md-temporary-ink-ripple(checkbox);

src/lib/checkbox/checkbox.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,18 @@ describe('MdCheckbox', () => {
255255

256256
}));
257257

258+
it('should forward the required attribute', () => {
259+
testComponent.isRequired = true;
260+
fixture.detectChanges();
261+
262+
expect(inputElement.required).toBe(true);
263+
264+
testComponent.isRequired = false;
265+
fixture.detectChanges();
266+
267+
expect(inputElement.required).toBe(false);
268+
});
269+
258270
describe('state transition css classes', () => {
259271
it('should transition unchecked -> checked -> unchecked', () => {
260272
testComponent.isChecked = true;
@@ -502,6 +514,7 @@ describe('MdCheckbox', () => {
502514
<div (click)="parentElementClicked = true" (keyup)="parentElementKeyedUp = true">
503515
<md-checkbox
504516
id="simple-check"
517+
[required]="isRequired"
505518
[align]="alignment"
506519
[checked]="isChecked"
507520
[indeterminate]="isIndeterminate"
@@ -516,6 +529,7 @@ describe('MdCheckbox', () => {
516529
class SingleCheckbox {
517530
alignment: string = 'start';
518531
isChecked: boolean = false;
532+
isRequired: boolean = false;
519533
isIndeterminate: boolean = false;
520534
isDisabled: boolean = false;
521535
parentElementClicked: boolean = false;

0 commit comments

Comments
 (0)