Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(slider): constraints value between min and max #1567

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a53a129
fix(slider): constraints value between min and max
feloy Oct 22, 2016
da2af1e
chore: add gulp-cli as dev dep (#1587)
jelbourn Oct 24, 2016
c9ef34c
docs(dialog): document MdDialog (#1569)
feloy Oct 25, 2016
920c875
fix(radio): only call change callback with user input (#1521)
kara Oct 25, 2016
ffbc295
feat(overlay): set overlay size (#1583)
kara Oct 25, 2016
1ad457b
chore: update sauce connect binary to latest version (#1563)
jelbourn Oct 25, 2016
43786b8
chore(getting-started): make theming section more attention-grabbing.…
jelbourn Oct 25, 2016
35f0044
chore(packages): add http module to package.json (#1579)
DAB0mB Oct 25, 2016
333b11e
feat(checkbox): add color attribute. (#1463)
mathebox Oct 25, 2016
6f322cf
feat(overlay): support all overlay config properties (#1591)
kara Oct 25, 2016
c0e6f83
chore: update @angular/compiler-cli version (#1597)
jelbourn Oct 25, 2016
b56f520
feat(overlay): support rtl in overlays (#1593)
kara Oct 25, 2016
c6b4c22
chore(menu): move common styles into core (#1600)
kara Oct 25, 2016
9422793
chore(select): finish scaffolding (#1601)
kara Oct 25, 2016
dbfd235
fix(slider): clamp displayed thumb instead of value between min and max
feloy Oct 25, 2016
2e651e7
test(radio): add e2e test for radio button (#1582)
tinayuangao Oct 25, 2016
95b2a34
feat(a11y): manager for list keyboard events (#1599)
kara Oct 25, 2016
8e16992
chore: fix firebase dev instance (#1606)
jelbourn Oct 25, 2016
2ebb46f
chore(build): fix build to update components (#1604)
kara Oct 25, 2016
f0e3e26
fix(slider): tests
feloy Oct 26, 2016
fdc0ac8
fix(slider): remove unused test class
feloy Oct 26, 2016
65401a3
chore: snackbar tests should clean up afterwards (#1609)
jelbourn Oct 26, 2016
9eaf7e4
chore(checkbox): add e2e tests (#1602)
tinayuangao Oct 26, 2016
c63b9f4
chore: remove BooleanFieldValue (#1290)
jelbourn Oct 26, 2016
f10ac7c
fix(button): set vertical alignment for md-button and md-raised-butto…
tinayuangao Oct 26, 2016
8e7f80d
fix(slider): update thumb position when value changes. Closes #1386 (…
mmalerba Oct 26, 2016
8c1a791
fix(slider): constraints value between min and max
feloy Oct 22, 2016
e33360d
fix(slider): clamp displayed thumb instead of value between min and max
feloy Oct 25, 2016
86758f3
fix(slider): tests
feloy Oct 26, 2016
f43bacf
fix(slider): remove unused test class
feloy Oct 26, 2016
4570998
Merge branch 'slider-1557' of https://github.com/feloy/material2 into…
feloy Oct 26, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
/libpeerconnection.log
npm-debug.log
testem.log
/.chrome
11 changes: 6 additions & 5 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ import { MaterialModule } from '@angular/material';
export class PizzaPartyAppModule { }
```

## Including core and theme styles:
This is required to apply all of the core and theme styles to your application.
See the [theming guide](docs/theming.md) for instructions.
## Include the core and theme styles:
This is **required** to apply all of the core and theme styles to your application. You can either
use a pre-built theme, or define your own custom theme.

:trident: See the [theming guide](docs/theming.md) for instructions.

## Additional setup for `md-slide-toggle` and `md-slider`:
### Additional setup for `md-slide-toggle` and `md-slider`:
The slide-toggle and slider components have a dependency on [HammerJS](http://hammerjs.github.io/).

Add HammerJS to your application via [npm](https://www.npmjs.com/package/hammerjs), a CDN
(such as the [Google CDN](https://developers.google.com/speed/libraries/#hammerjs)), or served
directly from your app.

## [Optional] Using Material Design icons with `md-icon`:
### [Optional] Using Material Design icons with `md-icon`:

- If you want to use Material Design icons in addition to Angular Material components,
load the Material Design font in your `index.html`.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ High level items planned for October 2016:
| menu | Initial version, needs enhancements | [README][17] | [#119][0119] |
| tooltip | Initial version, needs enhancements | [README][18] | - |
| ripples | Available, but needs to be applied | [README][19] | [#108][0108] |
| dialog | Started, not yet ready for release | - | [#114][0114] |
| dialog | Started, not yet ready for release | [README][22] | [#114][0114] |
| snackbar / toast | Initial version, needs enhancements | [README][21] | [#115][0115] |
| select | Design started | - | [#118][0118] |
| textarea | Not started | - | [#546][0546] |
Expand Down Expand Up @@ -102,6 +102,7 @@ High level items planned for October 2016:
[19]: https://github.com/angular/material2/blob/master/src/lib/core/ripple/README.md
[20]: https://github.com/angular/material2/blob/master/docs/theming.md
[21]: https://github.com/angular/material2/blob/master/src/lib/snack-bar/README.md
[22]: https://github.com/angular/material2/blob/master/src/lib/dialog/README.md

[0107]: https://github.com/angular/material2/issues/107
[0119]: https://github.com/angular/material2/issues/119
Expand Down
18 changes: 18 additions & 0 deletions e2e/components/checkbox/checkbox.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe('checkbox', function () {
describe('check behavior', function () {
beforeEach(function() {
browser.get('/checkbox');
});
it('should be checked when clicked, and be unchecked when clicked again', function () {
element(by.id('test-checkbox')).click();
element(by.css('input[id=input-test-checkbox]')).getAttribute('checked').then((value: string) => {
expect(value).toBeTruthy('Expect checkbox "checked" property to be true');
});

element(by.id('test-checkbox')).click();
element(by.css('input[id=input-test-checkbox]')).getAttribute('checked').then((value: string) => {
expect(value).toBeFalsy('Expect checkbox "checked" property to be false');
});
});
});
});
51 changes: 51 additions & 0 deletions e2e/components/radio/radio.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
describe('radio', function () {

describe('disabling behavior', function () {
beforeEach(function() {
browser.get('/radio');
});

it('should be checked when clicked', function () {
element(by.id('water')).click();
element(by.id('water')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-checked');
});
element(by.css('input[id=water-input]')).getAttribute('checked').then((value: string) => {
expect(value).toBeTruthy();
});
element(by.css('input[id=leaf-input]')).getAttribute('checked').then((value: string) => {
expect(value).toBeFalsy();
});

element(by.id('leaf')).click();
element(by.id('leaf')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-checked');
});
element(by.css('input[id=leaf-input]')).getAttribute('checked').then((value: string) => {
expect(value).toBeTruthy();
});
element(by.css('input[id=water-input]')).getAttribute('checked').then((value: string) => {
expect(value).toBeFalsy();
});
});

it('should be disabled when disable the radio group', function () {
element(by.id('toggle-disable')).click();
element(by.id('water')).click();
element(by.id('water')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-disabled');
});
element(by.css('input[id=water-input]')).getAttribute('disabled').then((value: string) => {
expect(value).toBeTruthy();
});

element(by.id('leaf')).click();
element(by.id('leaf')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-disabled');
});
element(by.css('input[id=leaf-input]')).getAttribute('disabled').then((value: string) => {
expect(value).toBeTruthy();
});
});
});
});
49 changes: 28 additions & 21 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
{
"firebase": "material2-test",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**",
"tmp",
"deploy",
"typings"
],
"headers": [{
"source": "*",
"headers": [{
"key": "Cache-Control",
"value": "no-cache"
}]
}],
"rewrites": [{
"source": "/**/!(*.@(js|ts|html|css|json|svg|png|jpg|jpeg))",
"destination": "/index.html"
}]
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "/**/!(*.@(js|ts|html|css|json|svg|png|jpg|jpeg))",
"destination": "/index.html"
}
],
"headers": [
{
"source": "*",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**",
"tmp",
"deploy",
"typings"
]
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"zone.js": "^0.6.23"
},
"devDependencies": {
"@angular/compiler-cli": "0.6.0",
"@angular/compiler-cli": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@types/glob": "^5.0.29",
"@types/gulp": "^3.8.29",
Expand All @@ -57,6 +57,7 @@
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-clean": "^0.3.2",
"gulp-cli": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-server-livereload": "^1.8.2",
"gulp-shell": "^0.5.2",
Expand Down
4 changes: 2 additions & 2 deletions scripts/sauce/sauce_connect_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ CONNECT_STDERR="$LOGS_DIR/sauce-connect.stderr"
if [ `uname -s` = "Darwin" ]; then
# If the user is running Mac, download the OSX version
# https://en.wikipedia.org/wiki/Darwin_(operating_system)
CONNECT_URL="https://saucelabs.com/downloads/sc-4.3.11-osx.zip"
CONNECT_URL="https://saucelabs.com/downloads/sc-4.4.1-osx.zip"
else
# Otherwise, default to Linux for Travis-CI
CONNECT_URL="https://saucelabs.com/downloads/sc-4.3.11-linux.tar.gz"
CONNECT_URL="https://saucelabs.com/downloads/sc-4.4.1-linux.tar.gz"
fi
mkdir -p $CONNECT_DIR
cd $CONNECT_DIR
Expand Down
12 changes: 12 additions & 0 deletions src/demo-app/button/button-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,16 @@
<a href="http://www.google.com" md-raised-button color="primary">SEARCH</a>
<button md-raised-button>DANCE</button>
</section>
<section>
<button md-raised-button>More<md-icon>more_vert</md-icon></button>
<button md-raised-button>Check<md-icon>check</md-icon></button>
<button md-raised-button>Check<md-icon class="md-24">favorite</md-icon></button>
<button md-raised-button>Last<md-icon>navigate_before</md-icon></button>
</section>
<section>
<button md-button>More<md-icon>more_vert</md-icon></button>
<button md-button>Check<md-icon>check</md-icon></button>
<button md-button>Check<md-icon class="md-24">favorite</md-icon></button>
<button md-button>Last<md-icon>navigate_before</md-icon></button>
</section>
</div>
5 changes: 4 additions & 1 deletion src/demo-app/checkbox/checkbox-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ <h1>md-checkbox: Basic Example</h1>
<form>
<md-checkbox [(ngModel)]="isChecked"
name="cb"
[color]="checkboxColor()"
(change)="isIndeterminate = false"
[indeterminate]="isIndeterminate"
[disabled]="isDisabled"
Expand All @@ -18,6 +19,8 @@ <h1>md-checkbox: Basic Example</h1>
<label for="indeterminate-toggle">Toggle Indeterminate</label>
<input id="disabled-toggle" type="checkbox" [(ngModel)]="isDisabled">
<label for="disabled-toggle">Toggle Disabled</label>
<input id="color-toggle" type="checkbox" [(ngModel)]="useAlternativeColor">
<label for="color-toggle">Toggle Color</label>
</div>
<div>
<p>Alignment:</p>
Expand All @@ -41,4 +44,4 @@ <h1>md-checkbox: Basic Example</h1>
</div>

<h1>Nested Checklist</h1>
<md-checkbox-demo-nested-checklist></md-checkbox-demo-nested-checklist>
<md-checkbox-demo-nested-checklist></md-checkbox-demo-nested-checklist>
5 changes: 5 additions & 0 deletions src/demo-app/checkbox/checkbox-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@ export class CheckboxDemo {
isChecked: boolean = false;
isDisabled: boolean = false;
alignment: string = 'start';
useAlternativeColor: boolean = false;

printResult() {
if (this.isIndeterminate) {
return 'Maybe!';
}
return this.isChecked ? 'Yes!' : 'No!';
}

checkboxColor() {
return this.useAlternativeColor ? 'primary' : 'accent';
}
}
5 changes: 3 additions & 2 deletions src/demo-app/overlay/overlay-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
Open menu
</button>

<template connected-overlay [origin]="trigger">
<div style="background-color: mediumpurple" *ngIf="isMenuOpen">
<template connected-overlay [origin]="trigger" [width]="500" hasBackdrop [open]="isMenuOpen"
(backdropClick)="isMenuOpen=false">
<div style="background-color: mediumpurple" >
This is the menu panel.
</div>
</template>
Expand Down
4 changes: 4 additions & 0 deletions src/demo-app/slider/slider-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ <h1>Slider with set tick interval</h1>
<h1>Slider with Thumb Label</h1>
<md-slider thumb-label></md-slider>

<h1>Slider with one-way binding</h1>
<md-slider [value]="val" step="40"></md-slider>
<input [(ngModel)]="val">

<h1>Slider with two-way binding</h1>
<md-slider [(ngModel)]="demo" step="40"></md-slider>
<input [(ngModel)]="demo">
1 change: 1 addition & 0 deletions src/demo-app/slider/slider-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ import {Component} from '@angular/core';
})
export class SliderDemo {
demo: number;
val: number = 50;
}
1 change: 1 addition & 0 deletions src/e2e-app/checkbox/checkbox-e2e.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<md-checkbox id="test-checkbox">Check this button</md-checkbox>
8 changes: 8 additions & 0 deletions src/e2e-app/checkbox/checkbox-e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Component} from '@angular/core';

@Component({
moduleId: module.id,
selector: 'checkbox-e2e',
templateUrl: 'checkbox-e2e.html',
})
export class SimpleCheckboxes {}
4 changes: 4 additions & 0 deletions src/e2e-app/e2e-app-module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {RouterModule} from '@angular/router';
import {SimpleCheckboxes} from './checkbox/checkbox-e2e';
import {E2EApp, Home} from './e2e-app/e2e-app';
import {IconE2E} from './icon/icon-e2e';
import {ButtonE2E} from './button/button-e2e';
import {MenuE2E} from './menu/menu-e2e';
import {SimpleRadioButtons} from './radio/radio-e2e';
import {BasicTabs} from './tabs/tabs-e2e';
import {MaterialModule} from '@angular/material';
import {E2E_APP_ROUTES} from './e2e-app/routes';
Expand All @@ -22,6 +24,8 @@ import {E2E_APP_ROUTES} from './e2e-app/routes';
ButtonE2E,
MenuE2E,
BasicTabs,
SimpleRadioButtons,
SimpleCheckboxes,
Home,
],
bootstrap: [E2EApp],
Expand Down
2 changes: 2 additions & 0 deletions src/e2e-app/e2e-app/e2e-app.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<a md-list-item [routerLink]="['button']">Button</a>
<a md-list-item [routerLink]="['checkbox']">Checkbox</a>
<a md-list-item [routerLink]="['icon']">Icon</a>
<a md-list-item [routerLink]="['menu']">Menu</a>
<a md-list-item [routerLink]="['radio']">Radios</a>
<a md-list-item [routerLink]="['tabs']">Tabs</a>

<router-outlet></router-outlet>
5 changes: 5 additions & 0 deletions src/e2e-app/e2e-app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ import {ButtonE2E} from '../button/button-e2e';
import {BasicTabs} from '../tabs/tabs-e2e';
import {IconE2E} from '../icon/icon-e2e';
import {MenuE2E} from '../menu/menu-e2e';
import {SimpleRadioButtons} from '../radio/radio-e2e';
import {SimpleCheckboxes} from '../checkbox/checkbox-e2e';

export const E2E_APP_ROUTES: Routes = [
{path: '', component: Home},
{path: 'button', component: ButtonE2E},
{path: 'checkbox', component: SimpleCheckboxes},
{path: 'menu', component: MenuE2E},
{path: 'icon', component: IconE2E},
{path: 'radio', component: SimpleRadioButtons},
{path: 'tabs', component: BasicTabs}

];
10 changes: 10 additions & 0 deletions src/e2e-app/radio/radio-e2e.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<section>
<md-radio-group [disabled]="isGroupDisabled"
[(value)]="groupValue"
id="test-group">
<md-radio-button value="fire" id="fire">Charmander</md-radio-button>
<md-radio-button value="water" id="water">Squirtle</md-radio-button>
<md-radio-button value="leaf" id="leaf">Bulbasaur</md-radio-button>
</md-radio-group>
<button (click)="isGroupDisabled=!isGroupDisabled" id="toggle-disable">Disable/enable group</button>
</section>
10 changes: 10 additions & 0 deletions src/e2e-app/radio/radio-e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from '@angular/core';

@Component({
moduleId: module.id,
selector: 'radio-e2e',
templateUrl: 'radio-e2e.html',
})
export class SimpleRadioButtons {
isGroupDisabled: boolean = false;
}
11 changes: 3 additions & 8 deletions src/lib/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ import {
forwardRef,
AfterViewInit
} from '@angular/core';
import {
NG_VALUE_ACCESSOR,
ControlValueAccessor,
FormsModule,
} from '@angular/forms';
import {NG_VALUE_ACCESSOR, ControlValueAccessor, FormsModule} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {BooleanFieldValue, MdUniqueSelectionDispatcher} from '../core';
import {MdUniqueSelectionDispatcher, coerceBooleanProperty} from '../core';

export type ToggleType = 'checkbox' | 'radio';

Expand Down Expand Up @@ -102,13 +98,12 @@ export class MdButtonToggleGroup implements AfterViewInit, ControlValueAccessor
}

@Input()
@BooleanFieldValue()
get disabled(): boolean {
return this._disabled;
}

set disabled(value) {
this._disabled = (value != null && value !== false) ? true : null;
this._disabled = coerceBooleanProperty(value);
}

@Input()
Expand Down
Loading